Created
December 2, 2020 22:03
-
-
Save PaulRBerg/966ff22cd29bfbaab3b97cec065e5310 to your computer and use it in GitHub Desktop.
Generate DSProxy calldata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ethers = require("ethers"); | |
const DSProxyAbi = require("../abis/DSProxy.json"); | |
const TargetContractAbi = require("../abis/TargetContract.json"); | |
const defaultProvider = ethers.getDefaultProvider("kovan"); | |
const dsProxyAddress = "0xa92Bed719071A4d33B0B348513E7e866a6ff6B3F"; | |
const dsProxy = new ethers.Contract(dsProxyAddress, DSProxyAbi, defaultProvider); | |
const targetContractAddress = "0xE3CD2e7a628b57d3e50c5f7B921182f676721bDF"; | |
const targetContract = new ethers.Contract(targetContractAddress, TargetContractAbi, defaultProvider); | |
const calldata = targetContract.interface.encodeFunctionData("wrapEth"); | |
console.log("calldata", calldata); | |
const finalCalldata = dsProxy.interface.encodeFunctionData("execute", [targetContractAddress, calldata]); | |
console.log("finalCalldata", finalCalldata); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment