Modifiers & Inheritance & Import
Modifiers
//SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
contract ModifierExample {
mapping(address => uint) public tokenBalance;
address owner;
uint tokenPrice = 1 ether;
constructor() {
owner = msg.sender;
tokenBalance[owner] = 100;
}
function createNewToken() public {
require(msg.sender == owner, "You are not the owner");
tokenBalance[owner]++;
}
function burnToken() public {
require(msg.sender == owner, "you are not allowed");
tokenBalance[owner]--;
}
}Inheritance
Import & Inherit
Import only (no inheritance)
Other import stuff
Last updated