MultiSignatureOracle
Provides signature verification services for the ERC20 and ERC721 bridge to allow validation of deposits between different networks
Verifies signatures for ERC20 deposits
function signaturesCheckERC20(
uint8[] memory sigV,
bytes32[] memory sigR,
bytes32[] memory sigS,
address receiverAddress,
address tokenAddress,
uint256 amount,
uint256 depositChainId,
uint256 depositNumber
) external override returns (bool) {
if (sigV.length < multiSignatureThreshold)
revert OutOfRange(sigV.length, multiSignatureThreshold, multiSignatureThreshold);
if (sigR.length != sigS.length || sigR.length != sigV.length) revert InvalidParameter();
// produce transaction input hash from input parameters
bytes32 txInputHash = keccak256(
abi.encode(TXTYPE_HASH_ERC20, receiverAddress, tokenAddress, amount, depositChainId, depositNumber)
);
// verify oracle signatures
bool verified = _verifySignatures(sigV, sigR, sigS, txInputHash);
if (!verified) revert Unauthorized();
// signatures verified - emit event
emit SignaturesCheckPassedERC20(tokenAddress, amount, receiverAddress, depositChainId, depositNumber);
return verified;
}
Name | Type | Description |
---|---|---|
sigV | uint8 | Array of recovery Ids for the signature |
sigR | bytes32 | Array of R values of the signatures |
sigS | bytes32 | Array of S values of the signatures |
receiverAddress | address | The account to receive the tokens |
tokenAddress | address | The address of the token sent for deposit |
amount | uint256 | The amount to be sent |
depositChainId | uint256 | The chain ID of the network in which the deposit was made |
depositNumber | uint256 | The deposit ID of the corresponding deposit |
Name | Type | Description |
---|---|---|
return | verified | returns true if the signatures was verified, otherwise false |
Verifies signatures for ERC721 deposits
function signaturesCheckERC721(
uint8[] memory sigV,
bytes32[] memory sigR,
bytes32[] memory sigS,
address receiverAddress,
address collectionAddress,
uint256 tokenId,
uint256 depositChainId,
uint256 depositNumber
) external override returns (bool) {
if (sigV.length < multiSignatureThreshold)
revert OutOfRange(sigV.length, multiSignatureThreshold, multiSignatureThreshold);
if (sigR.length != sigS.length || sigR.length != sigV.length) revert InvalidParameter();
// produce transaction input hash from input parameters
bytes32 txInputHash = keccak256(
abi.encode(TXTYPE_HASH_ERC721, receiverAddress, collectionAddress, tokenId, depositChainId, depositNumber)
);
// verify oracle signatures
bool verified = _verifySignatures(sigV, sigR, sigS, txInputHash);
if (!verified) revert Unauthorized();
// signatures verified - emit event
emit SignaturesCheckPassedERC721(collectionAddress, tokenId, receiverAddress, depositChainId, depositNumber);
return verified;
}
Name | Type | Description |
---|---|---|
sigV | uint8 | Array of recovery Ids for the signature |
sigR | bytes32 | Array of R values of the signatures |
sigS | bytes32 | Array of S values of the signatures |
receiverAddress | address | The account to receive the tokens |
collectionAddress | address | The address of the token sent for deposit |
tokenId | uint256 | The unique native ID of the ERC721 token |
depositChainId | uint256 | The chain ID of the network in which the deposit was made |
depositNumber | uint256 | The deposit ID of the corresponding deposit |
Name | Type | Description |
---|---|---|
return | verified | returns true if the signatures was verified, otherwise false |
Last modified 1yr ago