From c442ec056efd816dc5540fb674812cc70e05ab4b Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 25 Sep 2018 10:13:48 +0100 Subject: [PATCH] Add authorization printer example --- examples/printers/authorization.sol | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/printers/authorization.sol diff --git a/examples/printers/authorization.sol b/examples/printers/authorization.sol new file mode 100644 index 000000000..a4b361754 --- /dev/null +++ b/examples/printers/authorization.sol @@ -0,0 +1,25 @@ +pragma solidity ^0.4.24; +contract Owner{ + + address owner; + + modifier onlyOwner(){ + require(msg.sender == owner); + _; + } + +} + +contract MyContract is Owner{ + + mapping(address => uint) balances; + + constructor() public{ + owner = msg.sender; + } + + function mint(uint value) onlyOwner public{ + balances[msg.sender] += value; + } + +}