Contract 0x67e20dd951ef09ae6aebd7c39903f89b2abd4c79

Contract Overview

Balance:
0 Ether
TxHash Block Age From To Value [TxFee]
0x2441b9df221bea16abcb07bde37e02a394417ec3c6f5dcebb4785f4d13cf117940343716 days 17 hrs ago0xf9196f9f176fd2ef9243e8960817d5fbe63d79aa IN  0x67e20dd951ef09ae6aebd7c39903f89b2abd4c790 Ether0.000091014
0x011f1a5e378f16e63e359cfd24a6999db3d1501c0d2ece25349d06dfefdd8d3a374703356 days 15 hrs ago0xf9196f9f176fd2ef9243e8960817d5fbe63d79aa IN  0x67e20dd951ef09ae6aebd7c39903f89b2abd4c790 Ether0.000045507
0xeab17acdb4560aed140c75cb4c5f312d123b21b32e12506eed4437508ddd6a76374697956 days 15 hrs ago0xf9196f9f176fd2ef9243e8960817d5fbe63d79aa IN  Contract Creation0 Ether0.000584788
[ Download CSV Export 

Latest 2 internal transactions Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0x74ed8975866da07f725ad90a409b26d4678c80a43d87f2cced6932ca8e5bea7f374711156 days 14 hrs ago0x67e20dd951ef09ae6aebd7c39903f89b2abd4c790xa9d099365ae183aad1757d3c44cf428a1182d3b90 Ether
0x74ed8975866da07f725ad90a409b26d4678c80a43d87f2cced6932ca8e5bea7f374711156 days 14 hrs ago0x0827696c1a5ecea8a7f5bad02df93aad6516f41d0x67e20dd951ef09ae6aebd7c39903f89b2abd4c790 Ether
[ Download CSV Export 

Contract Source Code Verified (Exact Match)

Contract Name:
XcertCreateProxy

Compiler Version
v0.5.1+commit.c8a2cb62

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

pragma solidity 0.5.1;


/**
 * @dev Math operations with safety checks that throw on error. This contract is based on the 
 * source code at: 
 * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol.
 */
library SafeMath
{

  /**
   * @dev Error constants.
   */
  string constant OVERFLOW = "008001";
  string constant SUBTRAHEND_GREATER_THEN_MINUEND = "008002";
  string constant DIVISION_BY_ZERO = "008003";

  /**
   * @dev Multiplies two numbers, reverts on overflow.
   * @param _factor1 Factor number.
   * @param _factor2 Factor number.
   * @return The product of the two factors.
   */
  function mul(
    uint256 _factor1,
    uint256 _factor2
  )
    internal
    pure
    returns (uint256 product)
  {
    // 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 (_factor1 == 0)
    {
      return 0;
    }

    product = _factor1 * _factor2;
    require(product / _factor1 == _factor2, OVERFLOW);
  }

  /**
   * @dev Integer division of two numbers, truncating the quotient, reverts on division by zero.
   * @param _dividend Dividend number.
   * @param _divisor Divisor number.
   * @return The quotient.
   */
  function div(
    uint256 _dividend,
    uint256 _divisor
  )
    internal
    pure
    returns (uint256 quotient)
  {
    // Solidity automatically asserts when dividing by 0, using all gas.
    require(_divisor > 0, DIVISION_BY_ZERO);
    quotient = _dividend / _divisor;
    // assert(_dividend == _divisor * quotient + _dividend % _divisor); // There is no case in which this doesn't hold.
  }

  /**
   * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
   * @param _minuend Minuend number.
   * @param _subtrahend Subtrahend number.
   * @return Difference.
   */
  function sub(
    uint256 _minuend,
    uint256 _subtrahend
  )
    internal
    pure
    returns (uint256 difference)
  {
    require(_subtrahend <= _minuend, SUBTRAHEND_GREATER_THEN_MINUEND);
    difference = _minuend - _subtrahend;
  }

  /**
   * @dev Adds two numbers, reverts on overflow.
   * @param _addend1 Number.
   * @param _addend2 Number.
   * @return Sum.
   */
  function add(
    uint256 _addend1,
    uint256 _addend2
  )
    internal
    pure
    returns (uint256 sum)
  {
    sum = _addend1 + _addend2;
    require(sum >= _addend1, OVERFLOW);
  }

  /**
    * @dev Divides two numbers and returns the remainder (unsigned integer modulo), reverts when
    * dividing by zero.
    * @param _dividend Number.
    * @param _divisor Number.
    * @return Remainder.
    */
  function mod(
    uint256 _dividend,
    uint256 _divisor
  )
    internal
    pure
    returns (uint256 remainder) 
  {
    require(_divisor != 0, DIVISION_BY_ZERO);
    remainder = _dividend % _divisor;
  }

}

/**
 * @title Contract for setting abilities.
 * @dev For optimization purposes the abilities are represented as a bitfield. Maximum number of
 * abilities is therefore 256. This is an example(for simplicity is made for max 8 abilities) of how
 * this works. 
 * 00000001 Ability A - number representation 1
 * 00000010 Ability B - number representation 2
 * 00000100 Ability C - number representation 4
 * 00001000 Ability D - number representation 8
 * 00010000 Ability E - number representation 16
 * etc ... 
 * To grant abilities B and C, we would need a bitfield of 00000110 which is represented by number
 * 6, in other words, the sum of abilities B and C. The same concept works for revoking abilities
 * and checking if someone has multiple abilities.
 */
contract Abilitable
{
  using SafeMath for uint;

  /**
   * @dev Error constants.
   */
  string constant NOT_AUTHORIZED = "017001";
  string constant ONE_ZERO_ABILITY_HAS_TO_EXIST = "017002";
  string constant INVALID_INPUT = "017003";

  /**
   * @dev Ability 1 is a reserved ability. It is an ability to grant or revoke abilities. 
   * There can be minimum of 1 address with ability 1.
   * Other abilities are determined by implementing contract.
   */
  uint8 constant ABILITY_TO_MANAGE_ABILITIES = 1;

  /**
   * @dev Maps address to ability ids.
   */
  mapping(address => uint256) public addressToAbility;

  /**
   * @dev Count of zero ability addresses.
   */
  uint256 private zeroAbilityCount;

  /**
   * @dev Emits when an address is granted an ability.
   * @param _target Address to which we are granting abilities.
   * @param _abilities Number representing bitfield of abilities we are granting.
   */
  event GrantAbilities(
    address indexed _target,
    uint256 indexed _abilities
  );

  /**
   * @dev Emits when an address gets an ability revoked.
   * @param _target Address of which we are revoking an ability.
   * @param _abilities Number representing bitfield of abilities we are revoking.
   */
  event RevokeAbilities(
    address indexed _target,
    uint256 indexed _abilities
  );

  /**
   * @dev Guarantees that msg.sender has certain abilities.
   */
  modifier hasAbilities(
    uint256 _abilities
  ) 
  {
    require(
      _abilities > 0 && (addressToAbility[msg.sender] & _abilities) == _abilities,
      NOT_AUTHORIZED
    );
    _;
  }

  /**
   * @dev Contract constructor.
   * Sets ABILITY_TO_MANAGE_ABILITIES ability to the sender account.
   */
  constructor()
    public
  {
    addressToAbility[msg.sender] = ABILITY_TO_MANAGE_ABILITIES;
    zeroAbilityCount = 1;
    emit GrantAbilities(msg.sender, ABILITY_TO_MANAGE_ABILITIES);
  }

  /**
   * @dev Grants specific abilities to specified address.
   * @param _target Address to grant abilities to.
   * @param _abilities Number representing bitfield of abilities we are granting.
   */
  function grantAbilities(
    address _target,
    uint256 _abilities
  )
    external
    hasAbilities(ABILITY_TO_MANAGE_ABILITIES)
  {
    addressToAbility[_target] |= _abilities;

    if((_abilities & ABILITY_TO_MANAGE_ABILITIES) == ABILITY_TO_MANAGE_ABILITIES)
    {
      zeroAbilityCount = zeroAbilityCount.add(1);
    }
    emit GrantAbilities(_target, _abilities);
  }

  /**
   * @dev Assigns specific abilities to specified address.
   * @param _target Address of which we revoke abilites.
   * @param _abilities Number representing bitfield of abilities we are revoking.
   */
  function revokeAbilities(
    address _target,
    uint256 _abilities
  )
    external
    hasAbilities(ABILITY_TO_MANAGE_ABILITIES)
  {
    addressToAbility[_target] &= ~_abilities;
    if((_abilities & 1) == 1)
    {
      require(zeroAbilityCount > 1, ONE_ZERO_ABILITY_HAS_TO_EXIST);
      zeroAbilityCount--;
    }
    emit RevokeAbilities(_target, _abilities);
  }

  /**
   * @dev Check if an address has a specific ability. Throws if checking for 0.
   * @param _target Address for which we want to check if it has a specific abilities.
   * @param _abilities Number representing bitfield of abilities we are checking.
   */
  function isAble(
    address _target,
    uint256 _abilities
  )
    external
    view
    returns (bool)
  {
    require(_abilities > 0, INVALID_INPUT);
    return (addressToAbility[_target] & _abilities) == _abilities;
  }
  
}

/**
 * @dev Xcert interface.
 */
interface Xcert // is ERC721 metadata enumerable
{

  /**
   * @dev Creates a new Xcert.
   * @param _to The address that will own the created Xcert.
   * @param _id The Xcert to be created by the msg.sender.
   * @param _imprint Cryptographic asset imprint.
   */
  function create(
    address _to,
    uint256 _id,
    bytes32 _imprint
  )
    external;

  /**
   * @dev Change URI base.
   * @param _uriBase New uriBase.
   */
  function setUriBase(
    string calldata _uriBase
  )
    external;

  /**
   * @dev Returns a bytes4 of keccak256 of json schema representing 0xcert protocol convention.
   * @return Schema id.
   */
  function schemaId()
    external
    view
    returns (bytes32 _schemaId);

  /**
   * @dev Returns imprint for Xcert.
   * @param _tokenId Id of the Xcert.
   * @return Token imprint.
   */
  function tokenImprint(
    uint256 _tokenId
  )
    external
    view
    returns(bytes32 imprint);

}

/**
 * @title XcertCreateProxy - creates a token on behalf of contracts that have been approved via
 * decentralized governance.
 */
contract XcertCreateProxy is 
  Abilitable 
{

  /**
   * @dev List of abilities:
   * 2 - Ability to execute create. 
   */
  uint8 constant ABILITY_TO_EXECUTE = 2;

  /**
   * @dev Creates a new NFT.
   * @param _xcert Address of the Xcert contract on which the creation will be perfomed.
   * @param _to The address that will own the created NFT.
   * @param _id The NFT to be created by the msg.sender.
   * @param _imprint Cryptographic asset imprint.
   */
  function create(
    address _xcert,
    address _to,
    uint256 _id,
    bytes32 _imprint
  )
    external
    hasAbilities(ABILITY_TO_EXECUTE)
  {
    Xcert(_xcert).create(_to, _id, _imprint);
  }
  
}

Contract ABI

[{"constant":false,"inputs":[{"name":"_target","type":"address"},{"name":"_abilities","type":"uint256"}],"name":"grantAbilities","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressToAbility","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_xcert","type":"address"},{"name":"_to","type":"address"},{"name":"_id","type":"uint256"},{"name":"_imprint","type":"bytes32"}],"name":"create","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_target","type":"address"},{"name":"_abilities","type":"uint256"}],"name":"isAble","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"},{"name":"_abilities","type":"uint256"}],"name":"revokeAbilities","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_target","type":"address"},{"indexed":true,"name":"_abilities","type":"uint256"}],"name":"GrantAbilities","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_target","type":"address"},{"indexed":true,"name":"_abilities","type":"uint256"}],"name":"RevokeAbilities","type":"event"}]

