File tree 1 file changed +33
-0
lines changed
packages/hardhat-verify/test/unit
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -537,6 +537,39 @@ but 2 arguments were provided instead.`);
537
537
) ;
538
538
} ) ;
539
539
540
+ it ( "should throw if a parameter type does not match its expected type: number instead of string" , async ( ) => {
541
+ const abi : JsonFragment [ ] = [
542
+ {
543
+ inputs : [
544
+ {
545
+ name : "amount" ,
546
+ type : "uint256" ,
547
+ } ,
548
+ {
549
+ name : "amount" ,
550
+ type : "string" ,
551
+ } ,
552
+ {
553
+ name : "amount" ,
554
+ type : "address" ,
555
+ } ,
556
+ ] ,
557
+ stateMutability : "nonpayable" ,
558
+ type : "constructor" ,
559
+ } ,
560
+ ] ;
561
+ const constructorArguments : any [ ] = [
562
+ 50 ,
563
+ 50 , // Invalid string
564
+ "0x752C8191E6b1Db38B41A8c8921F7a703F2969d18" ,
565
+ ] ;
566
+ await expect (
567
+ encodeArguments ( abi , sourceName , contractName , constructorArguments )
568
+ ) . to . be . rejectedWith (
569
+ / V a l u e 5 0 c a n n o t b e e n c o d e d f o r t h e p a r a m e t e r a m o u n t ./
570
+ ) ;
571
+ } ) ;
572
+
540
573
it ( "should throw if an unsafe integer is provided as an argument" , async ( ) => {
541
574
const abi : JsonFragment [ ] = [
542
575
{
You can’t perform that action at this time.
0 commit comments