Last active
October 28, 2020 05:49
-
-
Save yuyasugano/2fee774a92826aab674ef7d206d5c929 to your computer and use it in GitHub Desktop.
encode Rinkeby DAI transfer function
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
// DAI smart contract's address in Rinkeby network, chainId = 4 | |
// https://rinkeby.etherscan.io/token/0x5592ec0cfb4dbc12d3ab100b257153436a1f0fea | |
const daiExchangeAddress = "0x5592ec0cfb4dbc12d3ab100b257153436a1f0fea"; | |
const daiExchangeAbi = require("./erc20abi.json"); | |
const web3 = new Web3( | |
new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/<endpoint>") | |
); | |
const daiExchangeContract = new web3.eth.Contract(JSON.parse(JSON.stringify(daiExchangeAbi)), daiExchangeAddress); | |
const DAI = web3.utils.toHex(100000000000000000); // 0.1 DAI | |
const exchangeEncodeABI = daiExchangeContract.methods.transfer(receiverAddress, DAI).encodeABI(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment