mirror of
				https://github.com/Instadapp/dsa-periphery-contract.git
				synced 2024-07-29 22:27:13 +00:00 
			
		
		
		
	fix: adapter unit test
This commit is contained in:
		
							parent
							
								
									4ca1c65a3e
								
							
						
					
					
						commit
						1d4c71377a
					
				|  | @ -10,13 +10,9 @@ contract MockInstadappReceiver is InstadappAdapter { | ||||||
| 
 | 
 | ||||||
|   function tryAuthCast( |   function tryAuthCast( | ||||||
|     address dsaAddress, |     address dsaAddress, | ||||||
|     address auth, |     bytes memory authcastCallData | ||||||
|     bytes memory signature, |  | ||||||
|     CastData memory castData, |  | ||||||
|     bytes32 salt, |  | ||||||
|     uint256 deadline |  | ||||||
|   ) external payable { |   ) external payable { | ||||||
|     authCast(dsaAddress, auth, signature, castData, salt, deadline); |     authCast(dsaAddress, authcastCallData); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function tryVerify( |   function tryVerify( | ||||||
|  | @ -71,8 +67,16 @@ contract InstadappAdapterTest is TestHelper { | ||||||
|     address auth = originSender; |     address auth = originSender; | ||||||
|     bytes32 salt = bytes32(abi.encode(1)); |     bytes32 salt = bytes32(abi.encode(1)); | ||||||
| 
 | 
 | ||||||
|  |     bytes memory authcastCallData = abi.encode( | ||||||
|  |       auth, | ||||||
|  |       signature, | ||||||
|  |       castData, | ||||||
|  |       salt, | ||||||
|  |       deadline | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|     vm.expectRevert(bytes("Invalid Auth")); |     vm.expectRevert(bytes("Invalid Auth")); | ||||||
|     MockInstadappReceiver(instadappReceiver).tryAuthCast(dsa, auth, signature, castData, salt, deadline); |     MockInstadappReceiver(instadappReceiver).tryAuthCast(dsa, authcastCallData); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function test_InstadappAdapter__authCast_shouldRevertIfInvalidSignature() public { |   function test_InstadappAdapter__authCast_shouldRevertIfInvalidSignature() public { | ||||||
|  | @ -96,7 +100,16 @@ contract InstadappAdapterTest is TestHelper { | ||||||
|     address auth = originSender; |     address auth = originSender; | ||||||
|     bytes32 salt = bytes32(abi.encode(1)); |     bytes32 salt = bytes32(abi.encode(1)); | ||||||
|     vm.expectRevert(bytes("Invalid signature")); |     vm.expectRevert(bytes("Invalid signature")); | ||||||
|     MockInstadappReceiver(instadappReceiver).tryAuthCast(dsa, auth, signature, castData, salt, deadline); | 
 | ||||||
|  |     bytes memory authcastCallData = abi.encode( | ||||||
|  |       auth, | ||||||
|  |       signature, | ||||||
|  |       castData, | ||||||
|  |       salt, | ||||||
|  |       deadline | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|  |     MockInstadappReceiver(instadappReceiver).tryAuthCast(dsa, authcastCallData); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   function test_InstadappAdapter__authCast_shouldWork() public { |   function test_InstadappAdapter__authCast_shouldWork() public { | ||||||
|  | @ -122,7 +135,16 @@ contract InstadappAdapterTest is TestHelper { | ||||||
| 
 | 
 | ||||||
|     address auth = originSender; |     address auth = originSender; | ||||||
|     vm.warp(timestamp); |     vm.warp(timestamp); | ||||||
|     MockInstadappReceiver(instadappReceiver).tryAuthCast{value: 1}(dsa, auth, signature, castData, salt, deadline); |      | ||||||
|  |     bytes memory authcastCallData = abi.encode( | ||||||
|  |       auth, | ||||||
|  |       signature, | ||||||
|  |       castData, | ||||||
|  |       salt, | ||||||
|  |       deadline | ||||||
|  |     ); | ||||||
|  | 
 | ||||||
|  |     MockInstadappReceiver(instadappReceiver).tryAuthCast(dsa, authcastCallData); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // ============ InstadappAdapter.verify ============ |   // ============ InstadappAdapter.verify ============ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 sanchaymittal
						sanchaymittal