update adapter unit test

This commit is contained in:
sanchaymittal 2023-05-04 16:38:56 +09:00
parent 9c75cdc05a
commit cea5da6e4d
No known key found for this signature in database
GPG Key ID: D794EEBC262F179E

View File

@ -18,6 +18,16 @@ contract MockInstadappReceiver is InstadappAdapter {
) external payable { ) external payable {
authCast(dsaAddress, auth, signature, castData, salt, deadline); authCast(dsaAddress, auth, signature, castData, salt, deadline);
} }
function tryVerify(
address auth,
bytes memory signature,
CastData memory castData,
bytes32 salt,
uint256 deadline
) external returns (bool) {
return verify(auth, signature, castData, salt, deadline);
}
} }
contract InstadappAdapterTest is TestHelper { contract InstadappAdapterTest is TestHelper {
@ -139,7 +149,7 @@ contract InstadappAdapterTest is TestHelper {
address auth = originSender; address auth = originSender;
vm.warp(timestamp); vm.warp(timestamp);
assertEq(MockInstadappReceiver(instadappReceiver).verify(auth, signature, castData, salt, deadline), true); assertEq(MockInstadappReceiver(instadappReceiver).tryVerify(auth, signature, castData, salt, deadline), true);
} }
function test_InstadappAdapter__verify_shouldReturnFalse() public { function test_InstadappAdapter__verify_shouldReturnFalse() public {
@ -162,6 +172,6 @@ contract InstadappAdapterTest is TestHelper {
address auth = originSender; address auth = originSender;
bytes32 salt = bytes32(abi.encode(1)); bytes32 salt = bytes32(abi.encode(1));
assertEq(MockInstadappReceiver(instadappReceiver).verify(auth, signature, castData, salt, deadline), false); assertEq(MockInstadappReceiver(instadappReceiver).tryVerify(auth, signature, castData, salt, deadline), false);
} }
} }