Skip to content

Commit

Permalink
test: add basic test for hasVerification fn
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkySnow committed Mar 18, 2024
1 parent 5c7d09a commit 760d320
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/solidity/contracts/ComplianceBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface IComplianceBridge {

contract ComplianceProxy {
event VerificationResponse(bool success, bytes data);
event HasVerificationResponse(bool success, bytes data);

uint32 constant public VERIFICATION_TYPE = 2;

Expand All @@ -35,4 +36,16 @@ contract ComplianceProxy {
(bool success, bytes memory data) = address(1028).call(payload);
emit VerificationResponse(success, data);
}

function isUserVerified(address userAddress) public view returns (bool, bytes memory) {
address[] memory allowedIssuers;
bytes memory payload = abi.encodeCall(IComplianceBridge.hasVerification, (
userAddress,
VERIFICATION_TYPE,
0,
allowedIssuers
));
(bool success, bytes memory data) = address(1028).staticcall(payload);
return (success, data);
}
}
8 changes: 8 additions & 0 deletions tests/solidity/test/ComplianceBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ describe('ComplianceBridge', () => {
)
const res = await tx.wait()
console.log(contract.interface.parseLog(res.logs[0]))

const isVerifiedResponse = await sendShieldedQuery(
signer.provider,
contract.address,
contract.interface.encodeFunctionData("isUserVerified", [signer.address])
);
const result = contract.interface.decodeFunctionResult("isUserVerified", isVerifiedResponse)
console.log(result)
})
})

0 comments on commit 760d320

Please sign in to comment.