Contract Creation Code

6080604081815233600081815260208190529182206001908190558080559290917fc4adfc5f00262a1ab9b2241c7e98408a91e58dc5777d786164bba34a7652f62f91a361074f806100526000396000f3fe608060405260043610610066577c010000000000000000000000000000000000000000000000000000000060003504630ab319e8811461006b57806345a32c86146100a657806346009b0e146100eb578063ba00a33014610134578063f394b6df14610181575b600080fd5b34801561007757600080fd5b506100a46004803603604081101561008e57600080fd5b50600160a060020a0381351690602001356101ba565b005b3480156100b257600080fd5b506100d9600480360360208110156100c957600080fd5b5035600160a060020a031661030e565b60408051918252519081900360200190f35b3480156100f757600080fd5b506100a46004803603608081101561010e57600080fd5b50600160a060020a03813581169160208101359091169060408101359060600135610320565b34801561014057600080fd5b5061016d6004803603604081101561015757600080fd5b50600160a060020a03813516906020013561044e565b604080519115158252519081900360200190f35b34801561018d57600080fd5b506100a4600480360360408110156101a457600080fd5b50600160a060020a0381351690602001356104fa565b6001336000908152602081905260409020548116811460408051808201909152600681527f303137303031000000000000000000000000000000000000000000000000000060208201529015156102925760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561025757818101518382015260200161023f565b50505050905090810190601f1680156102845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600160a060020a0383166000908152602081905260409020805483179055600180831614156102d357600180546102cf9163ffffffff61069116565b6001555b6040518290600160a060020a038516907fc4adfc5f00262a1ab9b2241c7e98408a91e58dc5777d786164bba34a7652f62f90600090a3505050565b60006020819052908152604090205481565b6002336000908152602081905260409020548116811460408051808201909152600681527f303137303031000000000000000000000000000000000000000000000000000060208201529015156103bc5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561025757818101518382015260200161023f565b50604080517fb0e329e4000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018690526044820185905291519187169163b0e329e49160648082019260009290919082900301818387803b15801561042f57600080fd5b505af1158015610443573d6000803e3d6000fd5b505050505050505050565b60408051808201909152600681527f303137303033000000000000000000000000000000000000000000000000000060208201526000908183116104d75760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561025757818101518382015260200161023f565b5050600160a060020a039190911660009081526020819052604090205481161490565b6001336000908152602081905260409020548116811460408051808201909152600681527f303137303031000000000000000000000000000000000000000000000000000060208201529015156105965760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561025757818101518382015260200161023f565b50600160a060020a03831660009081526020819052604090208054831916905560018083161415610656576001805460408051808201909152600681527f30313730303200000000000000000000000000000000000000000000000000006020820152911061064a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561025757818101518382015260200161023f565b50600180546000190190555b6040518290600160a060020a038516907fbb71944f65b9a48cc7d835179fb5e874f29b60aa0195785fb54968d8dddef08a90600090a3505050565b60408051808201909152600681527f30303830303100000000000000000000000000000000000000000000000000006020820152828201908382101561071c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561025757818101518382015260200161023f565b509291505056fea165627a7a72305820e380c93c12db8549b495b68fe3a83c560245866fa5010a883e265dfa04f50db70029

Swarm Source

bzzr://e380c93c12db8549b495b68fe3a83c560245866fa5010a883e265dfa04f50db7
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward