lazy-snark/truffle/contracts/VerifierProxy.sol

24 lines
836 B
Solidity
Raw Normal View History

2019-06-22 19:10:54 +03:00
pragma solidity ^0.5.4;
pragma experimental ABIEncoderV2;
2019-06-23 09:54:34 +03:00
import "./IVerifier.sol";
2019-06-22 19:29:10 +03:00
import "./Verifier.sol";
2019-06-22 19:10:54 +03:00
2019-06-23 09:54:34 +03:00
contract VerifierProxy is IVerifier {
2019-06-22 19:10:54 +03:00
Verifier internal verifier;
constructor(Verifier ver) public {
verifier = ver;
}
// Truffle gives `UnimplementedFeatureError: Encoding struct from calldata is not yet supported.`
// that's why function is public and uses memory location modifier
function isValid(Data memory data, Proof memory proof) public returns (bool) {
2019-06-23 14:59:32 +03:00
// bytes memory payload = abi.encodeWithSelector(verifier.verifyTx.selector, proof, data);
// (bool success, bytes memory r) = address(verifier).call(payload);
// require(success);
// return abi.decode(r, (bool));
return verifier.verifyTx(proof.a, proof.b, proof.c, data.input);
2019-06-22 19:10:54 +03:00
}
}