I am trying to interact with Matic smart contract on Mumbai chain. The contract address would be - 0x0000000000000000000000000000000000001010.
This code below is calling the approve method.
const web3 = new Web3(window.ethereum);
const nonce = await web3.eth.getTransactionCount(
window.ethereum.selectedAddress
);
//get the contract of Matic token
const contract = new web3.eth.Contract(
MaticABI as AbiItem[],
process.env.NEXT_PUBLIC_MATIC_TOKEN_ADDRESS
);
const approve = await contract.methods
.approve(
process.env.NEXT_PUBLIC_TESTNET_MARKETPLACE_CONTRACT_ADDRESS,
web3.utils.toBN(data.price)
)
.send(
{
from: window.ethereum.selectedAddress,
nonce: nonce,
gasPrice: web3.utils.toHex(web3.utils.toWei('90', 'gwei')),
gas: web3.utils.toHex(9000000),
data: contract.methods.approve(
process.env.NEXT_PUBLIC_TESTNET_MARKETPLACE_CONTRACT_ADDRESS,
web3.utils.toBN(data.price)
),
},
(err: any, res: any) => {.
if (err) {
console.log('err', err);
} else {
console.log('res', res);
}
})
But each transaction is getting reverted by the EVM. Here is one of the transaction etails, https://mumbai.polygonscan.com/tx/0x9f06e951c5f84654a8bd6202cf3fc792239848aadd7d340777ccd70e65b8af5b
I am not getting how to fix this.