My question is pretty simple
I'm trying to call a function in my smart contract from ethers.js
I just need to set a variable of type "address" in my contract.
Code:
//solidity
function setTokenX(address _tokenX) public {
tokenX = _tokenX;
}
//js
tokenX = '0x3fdaf6c54eba05edebed44c4f986f49a5de55113';
await mycontract.setTokenX(tokenX);
It works a weird way for some reason. On Etherscan my variable is displayed as
0x361d47ce0000000000000000000000003fdaf6c54eba05edebed44c4f986f49a5de55113
While in the in javascript I send the parameter as a string. What's the catch? Should I encode it and then abi.decode in solidity? How to do this with ethers.js?