My code is so dumb. I just want the sender had enough money to commit transactions. Can you fix it? Thanks.

Cryptocurrency News and Public Mining Pools

My code is so dumb. I just want the sender had enough money to commit transactions. Can you fix it? Thanks.

pragma solidity >=0.7.0 < 0.9.0; contract Coin { address public minter; mapping(address => uint) public balance; constructor(){ minter = msg.sender; } function mint(address reciver, uint amount) public { require(msg.sender == minter, "Not the creator, not the creator"); require(amount < 1e60); balance[reciver] += amount; } // I just want sender had enough money to commit trasaction. // Ex: Sender got 100 ETH, send 10. // : The trasaction must go through, but nope, something nasty happend. // When i type a valid number. Transaction didn't go through // And throw error "Insuficent balance" function send(address reciver, uint amount) public { require(amount <= balance[msg.sender], "Insuficent balance"); balance[msg.sender] -= amount; balance[reciver] += amount; } } 

submitted by /u/octor_stranger
[link] [comments]