ETH Price: $3,374.92 (+4.43%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DefaultExecutor

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 12 : DefaultExecutor.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {DefaultExecutorWithTimelock} from './DefaultExecutorWithTimelock.sol';
import {DefaultProposalValidator} from './DefaultProposalValidator.sol';

/**
 * @title Time Locked, Validator, Executor Contract
 * @dev Contract
 * - Validate Proposal creations/ cancellation
 * - Validate Vote Quorum and Vote success on proposal
 * - Queue, Execute, Cancel, successful proposals' transactions.
 **/
contract DefaultExecutor is DefaultExecutorWithTimelock, DefaultProposalValidator {
  constructor(
    address admin,
    uint256 delay,
    uint256 gracePeriod,
    uint256 minimumDelay,
    uint256 maximumDelay,
    uint256 minVoteDuration,
    uint256 maxVotingOptions,
    uint256 voteDifferential,
    uint256 minimumQuorum
  )
    DefaultExecutorWithTimelock(admin, delay, gracePeriod, minimumDelay, maximumDelay)
    DefaultProposalValidator(minVoteDuration, maxVotingOptions, voteDifferential, minimumQuorum)
  {}
}

File 2 of 12 : DefaultExecutorWithTimelock.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IExecutorWithTimelock} from '../../interfaces/governance/IExecutorWithTimelock.sol';
import {IKyberGovernance} from '../../interfaces/governance/IKyberGovernance.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';

/**
 * @title Time Locked Executor Contract, inherited by Aave Governance Executors
 * @dev Contract that can queue, execute, cancel transactions voted by Governance
 * Queued transactions can be executed after a delay and until
 * Grace period is not over.
 * @author Aave
 **/
contract DefaultExecutorWithTimelock is IExecutorWithTimelock {
  using SafeMath for uint256;

  uint256 public immutable override GRACE_PERIOD;
  uint256 public immutable override MINIMUM_DELAY;
  uint256 public immutable override MAXIMUM_DELAY;

  address private _admin;
  address private _pendingAdmin;
  uint256 private _delay;

  mapping(bytes32 => bool) private _queuedTransactions;

  /**
   * @dev Constructor
   * @param admin admin address, that can call the main functions, (Governance)
   * @param delay minimum time between queueing and execution of proposal
   * @param gracePeriod time after `delay` while a proposal can be executed
   * @param minimumDelay lower threshold of `delay`, in seconds
   * @param maximumDelay upper threhold of `delay`, in seconds
   **/
  constructor(
    address admin,
    uint256 delay,
    uint256 gracePeriod,
    uint256 minimumDelay,
    uint256 maximumDelay
  ) {
    require(delay >= minimumDelay, 'DELAY_SHORTER_THAN_MINIMUM');
    require(delay <= maximumDelay, 'DELAY_LONGER_THAN_MAXIMUM');
    _delay = delay;
    _admin = admin;

    GRACE_PERIOD = gracePeriod;
    MINIMUM_DELAY = minimumDelay;
    MAXIMUM_DELAY = maximumDelay;

    emit NewDelay(delay);
    emit NewAdmin(admin);
  }

  modifier onlyAdmin() {
    require(msg.sender == _admin, 'ONLY_BY_ADMIN');
    _;
  }

  modifier onlyTimelock() {
    require(msg.sender == address(this), 'ONLY_BY_THIS_TIMELOCK');
    _;
  }

  modifier onlyPendingAdmin() {
    require(msg.sender == _pendingAdmin, 'ONLY_BY_PENDING_ADMIN');
    _;
  }

  /**
   * @dev Set the delay
   * @param delay delay between queue and execution of proposal
   **/
  function setDelay(uint256 delay) public onlyTimelock {
    _validateDelay(delay);
    _delay = delay;

    emit NewDelay(delay);
  }

  /**
   * @dev Function enabling pending admin to become admin
   **/
  function acceptAdmin() public onlyPendingAdmin {
    _admin = msg.sender;
    _pendingAdmin = address(0);

    emit NewAdmin(msg.sender);
  }

  /**
   * @dev Setting a new pending admin (that can then become admin)
   * Can only be called by this executor (i.e via proposal)
   * @param newPendingAdmin address of the new admin
   **/
  function setPendingAdmin(address newPendingAdmin) public onlyTimelock {
    _pendingAdmin = newPendingAdmin;

    emit NewPendingAdmin(newPendingAdmin);
  }

  /**
   * @dev Function, called by Governance, that queue a transaction, returns action hash
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   * @return the action Hash
   **/
  function queueTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) public override onlyAdmin returns (bytes32) {
    require(executionTime >= block.timestamp.add(_delay), 'EXECUTION_TIME_UNDERESTIMATED');

    bytes32 actionHash = keccak256(
      abi.encode(target, value, signature, data, executionTime, withDelegatecall)
    );
    _queuedTransactions[actionHash] = true;

    emit QueuedAction(actionHash, target, value, signature, data, executionTime, withDelegatecall);
    return actionHash;
  }

  /**
   * @dev Function, called by Governance, that cancels a transaction, returns action hash
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   * @return the action Hash of the canceled tx
   **/
  function cancelTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) public override onlyAdmin returns (bytes32) {
    bytes32 actionHash = keccak256(
      abi.encode(target, value, signature, data, executionTime, withDelegatecall)
    );
    _queuedTransactions[actionHash] = false;

    emit CancelledAction(
      actionHash,
      target,
      value,
      signature,
      data,
      executionTime,
      withDelegatecall
    );
    return actionHash;
  }

  /**
   * @dev Function, called by Governance, that cancels a transaction, returns the callData executed
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   * @return the callData executed as memory bytes
   **/
  function executeTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) public override payable onlyAdmin returns (bytes memory) {
    bytes32 actionHash = keccak256(
      abi.encode(target, value, signature, data, executionTime, withDelegatecall)
    );
    require(_queuedTransactions[actionHash], 'ACTION_NOT_QUEUED');
    require(block.timestamp >= executionTime, 'TIMELOCK_NOT_FINISHED');
    require(block.timestamp <= executionTime.add(GRACE_PERIOD), 'GRACE_PERIOD_FINISHED');

    _queuedTransactions[actionHash] = false;

    bytes memory callData;

    if (bytes(signature).length == 0) {
      callData = data;
    } else {
      callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
    }

    bool success;
    bytes memory resultData;
    if (withDelegatecall) {
      require(msg.value >= value, 'NOT_ENOUGH_MSG_VALUE');
      // solium-disable-next-line security/no-call-value
      (success, resultData) = target.delegatecall(callData);
    } else {
      // solium-disable-next-line security/no-call-value
      (success, resultData) = target.call{value: value}(callData);
    }

    require(success, 'FAILED_ACTION_EXECUTION');

    emit ExecutedAction(
      actionHash,
      target,
      value,
      signature,
      data,
      executionTime,
      withDelegatecall,
      resultData
    );

    return resultData;
  }

  /**
   * @dev Getter of the current admin address (should be governance)
   * @return The address of the current admin
   **/
  function getAdmin() external override view returns (address) {
    return _admin;
  }

  /**
   * @dev Getter of the current pending admin address
   * @return The address of the pending admin
   **/
  function getPendingAdmin() external override view returns (address) {
    return _pendingAdmin;
  }

  /**
   * @dev Getter of the delay between queuing and execution
   * @return The delay in seconds
   **/
  function getDelay() external override view returns (uint256) {
    return _delay;
  }

  /**
   * @dev Returns whether an action (via actionHash) is queued
   * @param actionHash hash of the action to be checked
   * keccak256(abi.encode(target, value, signature, data, executionTime, withDelegatecall))
   * @return true if underlying action of actionHash is queued
   **/
  function isActionQueued(bytes32 actionHash) external override view returns (bool) {
    return _queuedTransactions[actionHash];
  }

  /**
   * @dev Checks whether a proposal is over its grace period
   * @param governance Governance contract
   * @param proposalId Id of the proposal against which to test
   * @return true of proposal is over grace period
   **/
  function isProposalOverGracePeriod(IKyberGovernance governance, uint256 proposalId)
    external
    override
    view
    returns (bool)
  {
    IKyberGovernance.ProposalWithoutVote memory proposal = governance.getProposalById(proposalId);

    return (block.timestamp > proposal.executionTime.add(GRACE_PERIOD));
  }

  function _validateDelay(uint256 delay) internal view {
    require(delay >= MINIMUM_DELAY, 'DELAY_SHORTER_THAN_MINIMUM');
    require(delay <= MAXIMUM_DELAY, 'DELAY_LONGER_THAN_MAXIMUM');
  }

  receive() external payable {}
}

File 3 of 12 : DefaultProposalValidator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IKyberGovernance} from '../../interfaces/governance/IKyberGovernance.sol';
import {IVotingPowerStrategy} from '../../interfaces/governance/IVotingPowerStrategy.sol';
import {IProposalValidator} from '../../interfaces/governance/IProposalValidator.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {Utils} from '@kyber.network/utils-sc/contracts/Utils.sol';

/**
 * @title Proposal Validator Contract, inherited by Kyber Executors
 * @dev Validates/Invalidates propositions state modifications
 * Proposition Power functions: Validates proposition creations/ cancellation
 * Voting Power functions: Validates success of propositions.
 * @author Aave
 **/
