I hope you are all well.
I have 2 functions. The "transferFrom function" allows a third party to send ether from an account which is owned by another address. The "approve" function is used to allow the third party to use the "transferFrom" function.
My problem is that when I want to use the "transferFrom" function it does not work and my web browser displays this error message: "MetaMask - RPC Error: Invalid parameters: must provide an Ethereum address." The addresses are Ethereum addresses.
Here are the functions:
function transferFrom(address from, address to, uint value) public returns(bool) {
uint allowance = allowed[from][msg.sender];
require(allowance >= value, 'allowance too low');
require(balances[from] >= value, 'token balance too low');
allowed[from][msg.sender] -= value;
balances[from] -= value;
balances[to] += value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint value) public returns(bool) {
require(spender != msg.sender, 'spender must not be sender');
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
Would you have an idea on how to solve this problem please?
Thank you very much
Take care
Pierre
transfer
is incorrect. Check the way the functions is being called and the parameters used. The solidity code seems to be fine.