* Now compiling in a separate directory using truffle 5. * Ported to 0.5.1, now compiling using 0.5.1. * test now also compiles using the truffle 5 hack. * Downgraded to 0.5.0. * Sorted scripts. * Cleaned up the compile script a bit.
44 lines
940 B
Solidity
44 lines
940 B
Solidity
pragma solidity ^0.5.0;
|
|
|
|
import "../Roles.sol";
|
|
|
|
contract SignerRole {
|
|
using Roles for Roles.Role;
|
|
|
|
event SignerAdded(address indexed account);
|
|
event SignerRemoved(address indexed account);
|
|
|
|
Roles.Role private _signers;
|
|
|
|
constructor () internal {
|
|
_addSigner(msg.sender);
|
|
}
|
|
|
|
modifier onlySigner() {
|
|
require(isSigner(msg.sender));
|
|
_;
|
|
}
|
|
|
|
function isSigner(address account) public view returns (bool) {
|
|
return _signers.has(account);
|
|
}
|
|
|
|
function addSigner(address account) public onlySigner {
|
|
_addSigner(account);
|
|
}
|
|
|
|
function renounceSigner() public {
|
|
_removeSigner(msg.sender);
|
|
}
|
|
|
|
function _addSigner(address account) internal {
|
|
_signers.add(account);
|
|
emit SignerAdded(account);
|
|
}
|
|
|
|
function _removeSigner(address account) internal {
|
|
_signers.remove(account);
|
|
emit SignerRemoved(account);
|
|
}
|
|
}
|