contract DefaultProposalValidator is IProposalValidator, Utils {
  using SafeMath for uint256;

  uint256 public immutable override MIN_VOTING_DURATION;
  uint256 public immutable override MAX_VOTING_OPTIONS;
  uint256 public immutable override VOTE_DIFFERENTIAL;
  uint256 public immutable override MINIMUM_QUORUM;

  uint256 public constant YES_INDEX = 0;
  uint256 public constant NO_INDEX = 1;

  /**
   * @dev Constructor
   * @param minVotingDuration minimum duration in seconds of the voting period
   * @param maxVotingOptions maximum no. of vote options possible for a generic proposal
   * @param voteDifferential percentage of supply that `for` votes need to be over `against`
   *   in order for the proposal to pass
   * - In BPS
   * @param minimumQuorum minimum percentage of the supply in FOR-voting-power need for a proposal to pass
   * - In BPS
   **/
  constructor(
    uint256 minVotingDuration,
    uint256 maxVotingOptions,
    uint256 voteDifferential,
    uint256 minimumQuorum
  ) {
    MIN_VOTING_DURATION = minVotingDuration;
    MAX_VOTING_OPTIONS = maxVotingOptions;
    VOTE_DIFFERENTIAL = voteDifferential;
    MINIMUM_QUORUM = minimumQuorum;
  }

  /**
   * @dev Called to validate the cancellation of a proposal
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the generic proposal
   * @param user entity initiating the cancellation
   * @return boolean, true if can be cancelled
   **/
  function validateProposalCancellation(
    IKyberGovernance governance,
    uint256 proposalId,
    address user
  ) external override pure returns (bool) {
    // silence compilation warnings
    governance;
    proposalId;
    user;
    return false;
  }

  /**
   * @dev Called to validate a binary proposal
   * @notice creator of proposals must be the daoOperator
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param creator address of the creator
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param daoOperator address of daoOperator
   * @return boolean, true if can be created
   **/
  function validateBinaryProposalCreation(
    IVotingPowerStrategy strategy,
    address creator,
    uint256 startTime,
    uint256 endTime,
    address daoOperator
  ) external override view returns (bool) {
    // check authorization
    if (creator != daoOperator) return false;
    // check vote duration
    if (endTime.sub(startTime) < MIN_VOTING_DURATION) return false;

    return strategy.validateProposalCreation(startTime, endTime);
  }

  /**
   * @dev Called to validate a generic proposal
   * @notice creator of proposals must be the daoOperator
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param creator address of the creator
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param options list of proposal vote options
   * @param daoOperator address of daoOperator
   * @return boolean, true if can be created
   **/
  function validateGenericProposalCreation(
    IVotingPowerStrategy strategy,
    address creator,
    uint256 startTime,
    uint256 endTime,
    string[] calldata options,
    address daoOperator
  ) external override view returns (bool) {
    // check authorization
    if (creator != daoOperator) return false;
    // check vote duration
    if (endTime.sub(startTime) < MIN_VOTING_DURATION) return false;
    // check options length
    if (options.length <= 1 || options.length > MAX_VOTING_OPTIONS) return false;

    return strategy.validateProposalCreation(startTime, endTime);
  }

  /**
   * @dev Returns whether a binary proposal passed or not
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the proposal to set
   * @return true if proposal passed
   **/
  function isBinaryProposalPassed(IKyberGovernance governance, uint256 proposalId)
    public
    override
    view
    returns (bool)
  {
    return (isQuorumValid(governance, proposalId) &&
      isVoteDifferentialValid(governance, proposalId));
  }

  /**
   * @dev Check whether a binary proposal has reached quorum
   * Here quorum is not the number of votes reached, but number of YES_VOTES
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the proposal to verify
   * @return true if minimum quorum is reached
   **/
  function isQuorumValid(IKyberGovernance governance, uint256 proposalId)
    public
    override
    view
    returns (bool)
  {
    IKyberGovernance.ProposalWithoutVote memory proposal = governance.getProposalById(proposalId);
    if (proposal.proposalType != IKyberGovernance.ProposalType.Binary) return false;
    return isMinimumQuorumReached(proposal.voteCounts[YES_INDEX], proposal.maxVotingPower);
  }

  /**
   * @dev Check whether a binary proposal has sufficient YES_VOTES
   * YES_VOTES - NO_VOTES > VOTE_DIFFERENTIAL * voting supply
   * @param governance Governance Contract
   * @param proposalId Id of the proposal to verify
   * @return true if enough YES_VOTES
   **/
  function isVoteDifferentialValid(IKyberGovernance governance, uint256 proposalId)
    public
    override
    view
    returns (bool)
  {
    IKyberGovernance.ProposalWithoutVote memory proposal = governance.getProposalById(proposalId);
    if (proposal.proposalType != IKyberGovernance.ProposalType.Binary) return false;
    return (
      proposal.voteCounts[YES_INDEX].mul(BPS).div(proposal.maxVotingPower) >
      proposal.voteCounts[NO_INDEX].mul(BPS).div(proposal.maxVotingPower).add(
      VOTE_DIFFERENTIAL
    ));
  }

  function isMinimumQuorumReached(uint256 votes, uint256 voteSupply) internal view returns (bool) {
    return votes >= voteSupply.mul(MINIMUM_QUORUM).div(BPS);
  }
}

File 4 of 12 : IExecutorWithTimelock.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IKyberGovernance} from './IKyberGovernance.sol';

interface IExecutorWithTimelock {
  /**
   * @dev emitted when a new pending admin is set
   * @param newPendingAdmin address of the new pending admin
   **/
  event NewPendingAdmin(address newPendingAdmin);

  /**
   * @dev emitted when a new admin is set
   * @param newAdmin address of the new admin
   **/
  event NewAdmin(address newAdmin);

  /**
   * @dev emitted when a new delay (between queueing and execution) is set
   * @param delay new delay
   **/
  event NewDelay(uint256 delay);

  /**
   * @dev emitted when a new (trans)action is Queued.
   * @param actionHash hash of the action
   * @param target address of the targeted contract
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   **/
  event QueuedAction(
    bytes32 actionHash,
    address indexed target,
    uint256 value,
    string signature,
    bytes data,
    uint256 executionTime,
    bool withDelegatecall
  );

  /**
   * @dev emitted when an action is Cancelled
   * @param actionHash hash of the action
   * @param target address of the targeted contract
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   **/
  event CancelledAction(
    bytes32 actionHash,
    address indexed target,
    uint256 value,
    string signature,
    bytes data,
    uint256 executionTime,
    bool withDelegatecall
  );

  /**
   * @dev emitted when an action is Cancelled
   * @param actionHash hash of the action
   * @param target address of the targeted contract
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   * @param resultData the actual callData used on the target
   **/
  event ExecutedAction(
    bytes32 actionHash,
    address indexed target,
    uint256 value,
    string signature,
    bytes data,
    uint256 executionTime,
    bool withDelegatecall,
    bytes resultData
  );

  /**
   * @dev Function, called by Governance, that queue a transaction, returns action hash
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   **/
  function queueTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) external returns (bytes32);

  /**
   * @dev Function, called by Governance, that cancels a transaction, returns the callData executed
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   **/
  function executeTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) external payable returns (bytes memory);

  /**
   * @dev Function, called by Governance, that cancels a transaction, returns action hash
   * @param target smart contract target
   * @param value wei value of the transaction
   * @param signature function signature of the transaction
   * @param data function arguments of the transaction or callData if signature empty
   * @param executionTime time at which to execute the transaction
   * @param withDelegatecall boolean, true = transaction delegatecalls the target, else calls the target
   **/
  function cancelTransaction(
    address target,
    uint256 value,
    string memory signature,
    bytes memory data,
    uint256 executionTime,
    bool withDelegatecall
  ) external returns (bytes32);

  /**
   * @dev Getter of the current admin address (should be governance)
   * @return The address of the current admin
   **/
  function getAdmin() external view returns (address);

  /**
   * @dev Getter of the current pending admin address
   * @return The address of the pending admin
   **/
  function getPendingAdmin() external view returns (address);

  /**
   * @dev Getter of the delay between queuing and execution
   * @return The delay in seconds
   **/
  function getDelay() external view returns (uint256);

  /**
   * @dev Returns whether an action (via actionHash) is queued
   * @param actionHash hash of the action to be checked
   * keccak256(abi.encode(target, value, signature, data, executionTime, withDelegatecall))
   * @return true if underlying action of actionHash is queued
   **/
  function isActionQueued(bytes32 actionHash) external view returns (bool);

  /**
   * @dev Checks whether a proposal is over its grace period
   * @param governance Governance contract
   * @param proposalId Id of the proposal against which to test
   * @return true of proposal is over grace period
   **/
  function isProposalOverGracePeriod(IKyberGovernance governance, uint256 proposalId)
    external
    view
    returns (bool);

  /**
   * @dev Getter of grace period constant
   * @return grace period in seconds
   **/
  function GRACE_PERIOD() external view returns (uint256);

  /**
   * @dev Getter of minimum delay constant
   * @return minimum delay in seconds
   **/
  function MINIMUM_DELAY() external view returns (uint256);

  /**
   * @dev Getter of maximum delay constant
   * @return maximum delay in seconds
   **/
  function MAXIMUM_DELAY() external view returns (uint256);
}

File 5 of 12 : IKyberGovernance.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IExecutorWithTimelock} from './IExecutorWithTimelock.sol';
import {IVotingPowerStrategy} from './IVotingPowerStrategy.sol';

interface IKyberGovernance {
  enum ProposalState {
    Pending,
    Canceled,
    Active,
    Failed,
    Succeeded,
    Queued,
    Expired,
    Executed,
    Finalized
  }
  enum ProposalType {Generic, Binary}

  /// For Binary proposal, optionBitMask is 0/1/2
  /// For Generic proposal, optionBitMask is bitmask of voted options
  struct Vote {
    uint32 optionBitMask;
    uint224 votingPower;
  }

