Skip to content

Instantly share code, notes, and snippets.

@benadamsky
Created March 27, 2024 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benadamsky/0a28fe9ee6130b11a60febd3776d3754 to your computer and use it in GitHub Desktop.
Save benadamsky/0a28fe9ee6130b11a60febd3776d3754 to your computer and use it in GitHub Desktop.
...
const amount = ethers.utils.parseUnits(inputText, contract.decimals)
const erc20Abi = [
{
constant: false,
inputs: [
{
name: 'spender',
type: 'address',
},
{
name: 'amount',
type: 'uint256',
},
],
name: 'approve',
outputs: [
{
name: '',
type: 'bool',
},
],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
]
return c.contract({
abi: erc20Abi,
chainId: 'eip155:8453', // hardcoded base for now
functionName: 'approve',
args: [surveyBountyContract.address, amount],
to: contract.address,
})
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment