Contract Address Details

0xFa8d865A962ca8456dF331D78806152d3aC5B84F

Identity Last Balance Update: Block #10988779
Created by 0x5128–22e4bb at 0xbadb–03ae5a

Balance

0 Fuse

Fetching tokens...

Contract name:
Identity




Optimization enabled
true
Compiler version
v0.5.16+commit.9c3226ce




Optimization runs
200
EVM Version
default

Contract source code

/**
* Submitted for verification at blockscout.com on 2020-11-22 22:47:03.369683Z
*/
/**
Support UBI! https://github.com/GoodDollar/GoodContracts
*/
pragma solidity >0.5.4;
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0));
return role.bearer[account];
}
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender));
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Reputation system
* @dev A DAO has Reputation System which allows peers to rate other peers in order to build trust .
* A reputation is use to assign influence measure to a DAO'S peers.
* Reputation is similar to regular tokens but with one crucial difference: It is non-transferable.
* The Reputation contract maintain a map of address to reputation value.
* It provides an onlyOwner functions to mint and burn reputation _to (or _from) a specific address.
*/
contract Reputation is Ownable {
uint8 public decimals = 18; //Number of decimals of the smallest unit
// Event indicating minting of reputation to an address.
event Mint(address indexed _to, uint256 _amount);
// Event indicating burning of reputation for an address.
event Burn(address indexed _from, uint256 _amount);
/// @dev `Checkpoint` is the structure that attaches a block number to a
/// given value, the block number attached is the one that last changed the
/// value
struct Checkpoint {
// `fromBlock` is the block number that the value was generated from
uint128 fromBlock;
// `value` is the amount of reputation at a specific block number
uint128 value;
}
// `balances` is the map that tracks the balance of each address, in this
// contract when the balance changes the block number that the change
// occurred is also included in the map
mapping (address => Checkpoint[]) balances;
// Tracks the history of the `totalSupply` of the reputation
Checkpoint[] totalSupplyHistory;
/// @notice Constructor to create a Reputation
constructor(
) public
{
}
/// @dev This function makes it easy to get the total number of reputation
/// @return The total number of reputation
function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
////////////////
// Query balance and totalSupply in History
////////////////
/**
* @dev return the reputation amount of a given owner
* @param _owner an address of the owner which we want to get his reputation
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOfAt(_owner, block.number);
}
/// @dev Queries the balance of `_owner` at a specific `_blockNumber`
/// @param _owner The address from which the balance will be retrieved
/// @param _blockNumber The block number when the balance is queried
/// @return The balance at `_blockNumber`
function balanceOfAt(address _owner, uint256 _blockNumber)
public view returns (uint256)
{
if ((balances[_owner].length == 0) || (balances[_owner][0].fromBlock > _blockNumber)) {
return 0;
// This will return the expected balance during normal situations
} else {
return getValueAt(balances[_owner], _blockNumber);
}
}
/// @notice Total amount of reputation at a specific `_blockNumber`.
/// @param _blockNumber The block number when the totalSupply is queried
/// @return The total amount of reputation at `_blockNumber`
function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) {
if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) {
return 0;
// This will return the expected totalSupply during normal situations
} else {
return getValueAt(totalSupplyHistory, _blockNumber);
}
}
/// @notice Generates `_amount` reputation that are assigned to `_owner`
/// @param _user The address that will be assigned the new reputation
/// @param _amount The quantity of reputation generated
/// @return True if the reputation are generated correctly
function mint(address _user, uint256 _amount) public onlyOwner returns (bool) {
uint256 curTotalSupply = totalSupply();
require(curTotalSupply + _amount >= curTotalSupply); // Check for overflow
uint256 previousBalanceTo = balanceOf(_user);
require(previousBalanceTo + _amount >= previousBalanceTo); // Check for overflow
updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
updateValueAtNow(balances[_user], previousBalanceTo + _amount);
emit Mint(_user, _amount);
return true;
}
/// @notice Burns `_amount` reputation from `_owner`
/// @param _user The address that will lose the reputation
/// @param _amount The quantity of reputation to burn
/// @return True if the reputation are burned correctly
function burn(address _user, uint256 _amount) public onlyOwner returns (bool) {
uint256 curTotalSupply = totalSupply();
uint256 amountBurned = _amount;
uint256 previousBalanceFrom = balanceOf(_user);
if (previousBalanceFrom < amountBurned) {
amountBurned = previousBalanceFrom;
}
updateValueAtNow(totalSupplyHistory, curTotalSupply - amountBurned);
updateValueAtNow(balances[_user], previousBalanceFrom - amountBurned);
emit Burn(_user, amountBurned);
return true;
}
////////////////
// Internal helper functions to query and set a value in a snapshot array
////////////////
/// @dev `getValueAt` retrieves the number of reputation at a given block number
/// @param checkpoints The history of values being queried
/// @param _block The block number to retrieve the value at
/// @return The number of reputation being queried
function getValueAt(Checkpoint[] storage checkpoints, uint256 _block) internal view returns (uint256) {
if (checkpoints.length == 0) {
return 0;
}
// Shortcut for the actual value
if (_block >= checkpoints[checkpoints.length-1].fromBlock) {
return checkpoints[checkpoints.length-1].value;
}
if (_block < checkpoints[0].fromBlock) {
return 0;
}
// Binary search of the value in the array
uint256 min = 0;
uint256 max = checkpoints.length-1;
while (max > min) {
uint256 mid = (max + min + 1) / 2;
if (checkpoints[mid].fromBlock<=_block) {
min = mid;
} else {
max = mid-1;
}
}
return checkpoints[min].value;
}
/// @dev `updateValueAtNow` used to update the `balances` map and the
/// `totalSupplyHistory`
/// @param checkpoints The history of data being updated
/// @param _value The new number of reputation
function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value) internal {
require(uint128(_value) == _value); //check value is in the 128 bits bounderies
if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) {
Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
newCheckPoint.fromBlock = uint128(block.number);
newCheckPoint.value = uint128(_value);
} else {
Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1];
oldCheckPoint.value = uint128(_value);
}
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
/**
* @title DAOToken, base on zeppelin contract.
* @dev ERC20 compatible token. It is a mintable, burnable token.
*/
contract DAOToken is ERC20, ERC20Burnable, Ownable {
string public name;
string public symbol;
// solhint-disable-next-line const-name-snakecase
uint8 public constant decimals = 18;
uint256 public cap;
/**
* @dev Constructor
* @param _name - token name
* @param _symbol - token symbol
* @param _cap - token cap - 0 value means no cap
*/
constructor(string memory _name, string memory _symbol, uint256 _cap)
public {
name = _name;
symbol = _symbol;
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
*/
function mint(address _to, uint256 _amount) public onlyOwner returns (bool) {
if (cap > 0)
require(totalSupply().add(_amount) <= cap);
_mint(_to, _amount);
return true;
}
}
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/*
SafeERC20 by daostack.
The code is based on a fix by SECBIT Team.
USE WITH CAUTION & NO WARRANTY
REFERENCE & RELATED READING
- https://github.com/ethereum/solidity/issues/4116
- https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c
- https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
- https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61
*/
library SafeERC20 {
using Address for address;
bytes4 constant private TRANSFER_SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
bytes4 constant private TRANSFERFROM_SELECTOR = bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
bytes4 constant private APPROVE_SELECTOR = bytes4(keccak256(bytes("approve(address,uint256)")));
function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
function safeTransferFrom(address _erc20Addr, address _from, address _to, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {
// Must be a contract addr first!
require(_erc20Addr.isContract());
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero.
require((_value == 0) || (IERC20(_erc20Addr).allowance(address(this), _spender) == 0));
(bool success, bytes memory returnValue) =
// solhint-disable-next-line avoid-low-level-calls
_erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));
// call return false when something wrong
require(success);
//check return value
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
}
/**
* @title An Avatar holds tokens, reputation and ether for a controller
*/
contract Avatar is Ownable {
using SafeERC20 for address;
string public orgName;
DAOToken public nativeToken;
Reputation public nativeReputation;
event GenericCall(address indexed _contract, bytes _data, uint _value, bool _success);
event SendEther(uint256 _amountInWei, address indexed _to);
event ExternalTokenTransfer(address indexed _externalToken, address indexed _to, uint256 _value);
event ExternalTokenTransferFrom(address indexed _externalToken, address _from, address _to, uint256 _value);
event ExternalTokenApproval(address indexed _externalToken, address _spender, uint256 _value);
event ReceiveEther(address indexed _sender, uint256 _value);
event MetaData(string _metaData);
/**
* @dev the constructor takes organization name, native token and reputation system
and creates an avatar for a controller
*/
constructor(string memory _orgName, DAOToken _nativeToken, Reputation _nativeReputation) public {
orgName = _orgName;
nativeToken = _nativeToken;
nativeReputation = _nativeReputation;
}
/**
* @dev enables an avatar to receive ethers
*/
function() external payable {
emit ReceiveEther(msg.sender, msg.value);
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(address _contract, bytes memory _data, uint256 _value)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev send ethers from the avatar's wallet
* @param _amountInWei amount to send in Wei units
* @param _to send the ethers to this address
* @return bool which represents success
*/
function sendEther(uint256 _amountInWei, address payable _to) public onlyOwner returns(bool) {
_to.transfer(_amountInWei);
emit SendEther(_amountInWei, _to);
return true;
}
/**
* @dev external token transfer
* @param _externalToken the token contract
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransfer(_to, _value);
emit ExternalTokenTransfer(address(_externalToken), _to, _value);
return true;
}
/**
* @dev external token transfer from a specific account
* @param _externalToken the token contract
* @param _from the account to spend token from
* @param _to the destination address
* @param _value the amount of tokens to transfer
* @return bool which represents success
*/
function externalTokenTransferFrom(
IERC20 _externalToken,
address _from,
address _to,
uint256 _value
)
public onlyOwner returns(bool)
{
address(_externalToken).safeTransferFrom(_from, _to, _value);
emit ExternalTokenTransferFrom(address(_externalToken), _from, _to, _value);
return true;
}
/**
* @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
* on behalf of msg.sender.
* @param _externalToken the address of the Token Contract
* @param _spender address
* @param _value the amount of ether (in Wei) which the approval is referring to.
* @return bool which represents a success
*/
function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value)
public onlyOwner returns(bool)
{
address(_externalToken).safeApprove(_spender, _value);
emit ExternalTokenApproval(address(_externalToken), _spender, _value);
return true;
}
/**
* @dev metaData emits an event with a string, should contain the hash of some meta data.
* @param _metaData a string representing a hash of the meta data
* @return bool which represents a success
*/
function metaData(string memory _metaData) public onlyOwner returns(bool) {
emit MetaData(_metaData);
return true;
}
}
contract GlobalConstraintInterface {
enum CallPhase { Pre, Post, PreAndPost }
function pre( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool);
function post( address _scheme, bytes32 _params, bytes32 _method ) public returns(bool);
/**
* @dev when return if this globalConstraints is pre, post or both.
* @return CallPhase enum indication Pre, Post or PreAndPost.
*/
function when() public returns(CallPhase);
}
/**
* @title Controller contract
* @dev A controller controls the organizations tokens ,reputation and avatar.
* It is subject to a set of schemes and constraints that determine its behavior.
* Each scheme has it own parameters and operation permissions.
*/
interface ControllerInterface {
/**
* @dev Mint `_amount` of reputation that are assigned to `_to` .
* @param _amount amount of reputation to mint
* @param _to beneficiary address
* @return bool which represents a success
*/
function mintReputation(uint256 _amount, address _to, address _avatar)
external
returns(bool);
/**
* @dev Burns `_amount` of reputation from `_from`
* @param _amount amount of reputation to burn
* @param _from The address that will lose the reputation
* @return bool which represents a success
*/
function burnReputation(uint256 _amount, address _from, address _avatar)
external
returns(bool);
/**
* @dev mint tokens .
* @param _amount amount of token to mint
* @param _beneficiary beneficiary address
* @param _avatar address
* @return bool which represents a success
*/
function mintTokens(uint256 _amount, address _beneficiary, address _avatar)
external
returns(bool);
/**
* @dev register or update a scheme
* @param _scheme the address of the scheme
* @param _paramsHash a hashed configuration of the usage of the scheme
* @param _permissions the permissions the new scheme will have
* @param _avatar address
* @return bool which represents a success
*/
function registerScheme(address _scheme, bytes32 _paramsHash, bytes4 _permissions, address _avatar)
external
returns(bool);
/**
* @dev unregister a scheme
* @param _avatar address
* @param _scheme the address of the scheme
* @return bool which represents a success
*/
function unregisterScheme(address _scheme, address _avatar)
external
returns(bool);
/**
* @dev unregister the caller's scheme
* @param _avatar address
* @return bool which represents a success
*/
function unregisterSelf(address _avatar) external returns(bool);
/**
* @dev add or update Global Constraint
* @param _globalConstraint the address of the global constraint to be added.
* @param _params the constraint parameters hash.
* @param _avatar the avatar of the organization
* @return bool which represents a success
*/
function addGlobalConstraint(address _globalConstraint, bytes32 _params, address _avatar)
external returns(bool);
/**
* @dev remove Global Constraint
* @param _globalConstraint the address of the global constraint to be remove.
* @param _avatar the organization avatar.
* @return bool which represents a success
*/
function removeGlobalConstraint (address _globalConstraint, address _avatar)
external returns(bool);
/**
* @dev upgrade the Controller
* The function will trigger an event 'UpgradeController'.
* @param _newController the address of the new controller.
* @param _avatar address
* @return bool which represents a success
*/
function upgradeController(address _newController, Avatar _avatar)
external returns(bool);
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _avatar the controller's avatar address
* @param _value value (ETH) to transfer with the transaction
* @return bool -success
* bytes - the return value of the called _contract's function.
*/
function genericCall(address _contract, bytes calldata _data, Avatar _avatar, uint256 _value)
external
returns(bool, bytes memory);
/**
* @dev send some ether
* @param _amountInWei the amount of ether (in Wei) to send
* @param _to address of the beneficiary
* @param _avatar address
* @return bool which represents a success
*/
function sendEther(uint256 _amountInWei, address payable _to, Avatar _avatar)
external returns(bool);
/**
* @dev send some amount of arbitrary ERC20 Tokens
* @param _externalToken the address of the Token Contract
* @param _to address of the beneficiary
* @param _value the amount of ether (in Wei) to send
* @param _avatar address
* @return bool which represents a success
*/
function externalTokenTransfer(IERC20 _externalToken, address _to, uint256 _value, Avatar _avatar)
external
returns(bool);
/**
* @dev transfer token "from" address "to" address
* One must to approve the amount of tokens which can be spend from the
* "from" account.This can be done using externalTokenApprove.
* @param _externalToken the address of the Token Contract
* @param _from address of the account to send from
* @param _to address of the beneficiary
* @param _value the amount of ether (in Wei) to send
* @param _avatar address
* @return bool which represents a success
*/
function externalTokenTransferFrom(
IERC20 _externalToken,
address _from,
address _to,
uint256 _value,
Avatar _avatar)
external
returns(bool);
/**
* @dev externalTokenApproval approve the spender address to spend a specified amount of tokens
* on behalf of msg.sender.
* @param _externalToken the address of the Token Contract
* @param _spender address
* @param _value the amount of ether (in Wei) which the approval is referring to.
* @return bool which represents a success
*/
function externalTokenApproval(IERC20 _externalToken, address _spender, uint256 _value, Avatar _avatar)
external
returns(bool);
/**
* @dev metaData emits an event with a string, should contain the hash of some meta data.
* @param _metaData a string representing a hash of the meta data
* @param _avatar Avatar
* @return bool which represents a success
*/
function metaData(string calldata _metaData, Avatar _avatar) external returns(bool);
/**
* @dev getNativeReputation
* @param _avatar the organization avatar.
* @return organization native reputation
*/
function getNativeReputation(address _avatar)
external
view
returns(address);
function isSchemeRegistered( address _scheme, address _avatar) external view returns(bool);
function getSchemeParameters(address _scheme, address _avatar) external view returns(bytes32);
function getGlobalConstraintParameters(address _globalConstraint, address _avatar) external view returns(bytes32);
function getSchemePermissions(address _scheme, address _avatar) external view returns(bytes4);
/**
* @dev globalConstraintsCount return the global constraint pre and post count
* @return uint256 globalConstraintsPre count.
* @return uint256 globalConstraintsPost count.
*/
function globalConstraintsCount(address _avatar) external view returns(uint, uint);
function isGlobalConstraintRegistered(address _globalConstraint, address _avatar) external view returns(bool);
}
/* @dev abstract contract for ensuring that schemes have been registered properly
* Allows setting zero Avatar in situations where the Avatar hasn't been created yet
*/
contract SchemeGuard is Ownable {
Avatar avatar;
ControllerInterface internal controller = ControllerInterface(0);
/** @dev Constructor. only sets controller if given avatar is not null.
* @param _avatar The avatar of the DAO.
*/
constructor(Avatar _avatar) public {
avatar = _avatar;
if (avatar != Avatar(0)) {
controller = ControllerInterface(avatar.owner());
}
}
/** @dev modifier to check if caller is avatar
*/
modifier onlyAvatar() {
require(address(avatar) == msg.sender, "only Avatar can call this method");
_;
}
/** @dev modifier to check if scheme is registered
*/
modifier onlyRegistered() {
require(isRegistered(), "Scheme is not registered");
_;
}
/** @dev modifier to check if scheme is not registered
*/
modifier onlyNotRegistered() {
require(!isRegistered(), "Scheme is registered");
_;
}
/** @dev modifier to check if call is a scheme that is registered
*/
modifier onlyRegisteredCaller() {
require(isRegistered(msg.sender), "Calling scheme is not registered");
_;
}
/** @dev Function to set a new avatar and controller for scheme
* can only be done by owner of scheme
*/
function setAvatar(Avatar _avatar) public onlyOwner {
avatar = _avatar;
controller = ControllerInterface(avatar.owner());
}
/** @dev function to see if an avatar has been set and if this scheme is registered
* @return true if scheme is registered
*/
function isRegistered() public view returns (bool) {
return isRegistered(address(this));
}
/** @dev function to see if an avatar has been set and if this scheme is registered
* @return true if scheme is registered
*/
function isRegistered(address scheme) public view returns (bool) {
require(avatar != Avatar(0), "Avatar is not set");
if (!(controller.isSchemeRegistered(scheme, address(avatar)))) {
return false;
}
return true;
}
}
/**
* @title Contract managing the identity admin role
*/
contract IdentityAdminRole is Ownable {
using Roles for Roles.Role;
event IdentityAdminAdded(address indexed account);
event IdentityAdminRemoved(address indexed account);
Roles.Role private IdentityAdmins;
/* @dev constructor. Adds caller as an admin
*/
constructor() internal {
_addIdentityAdmin(msg.sender);
}
/* @dev Modifier to check if caller is an admin
*/
modifier onlyIdentityAdmin() {
require(isIdentityAdmin(msg.sender), "not IdentityAdmin");
_;
}
/**
* @dev Checks if account is identity admin
* @param account Account to check
* @return Boolean indicating if account is identity admin
*/
function isIdentityAdmin(address account) public view returns (bool) {
return IdentityAdmins.has(account);
}
/**
* @dev Adds a identity admin account. Is only callable by owner.
* @param account Address to be added
* @return true if successful
*/
function addIdentityAdmin(address account) public onlyOwner returns (bool) {
_addIdentityAdmin(account);
return true;
}
/**
* @dev Removes a identity admin account. Is only callable by owner.
* @param account Address to be removed
* @return true if successful
*/
function removeIdentityAdmin(address account) public onlyOwner returns (bool) {
_removeIdentityAdmin(account);
return true;
}
/**
* @dev Allows an admin to renounce their role
*/
function renounceIdentityAdmin() public {
_removeIdentityAdmin(msg.sender);
}
/**
* @dev Internal implementation of addIdentityAdmin
*/
function _addIdentityAdmin(address account) internal {
IdentityAdmins.add(account);
emit IdentityAdminAdded(account);
}
/**
* @dev Internal implementation of removeIdentityAdmin
*/
function _removeIdentityAdmin(address account) internal {
IdentityAdmins.remove(account);
emit IdentityAdminRemoved(account);
}
}
/* @title Identity contract responsible for whitelisting
* and keeping track of amount of whitelisted users
*/
contract Identity is IdentityAdminRole, SchemeGuard, Pausable {
using Roles for Roles.Role;
using SafeMath for uint256;
Roles.Role private blacklist;
Roles.Role private whitelist;
Roles.Role private contracts;
uint256 public whitelistedCount = 0;
uint256 public whitelistedContracts = 0;
uint256 public authenticationPeriod = 14;
mapping(address => uint256) public dateAuthenticated;
mapping(address => uint256) public dateAdded;
mapping(address => string) public addrToDID;
mapping(bytes32 => address) public didHashToAddress;
event BlacklistAdded(address indexed account);
event BlacklistRemoved(address indexed account);
event WhitelistedAdded(address indexed account);
event WhitelistedRemoved(address indexed account);
event ContractAdded(address indexed account);
event ContractRemoved(address indexed account);
constructor() public SchemeGuard(Avatar(0)) {}
/* @dev Sets a new value for authenticationPeriod.
* Can only be called by Identity Administrators.
* @param period new value for authenticationPeriod
*/
function setAuthenticationPeriod(uint256 period) public onlyOwner whenNotPaused {
authenticationPeriod = period;
}
/* @dev Sets the authentication date of `account`
* to the current time.
* Can only be called by Identity Administrators.
* @param account address to change its auth date
*/
function authenticate(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
dateAuthenticated[account] = now;
}
/* @dev Adds an address as whitelisted.
* Can only be called by Identity Administrators.
* @param account address to add as whitelisted
*/
function addWhitelisted(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
_addWhitelisted(account);
}
/* @dev Adds an address as whitelisted under a specific ID
* @param account The address to add
* @param did the ID to add account under
*/
function addWhitelistedWithDID(address account, string memory did)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
_addWhitelistedWithDID(account, did);
}
/* @dev Removes an address as whitelisted.
* Can only be called by Identity Administrators.
* @param account address to remove as whitelisted
*/
function removeWhitelisted(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
_removeWhitelisted(account);
}
/* @dev Renounces message sender from whitelisted
*/
function renounceWhitelisted() public whenNotPaused {
_removeWhitelisted(msg.sender);
}
/* @dev Returns true if given address has been added to whitelist
* @param account the address to check
* @return a bool indicating weather the address is present in whitelist
*/
function isWhitelisted(address account) public view returns (bool) {
uint256 daysSinceAuthentication = (now.sub(dateAuthenticated[account])) / 1 days;
return
(daysSinceAuthentication <= authenticationPeriod) && whitelist.has(account);
}
/* @dev Function that gives the date the given user was added
* @param account The address to check
* @return The date the address was added
*/
function lastAuthenticated(address account) public view returns (uint256) {
return dateAuthenticated[account];
}
// /**
// *
// * @dev Function to transfer whitelisted privilege to another address
// * relocates did of sender to give address
// * @param account The address to transfer to
// */
// function transferAccount(address account) public whenNotPaused {
// ERC20 token = avatar.nativeToken();
// require(!isBlacklisted(account), "Cannot transfer to blacklisted");
// require(token.balanceOf(account) == 0, "Account is already in use");
// require(isWhitelisted(msg.sender), "Requester need to be whitelisted");
// require(
// keccak256(bytes(addrToDID[account])) == keccak256(bytes("")),
// "address already has DID"
// );
// string memory did = addrToDID[msg.sender];
// bytes32 pHash = keccak256(bytes(did));
// uint256 balance = token.balanceOf(msg.sender);
// token.transferFrom(msg.sender, account, balance);
// _removeWhitelisted(msg.sender);
// _addWhitelisted(account);
// addrToDID[account] = did;
// didHashToAddress[pHash] = account;
// }
/* @dev Adds an address to blacklist.
* Can only be called by Identity Administrators.
* @param account address to add as blacklisted
*/
function addBlacklisted(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
blacklist.add(account);
emit BlacklistAdded(account);
}
/* @dev Removes an address from blacklist
* Can only be called by Identity Administrators.
* @param account address to remove as blacklisted
*/
function removeBlacklisted(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
blacklist.remove(account);
emit BlacklistRemoved(account);
}
/* @dev Function to add a Contract to list of contracts
* @param account The address to add
*/
function addContract(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
require(isContract(account), "Given address is not a contract");
contracts.add(account);
_addWhitelisted(account);
emit ContractAdded(account);
}
/* @dev Function to remove a Contract from list of contracts
* @param account The address to add
*/
function removeContract(address account)
public
onlyRegistered
onlyIdentityAdmin
whenNotPaused
{
contracts.remove(account);
_removeWhitelisted(account);
emit ContractRemoved(account);
}
/* @dev Function to check if given contract is on list of contracts.
* @param address to check
* @return a bool indicating if address is on list of contracts
*/
function isDAOContract(address account) public view returns (bool) {
return contracts.has(account);
}
/* @dev Internal function to add to whitelisted
* @param account the address to add
*/
function _addWhitelisted(address account) internal {
whitelist.add(account);
whitelistedCount += 1;
dateAdded[account] = now;
dateAuthenticated[account] = now;
if (isContract(account)) {
whitelistedContracts += 1;
}
emit WhitelistedAdded(account);
}
/* @dev Internal whitelisting with did function.
* @param account the address to add
* @param did the id to register account under
*/
function _addWhitelistedWithDID(address account, string memory did) internal {
bytes32 pHash = keccak256(bytes(did));
require(didHashToAddress[pHash] == address(0), "DID already registered");
addrToDID[account] = did;
didHashToAddress[pHash] = account;
_addWhitelisted(account);
}
/* @dev Internal function to remove from whitelisted
* @param account the address to add
*/
function _removeWhitelisted(address account) internal {
whitelist.remove(account);
whitelistedCount -= 1;
delete dateAuthenticated[account];
if (isContract(account)) {
whitelistedContracts -= 1;
}
string memory did = addrToDID[account];
bytes32 pHash = keccak256(bytes(did));
delete dateAuthenticated[account];
delete addrToDID[account];
delete didHashToAddress[pHash];
emit WhitelistedRemoved(account);
}
/* @dev Returns true if given address has been added to the blacklist
* @param account the address to check
* @return a bool indicating weather the address is present in the blacklist
*/
function isBlacklisted(address account) public view returns (bool) {
return blacklist.has(account);
}
/* @dev Function to see if given address is a contract
* @return true if address is a contract
*/
function isContract(address _addr) internal view returns (bool) {
uint256 length;
assembly {
length := extcodesize(_addr)
}
return length > 0;
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"event","name":"BlacklistAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BlacklistRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ContractAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ContractRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"IdentityAdminAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"IdentityAdminRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PauserAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PauserRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"WhitelistedAdded","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"WhitelistedRemoved","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addContract","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addIdentityAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addPauser","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addWhitelistedWithDID","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"string","name":"did","internalType":"string"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"","internalType":"string"}],"name":"addrToDID","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"authenticate","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"authenticationPeriod","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"dateAdded","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"dateAuthenticated","inputs":[{"type":"address","name":"","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"didHashToAddress","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isDAOContract","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isIdentityAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPauser","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isRegistered","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isRegistered","inputs":[{"type":"address","name":"scheme","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastAuthenticated","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"pause","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeBlacklisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeContract","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"removeIdentityAdmin","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeWhitelisted","inputs":[{"type":"address","name":"account","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceIdentityAdmin","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renouncePauser","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceWhitelisted","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAuthenticationPeriod","inputs":[{"type":"uint256","name":"period","internalType":"uint256"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setAvatar","inputs":[{"type":"address","name":"_avatar","internalType":"contract Avatar"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"unpause","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"whitelistedContracts","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"whitelistedCount","inputs":[],"constant":true}]
            

Contract Byte Code

0x608060405234801561001057600080fd5b50600436106102325760003560e01c80636ef8d66d11610130578063c3c5a547116100b8578063e5ecaf591161007c578063e5ecaf59146106d7578063f2fde38b146106fd578063f7d7f9cc14610723578063fe575a8714610749578063fff930d41461076f57610232565b8063c3c5a54714610637578063c6a276c21461065d578063c73cc4ae14610683578063d6cd9473146106a9578063e1e360ba146106b157610232565b80638da5cb5b116100ff5780638da5cb5b146105f15780638f32d59b146105f9578063b2a1de2214610601578063b30f7e7f14610609578063c375c2ef1461061157610232565b80636ef8d66d146105b3578063715018a6146105bb57806382dc1ec4146105c35780638456cb59146105e957610232565b80632bc298ac116101be57806346fbf68e1161018257806346fbf68e1461048b57806354f9f7a3146104b15780635c975abb1461054c5780635f539d691461055457806367c759371461057a57610232565b80632bc298ac146103f75780632ef1afc91461042f57806331b376e2146104555780633af32abf1461045d5780633f4ba83a1461048357610232565b8063188efc1611610205578063188efc16146102b35780631b027099146102d9578063223668441461038f578063291d9549146103ab5780632b32e46c146103d157610232565b8063086cfca81461023757806308e0d29d1461025f5780630f10a8b81461028557806310154bad1461028d575b600080fd5b61025d6004803603602081101561024d57600080fd5b50356001600160a01b031661078c565b005b61025d6004803603602081101561027557600080fd5b50356001600160a01b0316610847565b61025d610908565b61025d600480360360208110156102a357600080fd5b50356001600160a01b0316610913565b61025d600480360360208110156102c957600080fd5b50356001600160a01b03166109c4565b61025d600480360360408110156102ef57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561031a57600080fd5b82018360208201111561032c57600080fd5b8035906020019184600183028401116401000000008311171561034e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ab1945050505050565b610397610b64565b604080519115158252519081900360200190f35b61025d600480360360208110156103c157600080fd5b50356001600160a01b0316610b75565b610397600480360360208110156103e757600080fd5b50356001600160a01b0316610c23565b61041d6004803603602081101561040d57600080fd5b50356001600160a01b0316610c48565b60408051918252519081900360200190f35b61041d6004803603602081101561044557600080fd5b50356001600160a01b0316610c5a565b61041d610c6c565b6103976004803603602081101561047357600080fd5b50356001600160a01b0316610c72565b61025d610cd2565b610397600480360360208110156104a157600080fd5b50356001600160a01b0316610d32565b6104d7600480360360208110156104c757600080fd5b50356001600160a01b0316610d4b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156105115781810151838201526020016104f9565b50505050905090810190601f16801561053e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610397610de6565b61025d6004803603602081101561056a57600080fd5b50356001600160a01b0316610def565b6105976004803603602081101561059057600080fd5b5035610f3f565b604080516001600160a01b039092168252519081900360200190f35b61025d610f5a565b61025d610f63565b61025d600480360360208110156105d957600080fd5b50356001600160a01b0316610fbe565b61025d610fd9565b61059761103d565b61039761104c565b61041d61105d565b61041d611063565b61025d6004803603602081101561062757600080fd5b50356001600160a01b0316611069565b6103976004803603602081101561064d57600080fd5b50356001600160a01b031661115f565b61025d6004803603602081101561067357600080fd5b50356001600160a01b0316611243565b6103976004803603602081101561069957600080fd5b50356001600160a01b0316611330565b61025d611343565b61041d600480360360208110156106c757600080fd5b50356001600160a01b031661135c565b610397600480360360208110156106ed57600080fd5b50356001600160a01b0316611377565b61025d6004803603602081101561071357600080fd5b50356001600160a01b031661138a565b6103976004803603602081101561073957600080fd5b50356001600160a01b03166113a4565b6103976004803603602081101561075f57600080fd5b50356001600160a01b03166113c0565b61025d6004803603602081101561078557600080fd5b50356113d3565b61079461104c565b61079d57600080fd5b600280546001600160a01b0319166001600160a01b03838116919091179182905560408051638da5cb5b60e01b815290519290911691638da5cb5b91600480820192602092909190829003018186803b1580156107f957600080fd5b505afa15801561080d573d6000803e3d6000fd5b505050506040513d602081101561082357600080fd5b5051600380546001600160a01b0319166001600160a01b0390921691909117905550565b61084f610b64565b61088e576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b61089733611377565b6108dc576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff16156108ec57600080fd5b6001600160a01b03166000908152600c60205260409020429055565b610911336113f9565b565b61091b610b64565b61095a576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b61096333611377565b6109a8576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff16156109b857600080fd5b6109c181611441565b50565b6109cc610b64565b610a0b576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b610a1433611377565b610a59576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff1615610a6957600080fd5b610a7a60068263ffffffff6114d316565b6040516001600160a01b038216907f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b87896790600090a250565b610ab9610b64565b610af8576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b610b0133611377565b610b46576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff1615610b5657600080fd5b610b60828261151f565b5050565b6000610b6f3061115f565b90505b90565b610b7d610b64565b610bbc576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b610bc533611377565b610c0a576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff1615610c1a57600080fd5b6109c1816115ed565b6000610c2d61104c565b610c3657600080fd5b610c3f8261176c565b5060015b919050565b600d6020526000908152604090205481565b600c6020526000908152604090205481565b600b5481565b6001600160a01b0381166000908152600c602052604081205481906201518090610ca390429063ffffffff6117b416565b81610caa57fe5b049050600b548111158015610ccb5750610ccb60078463ffffffff6117c916565b9392505050565b610cdb33610d32565b610ce457600080fd5b60055460ff16610cf357600080fd5b6005805460ff191690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b6000610d4560048363ffffffff6117c916565b92915050565b600e6020908152600091825260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015610dde5780601f10610db357610100808354040283529160200191610dde565b820191906000526020600020905b815481529060010190602001808311610dc157829003601f168201915b505050505081565b60055460ff1690565b610df7610b64565b610e36576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b610e3f33611377565b610e84576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff1615610e9457600080fd5b610e9d816117fe565b610eee576040805162461bcd60e51b815260206004820152601f60248201527f476976656e2061646472657373206973206e6f74206120636f6e747261637400604482015290519081900360640190fd5b610eff60088263ffffffff6114d316565b610f0881611441565b6040516001600160a01b038216907f89c66952b48f3e96bf1d8ba1b63189520fd988a6979b8b740bd5c5d8dc53e20590600090a250565b600f602052600090815260409020546001600160a01b031681565b61091133611804565b610f6b61104c565b610f7457600080fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b610fc733610d32565b610fd057600080fd5b6109c18161184c565b610fe233610d32565b610feb57600080fd5b60055460ff1615610ffb57600080fd5b6005805460ff191660011790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b60095481565b600a5481565b611071610b64565b6110b0576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b6110b933611377565b6110fe576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff161561110e57600080fd5b61111f60088263ffffffff61189416565b611128816115ed565b6040516001600160a01b038216907f8d30d41865a0b811b9545d879520d2dde9f4cc49e4241f486ad9752bc904b56590600090a250565b6002546000906001600160a01b03166111b3576040805162461bcd60e51b8152602060048201526011602482015270105d985d185c881a5cc81b9bdd081cd95d607a1b604482015290519081900360640190fd5b60035460025460408051639be2faed60e01b81526001600160a01b038681166004830152928316602482015290519190921691639be2faed916044808301926020929190829003018186803b15801561120b57600080fd5b505afa15801561121f573d6000803e3d6000fd5b505050506040513d602081101561123557600080fd5b5051610c3f57506000610c43565b61124b610b64565b61128a576040805162461bcd60e51b81526020600482015260186024820152600080516020611a23833981519152604482015290519081900360640190fd5b61129333611377565b6112d8576040805162461bcd60e51b81526020600482015260116024820152703737ba1024b232b73a34ba3ca0b236b4b760791b604482015290519081900360640190fd5b60055460ff16156112e857600080fd5b6112f960068263ffffffff61189416565b6040516001600160a01b038216907f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde890600090a250565b6000610d4560088363ffffffff6117c916565b60055460ff161561135357600080fd5b610911336115ed565b6001600160a01b03166000908152600c602052604090205490565b6000610d4560018363ffffffff6117c916565b61139261104c565b61139b57600080fd5b6109c1816118dc565b60006113ae61104c565b6113b757600080fd5b610c3f826113f9565b6000610d4560068363ffffffff6117c916565b6113db61104c565b6113e457600080fd5b60055460ff16156113f457600080fd5b600b55565b61140a60018263ffffffff61189416565b6040516001600160a01b038216907f869f6a5b4767d57c58d57f1ddf82e1516487f35944a19bf30a4a21bd35f6ad0590600090a250565b61145260078263ffffffff6114d316565b6009805460010190556001600160a01b0381166000908152600d602090815260408083204290819055600c9092529091205561148d816117fe565b1561149c57600a805460010190555b6040516001600160a01b038216907fee1504a83b6d4a361f4c1dc78ab59bfa30d6a3b6612c403e86bb01ef2984295f90600090a250565b6001600160a01b0381166114e657600080fd5b6114f082826117c9565b156114fa57600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b80516020808301919091206000818152600f9092526040909120546001600160a01b03161561158e576040805162461bcd60e51b815260206004820152601660248201527511125108185b1c9958591e481c9959da5cdd195c995960521b604482015290519081900360640190fd5b6001600160a01b0383166000908152600e6020908152604090912083516115b79285019061194a565b506000818152600f6020526040902080546001600160a01b0319166001600160a01b0385161790556115e883611441565b505050565b6115fe60078263ffffffff61189416565b600980546000190190556001600160a01b0381166000908152600c602052604081205561162a816117fe565b1561163a57600a80546000190190555b6001600160a01b0381166000908152600e602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156116d95780601f106116ae576101008083540402835291602001916116d9565b820191906000526020600020905b8154815290600101906020018083116116bc57829003601f168201915b505083516020808601919091206001600160a01b0388166000908152600c83526040808220829055600e9093529182209596509461171b9450925090506119c8565b6000818152600f602052604080822080546001600160a01b0319169055516001600160a01b038516917f270d9b30cf5b0793bbfd54c9d5b94aeb49462b8148399000265144a8722da6b691a2505050565b61177d60018263ffffffff6114d316565b6040516001600160a01b038216907f3505858ac30c166c603cb64de4a970615e36a4ed8fea37ba93bc5f11a38dd30990600090a250565b6000828211156117c357600080fd5b50900390565b60006001600160a01b0382166117de57600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b3b151590565b61181560048263ffffffff61189416565b6040516001600160a01b038216907fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e90600090a250565b61185d60048263ffffffff6114d316565b6040516001600160a01b038216907f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f890600090a250565b6001600160a01b0381166118a757600080fd5b6118b182826117c9565b6118ba57600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b6001600160a01b0381166118ef57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061198b57805160ff19168380011785556119b8565b828001600101855582156119b8579182015b828111156119b857825182559160200191906001019061199d565b506119c4929150611a08565b5090565b50805460018160011615610100020316600290046000825580601f106119ee57506109c1565b601f0160209004906000526020600020908101906109c191905b610b7291905b808211156119c45760008155600101611a0e56fe536368656d65206973206e6f7420726567697374657265640000000000000000a265627a7a72315820b9ee462a304f3e230d9f0f2ef9572afa917d30c3fc673b5b3dfcec4898572fd064736f6c63430005100032