  struct ProposalWithoutVote {
    uint256 id;
    ProposalType proposalType;
    address creator;
    IExecutorWithTimelock executor;
    IVotingPowerStrategy strategy;
    address[] targets;
    uint256[] weiValues;
    string[] signatures;
    bytes[] calldatas;
    bool[] withDelegatecalls;
    string[] options;
    uint256[] voteCounts;
    uint256 totalVotes;
    uint256 maxVotingPower;
    uint256 startTime;
    uint256 endTime;
    uint256 executionTime;
    string link;
    bool executed;
    bool canceled;
  }

  struct Proposal {
    ProposalWithoutVote proposalData;
    mapping(address => Vote) votes;
  }

  struct BinaryProposalParams {
    address[] targets;
    uint256[] weiValues;
    string[] signatures;
    bytes[] calldatas;
    bool[] withDelegatecalls;
  }

  /**
   * @dev emitted when a new binary proposal is created
   * @param proposalId id of the binary proposal
   * @param creator address of the creator
   * @param executor ExecutorWithTimelock contract that will execute the proposal
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param targets list of contracts called by proposal's associated transactions
   * @param weiValues list of value in wei for each propoposal's associated transaction
   * @param signatures list of function signatures (can be empty) to be used
   *     when created the callData
   * @param calldatas list of calldatas: if associated signature empty,
   *     calldata ready, else calldata is arguments
   * @param withDelegatecalls boolean, true = transaction delegatecalls the taget,
   *    else calls the target
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param link URL link of the proposal
   * @param maxVotingPower max voting power for this proposal
   **/
  event BinaryProposalCreated(
    uint256 proposalId,
    address indexed creator,
    IExecutorWithTimelock indexed executor,
    IVotingPowerStrategy indexed strategy,
    address[] targets,
    uint256[] weiValues,
    string[] signatures,
    bytes[] calldatas,
    bool[] withDelegatecalls,
    uint256 startTime,
    uint256 endTime,
    string link,
    uint256 maxVotingPower
  );

  /**
   * @dev emitted when a new generic proposal is created
   * @param proposalId id of the generic proposal
   * @param creator address of the creator
   * @param executor ExecutorWithTimelock contract that will execute the proposal
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param options list of proposal vote options
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param link URL link of the proposal
   * @param maxVotingPower max voting power for this proposal
   **/
  event GenericProposalCreated(
    uint256 proposalId,
    address indexed creator,
    IExecutorWithTimelock indexed executor,
    IVotingPowerStrategy indexed strategy,
    string[] options,
    uint256 startTime,
    uint256 endTime,
    string link,
    uint256 maxVotingPower
  );

  /**
   * @dev emitted when a proposal is canceled
   * @param proposalId id of the proposal
   **/
  event ProposalCanceled(uint256 proposalId);

  /**
   * @dev emitted when a proposal is queued
   * @param proposalId id of the proposal
   * @param executionTime time when proposal underlying transactions can be executed
   * @param initiatorQueueing address of the initiator of the queuing transaction
   **/
  event ProposalQueued(
    uint256 indexed proposalId,
    uint256 executionTime,
    address indexed initiatorQueueing
  );
  /**
   * @dev emitted when a proposal is executed
   * @param proposalId id of the proposal
   * @param initiatorExecution address of the initiator of the execution transaction
   **/
  event ProposalExecuted(uint256 proposalId, address indexed initiatorExecution);
  /**
   * @dev emitted when a vote is registered
   * @param proposalId id of the proposal
   * @param voter address of the voter
   * @param voteOptions vote options selected by voter
   * @param votingPower Power of the voter/vote
   **/
  event VoteEmitted(
    uint256 indexed proposalId,
    address indexed voter,
    uint32 indexed voteOptions,
    uint224 votingPower
  );

  /**
   * @dev emitted when a vote is registered
   * @param proposalId id of the proposal
   * @param voter address of the voter
   * @param voteOptions vote options selected by voter
   * @param oldVotingPower Old power of the voter/vote
   * @param newVotingPower New power of the voter/vote
   **/
  event VotingPowerChanged(
    uint256 indexed proposalId,
    address indexed voter,
    uint32 indexed voteOptions,
    uint224 oldVotingPower,
    uint224 newVotingPower
  );

  event DaoOperatorTransferred(address indexed newDaoOperator);

  event ExecutorAuthorized(address indexed executor);

  event ExecutorUnauthorized(address indexed executor);

  event VotingPowerStrategyAuthorized(address indexed strategy);

  event VotingPowerStrategyUnauthorized(address indexed strategy);

  /**
   * @dev Function is triggered when users withdraw from staking and change voting power
   */
  function handleVotingPowerChanged(
    address staker,
    uint256 newVotingPower,
    uint256[] calldata proposalIds
  ) external;

  /**
   * @dev Creates a Binary Proposal (needs to be validated by the Proposal Validator)
   * @param executor The ExecutorWithTimelock contract that will execute the proposal
   * @param strategy voting power strategy of the proposal
   * @param executionParams data for execution, includes
   *   targets list of contracts called by proposal's associated transactions
   *   weiValues list of value in wei for each proposal's associated transaction
   *   signatures list of function signatures (can be empty)
   *        to be used when created the callData
   *   calldatas list of calldatas: if associated signature empty,
   *        calldata ready, else calldata is arguments
   *   withDelegatecalls boolean, true = transaction delegatecalls the taget,
   *        else calls the target
   * @param startTime start timestamp to allow vote
   * @param endTime end timestamp of the proposal
   * @param link link to the proposal description
   **/
  function createBinaryProposal(
    IExecutorWithTimelock executor,
    IVotingPowerStrategy strategy,
    BinaryProposalParams memory executionParams,
    uint256 startTime,
    uint256 endTime,
    string memory link
  ) external returns (uint256 proposalId);

  /**
   * @dev Creates a Generic Proposal
   * @param executor ExecutorWithTimelock contract that will execute the proposal
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param options list of proposal vote options
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param link URL link of the proposal
   **/
  function createGenericProposal(
    IExecutorWithTimelock executor,
    IVotingPowerStrategy strategy,
    string[] memory options,
    uint256 startTime,
    uint256 endTime,
    string memory link
  ) external returns (uint256 proposalId);

  /**
   * @dev Cancels a Proposal,
   * either at anytime by guardian
   * or when proposal is Pending/Active and threshold no longer reached
   * @param proposalId id of the proposal
   **/
  function cancel(uint256 proposalId) external;

  /**
   * @dev Queue the proposal (If Proposal Succeeded)
   * @param proposalId id of the proposal to queue
   **/
  function queue(uint256 proposalId) external;

  /**
   * @dev Execute the proposal (If Proposal Queued)
   * @param proposalId id of the proposal to execute
   **/
  function execute(uint256 proposalId) external payable;

  /**
   * @dev Function allowing msg.sender to vote for/against a proposal
   * @param proposalId id of the proposal
   * @param optionBitMask vote option(s) selected
   **/
  function submitVote(uint256 proposalId, uint256 optionBitMask) external;

  /**
   * @dev Function to register the vote of user that has voted offchain via signature
   * @param proposalId id of the proposal
   * @param choice the bit mask of voted options
   * @param v v part of the voter signature
   * @param r r part of the voter signature
   * @param s s part of the voter signature
   **/
  function submitVoteBySignature(
    uint256 proposalId,
    uint256 choice,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external;

  /**
   * @dev Add new addresses to the list of authorized executors
   * @param executors list of new addresses to be authorized executors
   **/
  function authorizeExecutors(address[] calldata executors) external;

  /**
   * @dev Remove addresses to the list of authorized executors
   * @param executors list of addresses to be removed as authorized executors
   **/
  function unauthorizeExecutors(address[] calldata executors) external;

  /**
   * @dev Add new addresses to the list of authorized strategies
   * @param strategies list of new addresses to be authorized strategies
   **/
  function authorizeVotingPowerStrategies(address[] calldata strategies) external;

  /**
   * @dev Remove addresses to the list of authorized strategies
   * @param strategies list of addresses to be removed as authorized strategies
   **/
  function unauthorizeVotingPowerStrategies(address[] calldata strategies) external;

  /**
   * @dev Returns whether an address is an authorized executor
   * @param executor address to evaluate as authorized executor
   * @return true if authorized
   **/
  function isExecutorAuthorized(address executor) external view returns (bool);

  /**
   * @dev Returns whether an address is an authorized strategy
   * @param strategy address to evaluate as authorized strategy
   * @return true if authorized
   **/
  function isVotingPowerStrategyAuthorized(address strategy) external view returns (bool);

  /**
   * @dev Getter the address of the guardian, that can mainly cancel proposals
   * @return The address of the guardian
   **/
  function getDaoOperator() external view returns (address);

  /**
   * @dev Getter of the proposal count (the current number of proposals ever created)
   * @return the proposal count
   **/
  function getProposalsCount() external view returns (uint256);

  /**
   * @dev Getter of a proposal by id
   * @param proposalId id of the proposal to get
   * @return the proposal as ProposalWithoutVote memory object
   **/
  function getProposalById(uint256 proposalId) external view returns (ProposalWithoutVote memory);

  /**
   * @dev Getter of the vote data of a proposal by id
   * including totalVotes, voteCounts and options
   * @param proposalId id of the proposal
   * @return (totalVotes, voteCounts, options)
   **/
  function getProposalVoteDataById(uint256 proposalId)
    external
    view
    returns (
      uint256,
      uint256[] memory,
      string[] memory
    );

  /**
   * @dev Getter of the Vote of a voter about a proposal
   * Note: Vote is a struct: ({uint32 bitOptionMask, uint224 votingPower})
   * @param proposalId id of the proposal
   * @param voter address of the voter
   * @return The associated Vote memory object
   **/
  function getVoteOnProposal(uint256 proposalId, address voter)
    external
    view
    returns (Vote memory);

  /**
   * @dev Get the current state of a proposal
   * @param proposalId id of the proposal
   * @return The current state if the proposal
   **/
  function getProposalState(uint256 proposalId) external view returns (ProposalState);
}

File 6 of 12 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 7 of 12 : IVotingPowerStrategy.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IWithdrawHandler} from '../staking/IWithdrawHandler.sol';

