Answers for "hardhat debugging with console.log"

0

hardhat debugging with console.log

function transfer(address to, uint256 amount) external {
    console.log("Sender balance is %s tokens", balances[msg.sender]);
    console.log("Trying to send %s tokens to %s", amount, to);

    require(balances[msg.sender] >= amount, "Not enough tokens");

    balances[msg.sender] -= amount;
    balances[to] += amount;
}
Posted by: Guest on April-24-2022

Browse Popular Code Answers by Language