MultiSignatureOracle
Provides signature verification services for the ERC20 and ERC721 bridge to allow validation of deposits between different networks

Functions

signaturesCheckERC20

Verifies signatures for ERC20 deposits
1
function signaturesCheckERC20(
2
uint8[] memory sigV,
3
bytes32[] memory sigR,
4
bytes32[] memory sigS,
5
address receiverAddress,
6
address tokenAddress,
7
uint256 amount,
8
uint256 depositChainId,
9
uint256 depositNumber
10
) external override returns (bool) {
11
if (sigV.length < multiSignatureThreshold)
12
revert OutOfRange(sigV.length, multiSignatureThreshold, multiSignatureThreshold);
13
if (sigR.length != sigS.length || sigR.length != sigV.length) revert InvalidParameter();
14
15
// produce transaction input hash from input parameters
16
bytes32 txInputHash = keccak256(
17
abi.encode(TXTYPE_HASH_ERC20, receiverAddress, tokenAddress, amount, depositChainId, depositNumber)
18
);
19
20
// verify oracle signatures
21
bool verified = _verifySignatures(sigV, sigR, sigS, txInputHash);
22
if (!verified) revert Unauthorized();
23
24
// signatures verified - emit event
25
emit SignaturesCheckPassedERC20(tokenAddress, amount, receiverAddress, depositChainId, depositNumber);
26
27
return verified;
28
}
Copied!

Parameters:

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

Return value:

Name
Type
Description
return
verified
returns true if the signatures was verified, otherwise false

signaturesCheckERC721

Verifies signatures for ERC721 deposits
1
function signaturesCheckERC721(
2
uint8[] memory sigV,
3
bytes32[] memory sigR,
4
bytes32[] memory sigS,
5
address receiverAddress,
6
address collectionAddress,
7
uint256 tokenId,
8
uint256 depositChainId,
9
uint256 depositNumber
10
) external override returns (bool) {
11
if (sigV.length < multiSignatureThreshold)
12
revert OutOfRange(sigV.length, multiSignatureThreshold, multiSignatureThreshold);
13
if (sigR.length != sigS.length || sigR.length != sigV.length) revert InvalidParameter();
14
15
// produce transaction input hash from input parameters
16
bytes32 txInputHash = keccak256(
17
abi.encode(TXTYPE_HASH_ERC721, receiverAddress, collectionAddress, tokenId, depositChainId, depositNumber)
18
);
19
20
// verify oracle signatures
21
bool verified = _verifySignatures(sigV, sigR, sigS, txInputHash);
22
if (!verified) revert Unauthorized();
23
24
// signatures verified - emit event
25
emit SignaturesCheckPassedERC721(collectionAddress, tokenId, receiverAddress, depositChainId, depositNumber);
26
return verified;
27
}
28
Copied!

Parameters:

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

Return value:

Name
Type
Description
return
verified
returns true if the signatures was verified, otherwise false