interface IVotingPowerStrategy is IWithdrawHandler {
  /**
   * @dev call by governance when create a proposal
   */
  function handleProposalCreation(
    uint256 proposalId,
    uint256 startTime,
    uint256 endTime
  ) external;

  /**
   * @dev call by governance when cancel a proposal
   */
  function handleProposalCancellation(uint256 proposalId) external;

  /**
   * @dev call by governance when submitting a vote
   * @param choice: unused param for future usage
   * @return votingPower of voter
   */
  function handleVote(
    address voter,
    uint256 proposalId,
    uint256 choice
  ) external returns (uint256 votingPower);

  /**
   * @dev get voter's voting power given timestamp
   * @dev for reading purposes and validating voting power for creating/canceling proposal in the furture
   * @dev when submitVote, should call 'handleVote' instead
   */
  function getVotingPower(address voter, uint256 timestamp)
    external
    view
    returns (uint256 votingPower);

  /**
   * @dev validate that startTime and endTime are suitable for calculating voting power
   * @dev with current version, startTime and endTime must be in the sameEpcoh
   */
  function validateProposalCreation(uint256 startTime, uint256 endTime)
    external
    view
    returns (bool);

  /**
   * @dev getMaxVotingPower at current time
   * @dev call by governance when creating a proposal
   */
  function getMaxVotingPower() external view returns (uint256);
}

File 8 of 12 : IWithdrawHandler.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

/**
 * @title Interface for callbacks hooks when user withdraws from staking contract
 */
interface IWithdrawHandler {
  function handleWithdrawal(address staker, uint256 reduceAmount) external;
}

File 9 of 12 : IProposalValidator.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IKyberGovernance} from './IKyberGovernance.sol';
import {IVotingPowerStrategy} from './IVotingPowerStrategy.sol';

interface IProposalValidator {
  /**
   * @dev Called to validate a binary proposal
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param creator address of the creator
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param daoOperator address of daoOperator
   * @return boolean, true if can be created
   **/
  function validateBinaryProposalCreation(
    IVotingPowerStrategy strategy,
    address creator,
    uint256 startTime,
    uint256 endTime,
    address daoOperator
  ) external view returns (bool);

  /**
   * @dev Called to validate a generic proposal
   * @param strategy votingPowerStrategy contract to calculate voting power
   * @param creator address of the creator
   * @param startTime timestamp when vote starts
   * @param endTime timestamp when vote ends
   * @param options list of proposal vote options
   * @param daoOperator address of daoOperator
   * @return boolean, true if can be created
   **/
  function validateGenericProposalCreation(
    IVotingPowerStrategy strategy,
    address creator,
    uint256 startTime,
    uint256 endTime,
    string[] calldata options,
    address daoOperator
  ) external view returns (bool);

  /**
   * @dev Called to validate the cancellation of a proposal
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the generic proposal
   * @param user entity initiating the cancellation
   * @return boolean, true if can be cancelled
   **/
  function validateProposalCancellation(
    IKyberGovernance governance,
    uint256 proposalId,
    address user
  ) external view returns (bool);

  /**
   * @dev Returns whether a binary proposal passed or not
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the proposal to set
   * @return true if proposal passed
   **/
  function isBinaryProposalPassed(IKyberGovernance governance, uint256 proposalId)
    external
    view
    returns (bool);

  /**
   * @dev Check whether a proposal has reached quorum
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the proposal to verify
   * @return voting power needed for a proposal to pass
   **/
  function isQuorumValid(IKyberGovernance governance, uint256 proposalId)
    external
    view
    returns (bool);

  /**
   * @dev Check whether a proposal has enough extra FOR-votes than AGAINST-votes
   * @param governance governance contract to fetch proposals from
   * @param proposalId Id of the proposal to verify
   * @return true if enough For-Votes
   **/
  function isVoteDifferentialValid(IKyberGovernance governance, uint256 proposalId)
    external
    view
    returns (bool);

  /**
   * @dev Get maximum vote options for a generic proposal
   * @return the maximum no. of vote options possible for a generic proposal
   **/
  function MAX_VOTING_OPTIONS() external view returns (uint256);

  /**
   * @dev Get minimum voting duration constant value
   * @return the minimum voting duration value in seconds
   **/
  function MIN_VOTING_DURATION() external view returns (uint256);

  /**
   * @dev Get the vote differential threshold constant value
   * to compare with % of for votes/total supply - % of against votes/total supply
   * @return the vote differential threshold value (100 <=> 1%)
   **/
  function VOTE_DIFFERENTIAL() external view returns (uint256);

  /**
   * @dev Get quorum threshold constant value
   * to compare with % of for votes/total supply
   * @return the quorum threshold value (100 <=> 1%)
   **/
  function MINIMUM_QUORUM() external view returns (uint256);
}

File 10 of 12 : Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import "./IERC20Ext.sol";


/**
 * @title Kyber utility file
 * mostly shared constants and rate calculation helpers
 * inherited by most of kyber contracts.
 * previous utils implementations are for previous solidity versions.
 */
abstract contract Utils {
    // Declared constants below to be used in tandem with
    // getDecimalsConstant(), for gas optimization purposes
    // which return decimals from a constant list of popular
    // tokens.
    IERC20Ext internal constant ETH_TOKEN_ADDRESS = IERC20Ext(
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
    );
    IERC20Ext internal constant USDT_TOKEN_ADDRESS = IERC20Ext(
        0xdAC17F958D2ee523a2206206994597C13D831ec7
    );
    IERC20Ext internal constant DAI_TOKEN_ADDRESS = IERC20Ext(
        0x6B175474E89094C44Da98b954EedeAC495271d0F
    );
    IERC20Ext internal constant USDC_TOKEN_ADDRESS = IERC20Ext(
        0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
    );
    IERC20Ext internal constant WBTC_TOKEN_ADDRESS = IERC20Ext(
        0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
    );
    IERC20Ext internal constant KNC_TOKEN_ADDRESS = IERC20Ext(
        0xdd974D5C2e2928deA5F71b9825b8b646686BD200
    );
    uint256 public constant BPS = 10000; // Basic Price Steps. 1 step = 0.01%
    uint256 internal constant PRECISION = (10**18);
    uint256 internal constant MAX_QTY = (10**28); // 10B tokens
    uint256 internal constant MAX_RATE = (PRECISION * 10**7); // up to 10M tokens per eth
    uint256 internal constant MAX_DECIMALS = 18;
    uint256 internal constant ETH_DECIMALS = 18;
    uint256 internal constant MAX_ALLOWANCE = uint256(-1); // token.approve inifinite

    mapping(IERC20Ext => uint256) internal decimals;

    /// @dev Sets the decimals of a token to storage if not already set, and returns
    ///      the decimals value of the token. Prefer using this function over
    ///      getDecimals(), to avoid forgetting to set decimals in local storage.
    /// @param token The token type
    /// @return tokenDecimals The decimals of the token
    function getSetDecimals(IERC20Ext token) internal returns (uint256 tokenDecimals) {
        tokenDecimals = getDecimalsConstant(token);
        if (tokenDecimals > 0) return tokenDecimals;

        tokenDecimals = decimals[token];
        if (tokenDecimals == 0) {
            tokenDecimals = token.decimals();
            decimals[token] = tokenDecimals;
        }
    }

    /// @dev Get the balance of a user
    /// @param token The token type
    /// @param user The user's address
    /// @return The balance
    function getBalance(IERC20Ext token, address user) internal view returns (uint256) {
        if (token == ETH_TOKEN_ADDRESS) {
            return user.balance;
        } else {
            return token.balanceOf(user);
        }
    }

    /// @dev Get the decimals of a token, read from the constant list, storage,
    ///      or from token.decimals(). Prefer using getSetDecimals when possible.
    /// @param token The token type
    /// @return tokenDecimals The decimals of the token
    function getDecimals(IERC20Ext token) internal view returns (uint256 tokenDecimals) {
        // return token decimals if has constant value
        tokenDecimals = getDecimalsConstant(token);
        if (tokenDecimals > 0) return tokenDecimals;

        // handle case where token decimals is not a declared decimal constant
        tokenDecimals = decimals[token];
        // moreover, very possible that old tokens have decimals 0
        // these tokens will just have higher gas fees.
        return (tokenDecimals > 0) ? tokenDecimals : token.decimals();
    }

    function calcDestAmount(
        IERC20Ext src,
        IERC20Ext dest,
        uint256 srcAmount,
        uint256 rate
    ) internal view returns (uint256) {
        return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate);
    }

    function calcSrcAmount(
        IERC20Ext src,
        IERC20Ext dest,
        uint256 destAmount,
        uint256 rate
    ) internal view returns (uint256) {
        return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate);
    }

    function calcDstQty(
        uint256 srcQty,
        uint256 srcDecimals,
        uint256 dstDecimals,
        uint256 rate
    ) internal pure returns (uint256) {
        require(srcQty <= MAX_QTY, "srcQty > MAX_QTY");
        require(rate <= MAX_RATE, "rate > MAX_RATE");

        if (dstDecimals >= srcDecimals) {
            require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
            return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
        } else {
            require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
            return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
        }
    }

    function calcSrcQty(
        uint256 dstQty,
        uint256 srcDecimals,
        uint256 dstDecimals,
        uint256 rate
    ) internal pure returns (uint256) {
        require(dstQty <= MAX_QTY, "dstQty > MAX_QTY");
        require(rate <= MAX_RATE, "rate > MAX_RATE");

        //source quantity is rounded up. to avoid dest quantity being too low.
        uint256 numerator;
        uint256 denominator;
        if (srcDecimals >= dstDecimals) {
            require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
            numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
            denominator = rate;
        } else {
            require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
            numerator = (PRECISION * dstQty);
            denominator = (rate * (10**(dstDecimals - srcDecimals)));
        }
        return (numerator + denominator - 1) / denominator; //avoid rounding down errors
    }

    function calcRateFromQty(
        uint256 srcAmount,
        uint256 destAmount,
        uint256 srcDecimals,
        uint256 dstDecimals
    ) internal pure returns (uint256) {
        require(srcAmount <= MAX_QTY, "srcAmount > MAX_QTY");
        require(destAmount <= MAX_QTY, "destAmount > MAX_QTY");

        if (dstDecimals >= srcDecimals) {
            require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
            return ((destAmount * PRECISION) / ((10**(dstDecimals - srcDecimals)) * srcAmount));
        } else {
            require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
            return ((destAmount * PRECISION * (10**(srcDecimals - dstDecimals))) / srcAmount);
        }
    }

    /// @dev save storage access by declaring token decimal constants
    /// @param token The token type
    /// @return token decimals
    function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) {
        if (token == ETH_TOKEN_ADDRESS) {
            return ETH_DECIMALS;
        } else if (token == USDT_TOKEN_ADDRESS) {
            return 6;
        } else if (token == DAI_TOKEN_ADDRESS) {
            return 18;
        } else if (token == USDC_TOKEN_ADDRESS) {
            return 6;
        } else if (token == WBTC_TOKEN_ADDRESS) {
            return 8;
        } else if (token == KNC_TOKEN_ADDRESS) {
            return 18;
        } else {
            return 0;
        }
    }

    function minOf(uint256 x, uint256 y) internal pure returns (uint256) {
        return x > y ? y : x;
    }
}

