2021-10-05 14:12:39 +02:00
|
|
|
const { ethers } = require('hardhat')
|
|
|
|
|
|
|
|
const abi = new ethers.utils.AbiCoder()
|
|
|
|
|
2021-10-06 16:51:46 +02:00
|
|
|
function encodeDataForBridge({ proof, extData }) {
|
2021-10-05 14:12:39 +02:00
|
|
|
return abi.encode(
|
|
|
|
[
|
|
|
|
'tuple(bytes proof,bytes32 root,bytes32[] inputNullifiers,bytes32[2] outputCommitments,uint256 publicAmount,bytes32 extDataHash)',
|
|
|
|
'tuple(address recipient,int256 extAmount,address relayer,uint256 fee,bytes encryptedOutput1,bytes encryptedOutput2,bool isL1Withdrawal)',
|
|
|
|
],
|
2021-10-06 16:51:46 +02:00
|
|
|
[proof, extData],
|
2021-10-05 14:12:39 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-10-06 16:51:46 +02:00
|
|
|
module.exports = { encodeDataForBridge }
|