contract.
I have a such midifier:
modifier onlyOwner {
require(msg.sender == OWNER, "Access denied");
_;
}
Also I have a constructor when I initialize OWNER var:
constructor() {
OWNER = msg.sender;
}
And when I'm making a request via web3.js to the method with this modifier from owner I'm getting 'Access denied' error:
const tx = contract.methods.Method("args");
const receipt = await tx
.send({
from: signer.address,
gas: await tx.estimateGas(),
});
Above I print OWNER address and signer.address and I have the same values:
const owner = await contract.methods.OWNER().call();
console.log(owner);
console.log(signer.address);
Output of these:
0x9d17a8517afa39b8c06b9A041A6361E06c43029D
0x9d17a8517afa39b8c06b9A041A6361E06c43029D
Can anybody help me? What's wrong? I tested in the rinkeby testnet
they would be the same value if you deployed the contract with the same EOA that you are using to make the .send call with to the contract
do you have any another ideas?
Обсуждают сегодня