File 11 of 12 : IERC20Ext.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";


/**
 * @dev Interface extending ERC20 standard to include decimals() as
 *      it is optional in the OpenZeppelin IERC20 interface.
 */
interface IERC20Ext is IERC20 {
    /**
     * @dev This function is required as Kyber requires to interact
     *      with token.decimals() with many of its operations.
     */
    function decimals() external view returns (uint8 digits);
}

File 12 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: 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
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint256","name":"delay","type":"uint256"},{"internalType":"uint256","name":"gracePeriod","type":"uint256"},{"internalType":"uint256","name":"minimumDelay","type":"uint256"},{"internalType":"uint256","name":"maximumDelay","type":"uint256"},{"internalType":"uint256","name":"minVoteDuration","type":"uint256"},{"internalType":"uint256","name":"maxVotingOptions","type":"uint256"},{"internalType":"uint256","name":"voteDifferential","type":"uint256"},{"internalType":"uint256","name":"minimumQuorum","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"actionHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"string","name":"signature","type":"string"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"executionTime","type":"uint256"},{"indexed":false,"internalType":"bool","name":"withDelegatecall","type":"bool"}],"name":"CancelledAction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"actionHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"string","name":"signature","type":"string"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"executionTime","type":"uint256"},{"indexed":false,"internalType":"bool","name":"withDelegatecall","type":"bool"},{"indexed":false,"internalType":"bytes","name":"resultData","type":"bytes"}],"name":"ExecutedAction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"delay","type":"uint256"}],"name":"NewDelay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"actionHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"string","name":"signature","type":"string"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"executionTime","type":"uint256"},{"indexed":false,"internalType":"bool","name":"withDelegatecall","type":"bool"}],"name":"QueuedAction","type":"event"},{"inputs":[],"name":"BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GRACE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_VOTING_OPTIONS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_QUORUM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_VOTING_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_INDEX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VOTE_DIFFERENTIAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YES_INDEX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"string","name":"signature","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"executionTime","type":"uint256"},{"internalType":"bool","name":"withDelegatecall","type":"bool"}],"name":"cancelTransaction","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"string","name":"signature","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"executionTime","type":"uint256"},{"internalType":"bool","name":"withDelegatecall","type":"bool"}],"name":"executeTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"actionHash","type":"bytes32"}],"name":"isActionQueued","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKyberGovernance","name":"governance","type":"address"},{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"isBinaryProposalPassed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKyberGovernance","name":"governance","type":"address"},{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"isProposalOverGracePeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKyberGovernance","name":"governance","type":"address"},{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"isQuorumValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKyberGovernance","name":"governance","type":"address"},{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"isVoteDifferentialValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"string","name":"signature","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"executionTime","type":"uint256"},{"internalType":"bool","name":"withDelegatecall","type":"bool"}],"name":"queueTransaction","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"delay","type":"uint256"}],"name":"setDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"setPendingAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IVotingPowerStrategy","name":"strategy","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address","name":"daoOperator","type":"address"}],"name":"validateBinaryProposalCreation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IVotingPowerStrategy","name":"strategy","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"string[]","name":"options","type":"string[]"},{"internalType":"address","name":"daoOperator","type":"address"}],"name":"validateGenericProposalCreation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IKyberGovernance","name":"governance","type":"address"},{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"validateProposalCancellation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101606040523480156200001257600080fd5b506040516200227338038062002273833981016040819052620000359162000159565b838383838c8c8c8c8c818410156200006a5760405162461bcd60e51b81526004016200006190620001ed565b60405180910390fd5b808411156200008d5760405162461bcd60e51b8152600401620000619062000224565b6002849055600080546001600160a01b0319166001600160a01b038716179055608083905260a082905260c08190526040517f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90620000ee9086906200025b565b60405180910390a17f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c85604051620001279190620001d9565b60405180910390a150505060e09590955250610100929092526101205261014052506200026498505050505050505050565b60008060008060008060008060006101208a8c03121562000178578485fd5b89516001600160a01b03811681146200018f578586fd5b8099505060208a0151975060408a0151965060608a0151955060808a0151945060a08a0151935060c08a0151925060e08a015191506101008a015190509295985092959850929598565b6001600160a01b0391909116815260200190565b6020808252601a908201527f44454c41595f53484f525445525f5448414e5f4d494e494d554d000000000000604082015260600190565b60208082526019908201527f44454c41595f4c4f4e4745525f5448414e5f4d4158494d554d00000000000000604082015260600190565b90815260200190565b60805160a05160c05160e051610100516101205161014051611f8e620002e560003980610ef8528061125f52508061086d5280610cbd52508061070f5280610d485250806105705280610d045280610ff85250806108fd52806112cf525080610f1c528061128f5250806109d65280610f5852806110ac5250611f8e6000f3fe6080604052600436106101b05760003560e01c806397b734b0116100ec578063cd7d6c171161008a578063e177246e11610064578063e177246e1461044a578063e58bda7c1461046a578063eaf1061c1461047f578063f670a5f914610494576101b7565b8063cd7d6c171461040b578063cebc9a8214610420578063d046815614610435576101b7565b8063b159beac116100c6578063b159beac146103ac578063b1b43ae5146103c1578063b1fc8796146103d6578063c1a287e2146103f6576101b7565b806397b734b01461034c578063a54d87a21461036c578063ace432091461038c576101b7565b80634dd18bf5116101595780637d645fab116101335780637d645fab146102e25780638902ab65146102f75780638d8fe2e3146103175780639125fb5814610337576101b7565b80634dd18bf5146102805780636e9960c3146102a05780637aa50080146102c2576101b7565b8063249d39e91161018a578063249d39e9146102365780632edbdb521461024b578063429c2e1e1461026b576101b7565b80630e18b681146101bc578063194f9158146101d35780631dc40b5114610209576101b7565b366101b757005b600080fd5b3480156101c857600080fd5b506101d16104b4565b005b3480156101df57600080fd5b506101f36101ee36600461173f565b61054b565b6040516102009190611b6e565b60405180910390f35b34801561021557600080fd5b506102296102243660046115e0565b610631565b6040516102009190611b79565b34801561024257600080fd5b506102296106fd565b34801561025757600080fd5b506101f36102663660046116fe565b610703565b34801561027757600080fd5b5061022961070d565b34801561028c57600080fd5b506101d161029b3660046115c4565b610731565b3480156102ac57600080fd5b506102b56107b3565b6040516102009190611b05565b3480156102ce57600080fd5b506101f36102dd3660046116d3565b6107c2565b3480156102ee57600080fd5b506102296108fb565b61030a6103053660046115e0565b61091f565b6040516102009190611c02565b34801561032357600080fd5b506102296103323660046115e0565b610bd2565b34801561034357600080fd5b50610229610cbb565b34801561035857600080fd5b506101f361036736600461179d565b610cdf565b34801561037857600080fd5b506101f36103873660046116d3565b610e03565b34801561039857600080fd5b506101f36103a73660046116d3565b610e20565b3480156103b857600080fd5b50610229610ef6565b3480156103cd57600080fd5b50610229610f1a565b3480156103e257600080fd5b506101f36103f13660046116bb565b610f3e565b34801561040257600080fd5b50610229610f56565b34801561041757600080fd5b50610229610f7a565b34801561042c57600080fd5b50610229610f7f565b34801561044157600080fd5b506102b5610f85565b34801561045657600080fd5b506101d16104653660046116bb565b610f94565b34801561047657600080fd5b50610229610ff1565b34801561048b57600080fd5b50610229610ff6565b3480156104a057600080fd5b506101f36104af3660046116d3565b61101a565b6001546001600160a01b031633146104e75760405162461bcd60e51b81526004016104de90611c15565b60405180910390fd5b600080543373ffffffffffffffffffffffffffffffffffffffff1991821681179092556001805490911690556040517f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c9161054191611b05565b60405180910390a1565b6000816001600160a01b0316856001600160a01b03161461056e57506000610628565b7f000000000000000000000000000000000000000000000000000000000000000061059984866110da565b10156105a757506000610628565b60405163456eea8760e01b81526001600160a01b0387169063456eea87906105d59087908790600401611e72565b60206040518083038186803b1580156105ed57600080fd5b505afa158015610601573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610625919061169f565b90505b95945050505050565b600080546001600160a01b0316331461065c5760405162461bcd60e51b81526004016104de90611cf1565b600087878787878760405160200161067996959493929190611b19565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916905591506001600160a01b038916907f87c481aa909c37502caa37394ab791c26b68fa4fa5ae56de104de36444ae9069906106ea9084908b908b908b908b908b90611b82565b60405180910390a2979650505050505050565b61271081565b60005b9392505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b3330146107505760405162461bcd60e51b81526004016104de90611e3b565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556040517f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a756906107a8908390611b05565b60405180910390a150565b6000546001600160a01b031690565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b81526004016107f19190611b79565b60006040518083038186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108459190810190611856565b905060018160200151600181111561085957fe5b146108685760009150506108f5565b6108cf7f00000000000000000000000000000000000000000000000000000000000000006108c9836101a001516108c36127108661016001516001815181106108ad57fe5b602002602001015161113790919063ffffffff16565b90611190565b906111f7565b6108f0826101a001516108c36127108561016001516000815181106108ad57fe5b119150505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546060906001600160a01b0316331461094c5760405162461bcd60e51b81526004016104de90611cf1565b600087878787878760405160200161096996959493929190611b19565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff166109b05760405162461bcd60e51b81526004016104de90611d5f565b834210156109d05760405162461bcd60e51b81526004016104de90611c4c565b6109fa847f00000000000000000000000000000000000000000000000000000000000000006111f7565b421115610a195760405162461bcd60e51b81526004016104de90611d28565b6000818152600360205260409020805460ff191690558551606090610a3f575084610a6b565b868051906020012086604051602001610a59929190611aa1565b60405160208183030381529060405290505b600060608515610af85789341015610a955760405162461bcd60e51b81526004016104de90611e04565b8a6001600160a01b031683604051610aad9190611ae9565b600060405180830381855af49150503d8060008114610ae8576040519150601f19603f3d011682016040523d82523d6000602084013e610aed565b606091505b509092509050610b5a565b8a6001600160a01b03168a84604051610b119190611ae9565b60006040518083038185875af1925050503d8060008114610b4e576040519150601f19603f3d011682016040523d82523d6000602084013e610b53565b606091505b5090925090505b81610b775760405162461bcd60e51b81526004016104de90611d96565b8a6001600160a01b03167f97825080b472fa91fe888b62ec128814d60dec546a2dafb955e50923f4a1b7e7858c8c8c8c8c88604051610bbc9796959493929190611ba1565b60405180910390a29a9950505050505050505050565b600080546001600160a01b03163314610bfd5760405162461bcd60e51b81526004016104de90611cf1565b600254610c0b9042906111f7565b831015610c2a5760405162461bcd60e51b81526004016104de90611c83565b6000878787878787604051602001610c4796959493929190611b19565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916600117905591506001600160a01b038916907f2191aed4c4733c76e08a9e7e1da0b8d87fa98753f22df49231ddc66e0f05f022906106ea9084908b908b908b908b908b90611b82565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000816001600160a01b0316876001600160a01b031614610d0257506000610df8565b7f0000000000000000000000000000000000000000000000000000000000000000610d2d86886110da565b1015610d3b57506000610df8565b600183111580610d6a57507f000000000000000000000000000000000000000000000000000000000000000083115b15610d7757506000610df8565b60405163456eea8760e01b81526001600160a01b0389169063456eea8790610da59089908990600401611e72565b60206040518083038186803b158015610dbd57600080fd5b505afa158015610dd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df5919061169f565b90505b979650505050505050565b6000610e0f8383610e20565b8015610706575061070683836107c2565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b8152600401610e4f9190611b79565b60006040518083038186803b158015610e6757600080fd5b505afa158015610e7b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ea39190810190611856565b9050600181602001516001811115610eb757fe5b14610ec65760009150506108f5565b610eee816101600151600081518110610edb57fe5b6020026020010151826101a00151611251565b949350505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008181526003602052604090205460ff165b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081565b60025490565b6001546001600160a01b031690565b333014610fb35760405162461bcd60e51b81526004016104de90611e3b565b610fbc8161128d565b60028190556040517f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c906107a8908390611b79565b600181565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b81526004016110499190611b79565b60006040518083038186803b15801561106157600080fd5b505afa158015611075573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261109d9190810190611856565b6102008101519091506110d0907f00000000000000000000000000000000000000000000000000000000000000006111f7565b4211949350505050565b600082821115611131576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082611146575060006108f5565b8282028284828161115357fe5b04146107065760405162461bcd60e51b8152600401808060200182810382526021815260200180611f386021913960400191505060405180910390fd5b60008082116111e6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816111ef57fe5b049392505050565b600082820183811015610706576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006112836127106108c3847f0000000000000000000000000000000000000000000000000000000000000000611137565b9092101592915050565b7f00000000000000000000000000000000000000000000000000000000000000008110156112cd5760405162461bcd60e51b81526004016104de90611cba565b7f000000000000000000000000000000000000000000000000000000000000000081111561130d5760405162461bcd60e51b81526004016104de90611dcd565b50565b600061132361131e84611ec2565b611e80565b905082815283838301111561133757600080fd5b828260208301376000602084830101529392505050565b600061135c61131e84611ec2565b905082815283838301111561137057600080fd5b610706836020830184611ee4565b8035610f5181611f14565b8051610f5181611f14565b600082601f8301126113a4578081fd5b815160206113b461131e83611ea4565b82815281810190858301838502870184018810156113d0578586fd5b855b858110156113f75781516113e581611f14565b845292840192908401906001016113d2565b5090979650505050505050565b600082601f830112611414578081fd5b8151602061142461131e83611ea4565b8281528181019085830183850287018401881015611440578586fd5b855b858110156113f757815161145581611f29565b84529284019290840190600101611442565b600082601f830112611477578081fd5b8151602061148761131e83611ea4565b82815281810190858301855b858110156113f7578151880189603f8201126114ad578788fd5b6114be8a878301516040840161134e565b8552509284019290840190600101611493565b600082601f8301126114e1578081fd5b815160206114f161131e83611ea4565b82815281810190858301855b858110156113f757611514898684518b01016115a5565b845292840192908401906001016114fd565b600082601f830112611536578081fd5b8151602061154661131e83611ea4565b8281528181019085830183850287018401881015611562578586fd5b855b858110156113f757815184529284019290840190600101611564565b8035610f5181611f29565b8051610f5181611f29565b805160028110610f5157600080fd5b600082601f8301126115b5578081fd5b6107068383516020850161134e565b6000602082840312156115d5578081fd5b813561070681611f14565b60008060008060008060c087890312156115f8578182fd5b863561160381611f14565b955060208701359450604087013567ffffffffffffffff80821115611626578384fd5b818901915089601f830112611639578384fd5b6116488a833560208501611310565b9550606089013591508082111561165d578384fd5b508701601f8101891361166e578283fd5b61167d89823560208401611310565b9350506080870135915061169360a08801611580565b90509295509295509295565b6000602082840312156116b0578081fd5b815161070681611f29565b6000602082840312156116cc578081fd5b5035919050565b600080604083850312156116e5578182fd5b82356116f081611f14565b946020939093013593505050565b600080600060608486031215611712578081fd5b833561171d81611f14565b925060208401359150604084013561173481611f14565b809150509250925092565b600080600080600060a08688031215611756578283fd5b853561176181611f14565b9450602086013561177181611f14565b93506040860135925060608601359150608086013561178f81611f14565b809150509295509295909350565b600080600080600080600060c0888a0312156117b7578485fd5b87356117c281611f14565b965060208801356117d281611f14565b95506040880135945060608801359350608088013567ffffffffffffffff808211156117fc578283fd5b818a0191508a601f83011261180f578283fd5b81358181111561181d578384fd5b8b60208083028501011115611830578384fd5b60208301955080945050505061184860a0890161137e565b905092959891949750929550565b600060208284031215611867578081fd5b815167ffffffffffffffff8082111561187e578283fd5b8184019150610280808387031215611894578384fd5b61189d81611e80565b9050825181526118af60208401611596565b60208201526118c060408401611389565b60408201526118d160608401611389565b60608201526118e260808401611389565b608082015260a0830151828111156118f8578485fd5b61190487828601611394565b60a08301525060c08301518281111561191b578485fd5b61192787828601611526565b60c08301525060e08301518281111561193e578485fd5b61194a878286016114d1565b60e0830152506101008084015183811115611963578586fd5b61196f88828701611467565b8284015250506101208084015183811115611988578586fd5b61199488828701611404565b82840152505061014080840151838111156119ad578586fd5b6119b9888287016114d1565b82840152505061016080840151838111156119d2578586fd5b6119de88828701611526565b918301919091525061018083810151908201526101a080840151908201526101c080840151908201526101e0808401519082015261020080840151908201526102208084015183811115611a30578586fd5b611a3c888287016115a5565b8284015250506102409150611a5282840161158b565b828201526102609150611a6682840161158b565b91810191909152949350505050565b60008151808452611a8d816020860160208601611ee4565b601f01601f19169290920160200192915050565b60007fffffffff00000000000000000000000000000000000000000000000000000000841682528251611adb816004850160208701611ee4565b919091016004019392505050565b60008251611afb818460208701611ee4565b9190910192915050565b6001600160a01b0391909116815260200190565b60006001600160a01b038816825286602083015260c06040830152611b4160c0830187611a75565b8281036060840152611b538187611a75565b6080840195909552505090151560a090910152949350505050565b901515815260200190565b90815260200190565b600087825286602083015260c06040830152611b4160c0830187611a75565b600088825287602083015260e06040830152611bc060e0830188611a75565b8281036060840152611bd28188611a75565b905085608084015284151560a084015282810360c0840152611bf48185611a75565b9a9950505050505050505050565b6000602082526107066020830184611a75565b60208082526015908201527f4f4e4c595f42595f50454e44494e475f41444d494e0000000000000000000000604082015260600190565b60208082526015908201527f54494d454c4f434b5f4e4f545f46494e49534845440000000000000000000000604082015260600190565b6020808252601d908201527f455845435554494f4e5f54494d455f554e444552455354494d41544544000000604082015260600190565b6020808252601a908201527f44454c41595f53484f525445525f5448414e5f4d494e494d554d000000000000604082015260600190565b6020808252600d908201527f4f4e4c595f42595f41444d494e00000000000000000000000000000000000000604082015260600190565b60208082526015908201527f47524143455f504552494f445f46494e49534845440000000000000000000000604082015260600190565b60208082526011908201527f414354494f4e5f4e4f545f515545554544000000000000000000000000000000604082015260600190565b60208082526017908201527f4641494c45445f414354494f4e5f455845435554494f4e000000000000000000604082015260600190565b60208082526019908201527f44454c41595f4c4f4e4745525f5448414e5f4d4158494d554d00000000000000604082015260600190565b60208082526014908201527f4e4f545f454e4f5547485f4d53475f56414c5545000000000000000000000000604082015260600190565b60208082526015908201527f4f4e4c595f42595f544849535f54494d454c4f434b0000000000000000000000604082015260600190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611e9c57fe5b604052919050565b600067ffffffffffffffff821115611eb857fe5b5060209081020190565b600067ffffffffffffffff821115611ed657fe5b50601f01601f191660200190565b60005b83811015611eff578181015183820152602001611ee7565b83811115611f0e576000848401525b50505050565b6001600160a01b038116811461130d57600080fd5b801515811461130d57600080fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212203b904a7589ae989f5462cd890ddc433f6a5ddf420d16a1dd4e6389cc50932e7464736f6c634300070600330000000000000000000000007ec8fcc26be7e9e85b57e73083e5fe0550d8a7fe0000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000001275000000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000005dc

Deployed Bytecode

0x6080604052600436106101b05760003560e01c806397b734b0116100ec578063cd7d6c171161008a578063e177246e11610064578063e177246e1461044a578063e58bda7c1461046a578063eaf1061c1461047f578063f670a5f914610494576101b7565b8063cd7d6c171461040b578063cebc9a8214610420578063d046815614610435576101b7565b8063b159beac116100c6578063b159beac146103ac578063b1b43ae5146103c1578063b1fc8796146103d6578063c1a287e2146103f6576101b7565b806397b734b01461034c578063a54d87a21461036c578063ace432091461038c576101b7565b80634dd18bf5116101595780637d645fab116101335780637d645fab146102e25780638902ab65146102f75780638d8fe2e3146103175780639125fb5814610337576101b7565b80634dd18bf5146102805780636e9960c3146102a05780637aa50080146102c2576101b7565b8063249d39e91161018a578063249d39e9146102365780632edbdb521461024b578063429c2e1e1461026b576101b7565b80630e18b681146101bc578063194f9158146101d35780631dc40b5114610209576101b7565b366101b757005b600080fd5b3480156101c857600080fd5b506101d16104b4565b005b3480156101df57600080fd5b506101f36101ee36600461173f565b61054b565b6040516102009190611b6e565b60405180910390f35b34801561021557600080fd5b506102296102243660046115e0565b610631565b6040516102009190611b79565b34801561024257600080fd5b506102296106fd565b34801561025757600080fd5b506101f36102663660046116fe565b610703565b34801561027757600080fd5b5061022961070d565b34801561028c57600080fd5b506101d161029b3660046115c4565b610731565b3480156102ac57600080fd5b506102b56107b3565b6040516102009190611b05565b3480156102ce57600080fd5b506101f36102dd3660046116d3565b6107c2565b3480156102ee57600080fd5b506102296108fb565b61030a6103053660046115e0565b61091f565b6040516102009190611c02565b34801561032357600080fd5b506102296103323660046115e0565b610bd2565b34801561034357600080fd5b50610229610cbb565b34801561035857600080fd5b506101f361036736600461179d565b610cdf565b34801561037857600080fd5b506101f36103873660046116d3565b610e03565b34801561039857600080fd5b506101f36103a73660046116d3565b610e20565b3480156103b857600080fd5b50610229610ef6565b3480156103cd57600080fd5b50610229610f1a565b3480156103e257600080fd5b506101f36103f13660046116bb565b610f3e565b34801561040257600080fd5b50610229610f56565b34801561041757600080fd5b50610229610f7a565b34801561042c57600080fd5b50610229610f7f565b34801561044157600080fd5b506102b5610f85565b34801561045657600080fd5b506101d16104653660046116bb565b610f94565b34801561047657600080fd5b50610229610ff1565b34801561048b57600080fd5b50610229610ff6565b3480156104a057600080fd5b506101f36104af3660046116d3565b61101a565b6001546001600160a01b031633146104e75760405162461bcd60e51b81526004016104de90611c15565b60405180910390fd5b600080543373ffffffffffffffffffffffffffffffffffffffff1991821681179092556001805490911690556040517f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c9161054191611b05565b60405180910390a1565b6000816001600160a01b0316856001600160a01b03161461056e57506000610628565b7f0000000000000000000000000000000000000000000000000000000000093a8061059984866110da565b10156105a757506000610628565b60405163456eea8760e01b81526001600160a01b0387169063456eea87906105d59087908790600401611e72565b60206040518083038186803b1580156105ed57600080fd5b505afa158015610601573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610625919061169f565b90505b95945050505050565b600080546001600160a01b0316331461065c5760405162461bcd60e51b81526004016104de90611cf1565b600087878787878760405160200161067996959493929190611b19565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916905591506001600160a01b038916907f87c481aa909c37502caa37394ab791c26b68fa4fa5ae56de104de36444ae9069906106ea9084908b908b908b908b908b90611b82565b60405180910390a2979650505050505050565b61271081565b60005b9392505050565b7f000000000000000000000000000000000000000000000000000000000000000881565b3330146107505760405162461bcd60e51b81526004016104de90611e3b565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556040517f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a756906107a8908390611b05565b60405180910390a150565b6000546001600160a01b031690565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b81526004016107f19190611b79565b60006040518083038186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108459190810190611856565b905060018160200151600181111561085957fe5b146108685760009150506108f5565b6108cf7f00000000000000000000000000000000000000000000000000000000000001906108c9836101a001516108c36127108661016001516001815181106108ad57fe5b602002602001015161113790919063ffffffff16565b90611190565b906111f7565b6108f0826101a001516108c36127108561016001516000815181106108ad57fe5b119150505b92915050565b7f000000000000000000000000000000000000000000000000000000000012750081565b6000546060906001600160a01b0316331461094c5760405162461bcd60e51b81526004016104de90611cf1565b600087878787878760405160200161096996959493929190611b19565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff166109b05760405162461bcd60e51b81526004016104de90611d5f565b834210156109d05760405162461bcd60e51b81526004016104de90611c4c565b6109fa847f0000000000000000000000000000000000000000000000000000000000093a806111f7565b421115610a195760405162461bcd60e51b81526004016104de90611d28565b6000818152600360205260409020805460ff191690558551606090610a3f575084610a6b565b868051906020012086604051602001610a59929190611aa1565b60405160208183030381529060405290505b600060608515610af85789341015610a955760405162461bcd60e51b81526004016104de90611e04565b8a6001600160a01b031683604051610aad9190611ae9565b600060405180830381855af49150503d8060008114610ae8576040519150601f19603f3d011682016040523d82523d6000602084013e610aed565b606091505b509092509050610b5a565b8a6001600160a01b03168a84604051610b119190611ae9565b60006040518083038185875af1925050503d8060008114610b4e576040519150601f19603f3d011682016040523d82523d6000602084013e610b53565b606091505b5090925090505b81610b775760405162461bcd60e51b81526004016104de90611d96565b8a6001600160a01b03167f97825080b472fa91fe888b62ec128814d60dec546a2dafb955e50923f4a1b7e7858c8c8c8c8c88604051610bbc9796959493929190611ba1565b60405180910390a29a9950505050505050505050565b600080546001600160a01b03163314610bfd5760405162461bcd60e51b81526004016104de90611cf1565b600254610c0b9042906111f7565b831015610c2a5760405162461bcd60e51b81526004016104de90611c83565b6000878787878787604051602001610c4796959493929190611b19565b60408051601f19818403018152828252805160209182012060008181526003909252919020805460ff1916600117905591506001600160a01b038916907f2191aed4c4733c76e08a9e7e1da0b8d87fa98753f22df49231ddc66e0f05f022906106ea9084908b908b908b908b908b90611b82565b7f000000000000000000000000000000000000000000000000000000000000019081565b6000816001600160a01b0316876001600160a01b031614610d0257506000610df8565b7f0000000000000000000000000000000000000000000000000000000000093a80610d2d86886110da565b1015610d3b57506000610df8565b600183111580610d6a57507f000000000000000000000000000000000000000000000000000000000000000883115b15610d7757506000610df8565b60405163456eea8760e01b81526001600160a01b0389169063456eea8790610da59089908990600401611e72565b60206040518083038186803b158015610dbd57600080fd5b505afa158015610dd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df5919061169f565b90505b979650505050505050565b6000610e0f8383610e20565b8015610706575061070683836107c2565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b8152600401610e4f9190611b79565b60006040518083038186803b158015610e6757600080fd5b505afa158015610e7b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ea39190810190611856565b9050600181602001516001811115610eb757fe5b14610ec65760009150506108f5565b610eee816101600151600081518110610edb57fe5b6020026020010151826101a00151611251565b949350505050565b7f00000000000000000000000000000000000000000000000000000000000005dc81565b7f000000000000000000000000000000000000000000000000000000000001518081565b60008181526003602052604090205460ff165b919050565b7f0000000000000000000000000000000000000000000000000000000000093a8081565b600081565b60025490565b6001546001600160a01b031690565b333014610fb35760405162461bcd60e51b81526004016104de90611e3b565b610fbc8161128d565b60028190556040517f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c906107a8908390611b79565b600181565b7f0000000000000000000000000000000000000000000000000000000000093a8081565b600080836001600160a01b0316633656de21846040518263ffffffff1660e01b81526004016110499190611b79565b60006040518083038186803b15801561106157600080fd5b505afa158015611075573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261109d9190810190611856565b6102008101519091506110d0907f0000000000000000000000000000000000000000000000000000000000093a806111f7565b4211949350505050565b600082821115611131576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082611146575060006108f5565b8282028284828161115357fe5b04146107065760405162461bcd60e51b8152600401808060200182810382526021815260200180611f386021913960400191505060405180910390fd5b60008082116111e6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816111ef57fe5b049392505050565b600082820183811015610706576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006112836127106108c3847f00000000000000000000000000000000000000000000000000000000000005dc611137565b9092101592915050565b7f00000000000000000000000000000000000000000000000000000000000151808110156112cd5760405162461bcd60e51b81526004016104de90611cba565b7f000000000000000000000000000000000000000000000000000000000012750081111561130d5760405162461bcd60e51b81526004016104de90611dcd565b50565b600061132361131e84611ec2565b611e80565b905082815283838301111561133757600080fd5b828260208301376000602084830101529392505050565b600061135c61131e84611ec2565b905082815283838301111561137057600080fd5b610706836020830184611ee4565b8035610f5181611f14565b8051610f5181611f14565b600082601f8301126113a4578081fd5b815160206113b461131e83611ea4565b82815281810190858301838502870184018810156113d0578586fd5b855b858110156113f75781516113e581611f14565b845292840192908401906001016113d2565b5090979650505050505050565b600082601f830112611414578081fd5b8151602061142461131e83611ea4565b8281528181019085830183850287018401881015611440578586fd5b855b858110156113f757815161145581611f29565b84529284019290840190600101611442565b600082601f830112611477578081fd5b8151602061148761131e83611ea4565b82815281810190858301855b858110156113f7578151880189603f8201126114ad578788fd5b6114be8a878301516040840161134e565b8552509284019290840190600101611493565b600082601f8301126114e1578081fd5b815160206114f161131e83611ea4565b82815281810190858301855b858110156113f757611514898684518b01016115a5565b845292840192908401906001016114fd565b600082601f830112611536578081fd5b8151602061154661131e83611ea4565b8281528181019085830183850287018401881015611562578586fd5b855b858110156113f757815184529284019290840190600101611564565b8035610f5181611f29565b8051610f5181611f29565b805160028110610f5157600080fd5b600082601f8301126115b5578081fd5b6107068383516020850161134e565b6000602082840312156115d5578081fd5b813561070681611f14565b60008060008060008060c087890312156115f8578182fd5b863561160381611f14565b955060208701359450604087013567ffffffffffffffff80821115611626578384fd5b818901915089601f830112611639578384fd5b6116488a833560208501611310565b9550606089013591508082111561165d578384fd5b508701601f8101891361166e578283fd5b61167d89823560208401611310565b9350506080870135915061169360a08801611580565b90509295509295509295565b6000602082840312156116b0578081fd5b815161070681611f29565b6000602082840312156116cc578081fd5b5035919050565b600080604083850312156116e5578182fd5b82356116f081611f14565b946020939093013593505050565b600080600060608486031215611712578081fd5b833561171d81611f14565b925060208401359150604084013561173481611f14565b809150509250925092565b600080600080600060a08688031215611756578283fd5b853561176181611f14565b9450602086013561177181611f14565b93506040860135925060608601359150608086013561178f81611f14565b809150509295509295909350565b600080600080600080600060c0888a0312156117b7578485fd5b87356117c281611f14565b965060208801356117d281611f14565b95506040880135945060608801359350608088013567ffffffffffffffff808211156117fc578283fd5b818a0191508a601f83011261180f578283fd5b81358181111561181d578384fd5b8b60208083028501011115611830578384fd5b60208301955080945050505061184860a0890161137e565b905092959891949750929550565b600060208284031215611867578081fd5b815167ffffffffffffffff8082111561187e578283fd5b8184019150610280808387031215611894578384fd5b61189d81611e80565b9050825181526118af60208401611596565b60208201526118c060408401611389565b60408201526118d160608401611389565b60608201526118e260808401611389565b608082015260a0830151828111156118f8578485fd5b61190487828601611394565b60a08301525060c08301518281111561191b578485fd5b61192787828601611526565b60c08301525060e08301518281111561193e578485fd5b61194a878286016114d1565b60e0830152506101008084015183811115611963578586fd5b61196f88828701611467565b8284015250506101208084015183811115611988578586fd5b61199488828701611404565b82840152505061014080840151838111156119ad578586fd5b6119b9888287016114d1565b82840152505061016080840151838111156119d2578586fd5b6119de88828701611526565b918301919091525061018083810151908201526101a080840151908201526101c080840151908201526101e0808401519082015261020080840151908201526102208084015183811115611a30578586fd5b611a3c888287016115a5565b8284015250506102409150611a5282840161158b565b828201526102609150611a6682840161158b565b91810191909152949350505050565b60008151808452611a8d816020860160208601611ee4565b601f01601f19169290920160200192915050565b60007fffffffff00000000000000000000000000000000000000000000000000000000841682528251611adb816004850160208701611ee4565b919091016004019392505050565b60008251611afb818460208701611ee4565b9190910192915050565b6001600160a01b0391909116815260200190565b60006001600160a01b038816825286602083015260c06040830152611b4160c0830187611a75565b8281036060840152611b538187611a75565b6080840195909552505090151560a090910152949350505050565b901515815260200190565b90815260200190565b600087825286602083015260c06040830152611b4160c0830187611a75565b600088825287602083015260e06040830152611bc060e0830188611a75565b8281036060840152611bd28188611a75565b905085608084015284151560a084015282810360c0840152611bf48185611a75565b9a9950505050505050505050565b6000602082526107066020830184611a75565b60208082526015908201527f4f4e4c595f42595f50454e44494e475f41444d494e0000000000000000000000604082015260600190565b60208082526015908201527f54494d454c4f434b5f4e4f545f46494e49534845440000000000000000000000604082015260600190565b6020808252601d908201527f455845435554494f4e5f54494d455f554e444552455354494d41544544000000604082015260600190565b6020808252601a908201527f44454c41595f53484f525445525f5448414e5f4d494e494d554d000000000000604082015260600190565b6020808252600d908201527f4f4e4c595f42595f41444d494e00000000000000000000000000000000000000604082015260600190565b60208082526015908201527f47524143455f504552494f445f46494e49534845440000000000000000000000604082015260600190565b60208082526011908201527f414354494f4e5f4e4f545f515545554544000000000000000000000000000000604082015260600190565b60208082526017908201527f4641494c45445f414354494f4e5f455845435554494f4e000000000000000000604082015260600190565b60208082526019908201527f44454c41595f4c4f4e4745525f5448414e5f4d4158494d554d00000000000000604082015260600190565b60208082526014908201527f4e4f545f454e4f5547485f4d53475f56414c5545000000000000000000000000604082015260600190565b60208082526015908201527f4f4e4c595f42595f544849535f54494d454c4f434b0000000000000000000000604082015260600190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611e9c57fe5b604052919050565b600067ffffffffffffffff821115611eb857fe5b5060209081020190565b600067ffffffffffffffff821115611ed657fe5b50601f01601f191660200190565b60005b83811015611eff578181015183820152602001611ee7565b83811115611f0e576000848401525b50505050565b6001600160a01b038116811461130d57600080fd5b801515811461130d57600080fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212203b904a7589ae989f5462cd890ddc433f6a5ddf420d16a1dd4e6389cc50932e7464736f6c63430007060033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000007ec8fcc26be7e9e85b57e73083e5fe0550d8a7fe0000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000001275000000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000005dc

-----Decoded View---------------
Arg [0] : admin (address): 0x7Ec8FcC26bE7e9E85B57E73083E5Fe0550d8A7fE
Arg [1] : delay (uint256): 604800
Arg [2] : gracePeriod (uint256): 604800
Arg [3] : minimumDelay (uint256): 86400
Arg [4] : maximumDelay (uint256): 1209600
Arg [5] : minVoteDuration (uint256): 604800
Arg [6] : maxVotingOptions (uint256): 8
Arg [7] : voteDifferential (uint256): 400
Arg [8] : minimumQuorum (uint256): 1500

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000007ec8fcc26be7e9e85b57e73083e5fe0550d8a7fe
Arg [1] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [2] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [3] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [4] : 0000000000000000000000000000000000000000000000000000000000127500
Arg [5] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000190
Arg [8] : 00000000000000000000000000000000000000000000000000000000000005dc


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.