[SOLVED] Error in Moralis.executeFunction

Hi I am trying to do cross chain bridge. This is the bridge contract I have deployed.
https://testnet.bscscan.com/address/0x016eEb8486ff05C58995A1Ec180e1D5C94CC409d

Here is my lockToken function in client side. I want to do lock token manually, so want to use metamask for transaction. I am getting the error like in this screenshot.

async function LockToken(){

const web3Provider = await Moralis.enableWeb3();
let params ={
_requester : "0x4a78a8ac0c301D5f71Fbea7Bf797a2200403f28A",
_bridgedAmount : 10,
_mainDepositHash : "0x0126ee02ab814b39cbeb23b552a02cf4dcb13472f6a680ae94e98ba7147d63e3"
}    
const options = {
    contractAddress: bridgeAddressBSC,
    functionName: "lockTokens",
    abi: bridgeABI,
    msgValue: params,
  };

  const transaction = await Moralis.executeFunction(options);
  const receipt = await transaction.wait();
  console.log("receipt",receipt)

}

bridgeABI : const bridgeABI = [{“inputs”:[{“internalType”:“address”,“name”:"_mainToken",“type”:“address”},{“internalType”:“address”,“name”:"_gateway",“type”:“address”}],“stateMutability”:“nonpayable”,“type”:“constructor”},{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“requester”,“type”:“address”},{“indexed”:true,“internalType”:“bytes32”,“name”:“mainDepositHash”,“type”:“bytes32”},{“indexed”:false,“internalType”:“uint256”,“name”:“amount”,“type”:“uint256”},{“indexed”:false,“internalType”:“uint256”,“name”:“timestamp”,“type”:“uint256”}],“name”:“TokensLocked”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“requester”,“type”:“address”},{“indexed”:true,“internalType”:“bytes32”,“name”:“sideDepositHash”,“type”:“bytes32”},{“indexed”:false,“internalType”:“uint256”,“name”:“amount”,“type”:“uint256”},{“indexed”:false,“internalType”:“uint256”,“name”:“timestamp”,“type”:“uint256”}],“name”:“TokensUnlocked”,“type”:“event”},{“inputs”:[{“internalType”:“address”,“name”:"_requester",“type”:“address”},{“internalType”:“uint256”,“name”:"_bridgedAmount",“type”:“uint256”},{“internalType”:“bytes32”,“name”:"_mainDepositHash",“type”:“bytes32”}],“name”:“lockTokens”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:"_requester",“type”:“address”},{“internalType”:“uint256”,“name”:"_bridgedAmount",“type”:“uint256”},{“internalType”:“bytes32”,“name”:"_sideDepositHash",“type”:“bytes32”}],“name”:“unlockTokens”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”}]

This doesn’t seem like the expected syntax

changed to this and its working. Thanks

const options = {
contractAddress: bridgeAddressBSC,
functionName: “lockTokens”,
abi: bridgeABI,
params:params,
};

1 Like