Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delegate to lockProof() #85

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions solidity/contracts/lib/zeto_common.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ abstract contract ZetoCommon is OwnableUpgradeable {
// should be called by escrow contracts that will use uploaded proofs
// to execute transactions, in order to prevent the proof from being used
// by parties other than the escrow contract
function lockProof(Commonlib.Proof calldata proof) public {
function lockProof(
Commonlib.Proof calldata proof,
address delegate
) public {
bytes32 proofHash = Commonlib.getProofHash(proof);
lockedProofs[proofHash] = msg.sender;
require(lockedProofs[proofHash] == address(0), "Proof already locked");
awrichar marked this conversation as resolved.
Show resolved Hide resolved
if (delegate != address(0)) {
lockedProofs[proofHash] = delegate;
} else {
lockedProofs[proofHash] = msg.sender;
awrichar marked this conversation as resolved.
Show resolved Hide resolved
}
}

function sortInputsAndOutputs(
Expand Down
2 changes: 2 additions & 0 deletions solidity/contracts/zkDvP.sol
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ contract zkDvP {
bytes32 proofHash = getProofHash(proof);
if (trade.paymentProofHash == proofHash) {
trade.paymentProof = proof;
paymentToken.lockProof(proof, address(this));
} else if (trade.assetProofHash == proofHash) {
trade.assetProof = proof;
assetToken.lockProof(proof, address(this));
} else {
revert("Invalid proof");
}
Expand Down
Loading