0
contract coin{
    address public minting;
   mapping (address=> uint) public balances;
event sent(address from, address to, uint amount);
   constructor(){
       minting = msg.sender;
   }
   function mint(address receiver, uint amount) public{
       require(msg.sender == minting)
       balances[receiver] = balances[receiver]+amount;
       
   }
   error insufficientbalance(uint req, uint ava);
   function sent(address receiver, uint amount) public {
       if (amount > balances[msg.sender])
       revert insufficientbalance(
           {
               req: amount,
               ava: balances[msg.sender]
           }
       );
       balances[msg.sender]-= amount;
       balances[receiver]+= amount;
     emit sent(msg.sender, receiver, amount);
   }

}

1 Answer 1

0
  1. You're missing ; on the previous line.

  2. You're missing brackets around if block {}

  3. your sent function needs to have different name than send event

1
  • You can mark my answer as a solution if it solved your problem. Jan 31, 2022 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.