Problem with Solidity functions

Problem with Solidity functions

Manage alerts

Loading saved threads...

Pierre · External communityPost link
External question — Ethereum Stack Exchange Author: Pierre Original post: https://ethereum.stackexchange.com/questions/107075 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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
Quote
Report
Harglin · External communityPost link
External answer — Ethereum Stack Exchange Author: Harglin Original post: https://ethereum.stackexchange.com/a/107139 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. There are two possible problems you may have encountered, The first might be if you are using Ganache as a local test server check to make sure that the port is the same as the one in truffle.config Secondly you might be getting that error due to you being in privacy mode on Metamask try disabling that.
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External answer — Ethereum Stack Exchange Author: Harglin Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/a/107139 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. There are two possible problems you may have encountered, The first might be if you are using Ganache as a local test server check to make sure that the port is the same as the one in truffle.config Secondly you might be getting that error due to you being in privacy mode on Metamask try disabling that.

Cancel quote

Checking account access…