Address Details
contract

0x391421e905e4f2Aa75b67b66E2eD59fF7844f181

Contract Name
ExercisePreImmortal
Creator
0xad5e83–557abf at 0x9c791a–41aa79
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
83 Transactions
Transfers
308 Transfers
Gas Used
24,795,264
Last Balance Update
13714402
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
ExercisePreImmortal




Optimization enabled
true
Compiler version
v0.7.5+commit.eb77ed08




Optimization runs
200
EVM Version
istanbul




Verified at
2022-01-01T21:22:59.073737Z

ExercisepIMMO.sol

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
  using SafeMath for uint256;
  using Address for address;

  function safeTransfer(
    IERC20 token,
    address to,
    uint256 value
  ) internal {
    _callOptionalReturn(
      token,
      abi.encodeWithSelector(token.transfer.selector, to, value)
    );
  }

  function safeTransferFrom(
    IERC20 token,
    address from,
    address to,
    uint256 value
  ) internal {
    _callOptionalReturn(
      token,
      abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
    );
  }

  /**
   * @dev Deprecated. This function has issues similar to the ones found in
   * {IERC20-approve}, and its usage is discouraged.
   *
   * Whenever possible, use {safeIncreaseAllowance} and
   * {safeDecreaseAllowance} instead.
   */
  function safeApprove(
    IERC20 token,
    address spender,
    uint256 value
  ) internal {
    // safeApprove should only be called when setting an initial allowance,
    // or when resetting it to zero. To increase and decrease it, use
    // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
    // solhint-disable-next-line max-line-length
    require(
      (value == 0) || (token.allowance(address(this), spender) == 0),
      "SafeERC20: approve from non-zero to non-zero allowance"
    );
    _callOptionalReturn(
      token,
      abi.encodeWithSelector(token.approve.selector, spender, value)
    );
  }

  function safeIncreaseAllowance(
    IERC20 token,
    address spender,
    uint256 value
  ) internal {
    uint256 newAllowance = token.allowance(address(this), spender).add(value);
    _callOptionalReturn(
      token,
      abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
    );
  }

  function safeDecreaseAllowance(
    IERC20 token,
    address spender,
    uint256 value
  ) internal {
    uint256 newAllowance = token.allowance(address(this), spender).sub(
      value,
      "SafeERC20: decreased allowance below zero"
    );
    _callOptionalReturn(
      token,
      abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
    );
  }

  /**
   * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
   * on the return value: the return value is optional (but if data is returned, it must not be false).
   * @param token The token targeted by the call.
   * @param data The call data (encoded using abi.encode or one of its variants).
   */
  function _callOptionalReturn(IERC20 token, bytes memory data) private {
    // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
    // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
    // the target address contains contract code and also asserts for success in the low-level call.

    bytes memory returndata = address(token).functionCall(
      data,
      "SafeERC20: low-level call failed"
    );
    if (returndata.length > 0) {
      // Return data is optional
      // solhint-disable-next-line max-line-length
      require(
        abi.decode(returndata, (bool)),
        "SafeERC20: ERC20 operation did not succeed"
      );
    }
  }
}

/**
 * @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, 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) {
    return sub(a, b, "SafeMath: subtraction overflow");
  }

  /**
   * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
   * overflow (when the result is negative).
   *
   * 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);
    uint256 c = a - b;

    return c;
  }

  /**
   * @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) {
    // 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 0;
    }

    uint256 c = a * b;
    require(c / a == b, "SafeMath: multiplication overflow");

    return c;
  }

  /**
   * @dev Returns the integer division of two unsigned integers. Reverts 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) {
    return div(a, b, "SafeMath: division by zero");
  }

  /**
   * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b > 0, errorMessage);
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * Reverts 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) {
    return mod(a, b, "SafeMath: modulo by zero");
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * Reverts with custom message 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,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b != 0, errorMessage);
    return a % b;
  }

  // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
  function sqrrt(uint256 a) internal pure returns (uint256 c) {
    if (a > 3) {
      c = a;
      uint256 b = add(div(a, 2), 1);
      while (b < c) {
        c = b;
        b = div(add(div(a, b), b), 2);
      }
    } else if (a != 0) {
      c = 1;
    }
  }

  /*
   * Expects percentage to be trailed by 00,
   */
  function percentageAmount(uint256 total_, uint8 percentage_)
    internal
    pure
    returns (uint256 percentAmount_)
  {
    return div(mul(total_, percentage_), 1000);
  }

  /*
   * Expects percentage to be trailed by 00,
   */
  function substractPercentage(uint256 total_, uint8 percentageToSub_)
    internal
    pure
    returns (uint256 result_)
  {
    return sub(total_, div(mul(total_, percentageToSub_), 1000));
  }

  function percentageOfTotal(uint256 part_, uint256 total_)
    internal
    pure
    returns (uint256 percent_)
  {
    return div(mul(part_, 100), total_);
  }

  /**
   * Taken from Hypersonic https://github.com/M2629/HyperSonic/blob/main/Math.sol
   * @dev Returns the average of two numbers. The result is rounded towards
   * zero.
   */
  function average(uint256 a, uint256 b) internal pure returns (uint256) {
    // (a + b) / 2 can overflow, so we distribute
    return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
  }

  function quadraticPricing(uint256 payment_, uint256 multiplier_)
    internal
    pure
    returns (uint256)
  {
    return sqrrt(mul(multiplier_, payment_));
  }

  function bondingCurve(uint256 supply_, uint256 multiplier_)
    internal
    pure
    returns (uint256)
  {
    return mul(multiplier_, supply_);
  }
}

/**
 * @dev Collection of functions related to the address type
 */
library Address {
  /**
   * @dev Returns true if `account` is a contract.
   *
   * [IMPORTANT]
   * ====
   * It is unsafe to assume that an address for which this function returns
   * false is an externally-owned account (EOA) and not a contract.
   *
   * Among others, `isContract` will return false for the following
   * types of addresses:
   *
   *  - an externally-owned account
   *  - a contract in construction
   *  - an address where a contract will be created
   *  - an address where a contract lived, but was destroyed
   * ====
   */
  function isContract(address account) internal view returns (bool) {
    // This method relies in extcodesize, which returns 0 for contracts in
    // construction, since the code is only stored at the end of the
    // constructor execution.

    uint256 size;
    // solhint-disable-next-line no-inline-assembly
    assembly {
      size := extcodesize(account)
    }
    return size > 0;
  }

  /**
   * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
   * `recipient`, forwarding all available gas and reverting on errors.
   *
   * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
   * of certain opcodes, possibly making contracts go over the 2300 gas limit
   * imposed by `transfer`, making them unable to receive funds via
   * `transfer`. {sendValue} removes this limitation.
   *
   * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
   *
   * IMPORTANT: because control is transferred to `recipient`, care must be
   * taken to not create reentrancy vulnerabilities. Consider using
   * {ReentrancyGuard} or the
   * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
   */
  function sendValue(address payable recipient, uint256 amount) internal {
    require(address(this).balance >= amount, "Address: insufficient balance");

    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
    (bool success, ) = recipient.call{ value: amount }("");
    require(
      success,
      "Address: unable to send value, recipient may have reverted"
    );
  }

  /**
   * @dev Performs a Solidity function call using a low level `call`. A
   * plain`call` is an unsafe replacement for a function call: use this
   * function instead.
   *
   * If `target` reverts with a revert reason, it is bubbled up by this
   * function (like regular Solidity function calls).
   *
   * Returns the raw returned data. To convert to the expected return value,
   * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
   *
   * Requirements:
   *
   * - `target` must be a contract.
   * - calling `target` with `data` must not revert.
   *
   * _Available since v3.1._
   */
  function functionCall(address target, bytes memory data)
    internal
    returns (bytes memory)
  {
    return functionCall(target, data, "Address: low-level call failed");
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
   * `errorMessage` as a fallback revert reason when `target` reverts.
   *
   * _Available since v3.1._
   */
  function functionCall(
    address target,
    bytes memory data,
    string memory errorMessage
  ) internal returns (bytes memory) {
    return _functionCallWithValue(target, data, 0, errorMessage);
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
   * but also transferring `value` wei to `target`.
   *
   * Requirements:
   *
   * - the calling contract must have an ETH balance of at least `value`.
   * - the called Solidity function must be `payable`.
   *
   * _Available since v3.1._
   */
  function functionCallWithValue(
    address target,
    bytes memory data,
    uint256 value
  ) internal returns (bytes memory) {
    return
      functionCallWithValue(
        target,
        data,
        value,
        "Address: low-level call with value failed"
      );
  }

  /**
   * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
   * with `errorMessage` as a fallback revert reason when `target` reverts.
   *
   * _Available since v3.1._
   */
  // function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
  //     require(address(this).balance >= value, "Address: insufficient balance for call");
  //     return _functionCallWithValue(target, data, value, errorMessage);
  // }
  function functionCallWithValue(
    address target,
    bytes memory data,
    uint256 value,
    string memory errorMessage
  ) internal returns (bytes memory) {
    require(
      address(this).balance >= value,
      "Address: insufficient balance for call"
    );
    require(isContract(target), "Address: call to non-contract");

    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory returndata) = target.call{ value: value }(data);
    return _verifyCallResult(success, returndata, errorMessage);
  }

  function _functionCallWithValue(
    address target,
    bytes memory data,
    uint256 weiValue,
    string memory errorMessage
  ) private returns (bytes memory) {
    require(isContract(target), "Address: call to non-contract");

    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory returndata) = target.call{ value: weiValue }(
      data
    );
    if (success) {
      return returndata;
    } else {
      // Look for revert reason and bubble it up if present
      if (returndata.length > 0) {
        // The easiest way to bubble the revert reason is using memory via assembly

        // solhint-disable-next-line no-inline-assembly
        assembly {
          let returndata_size := mload(returndata)
          revert(add(32, returndata), returndata_size)
        }
      } else {
        revert(errorMessage);
      }
    }
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
   * but performing a static call.
   *
   * _Available since v3.3._
   */
  function functionStaticCall(address target, bytes memory data)
    internal
    view
    returns (bytes memory)
  {
    return
      functionStaticCall(target, data, "Address: low-level static call failed");
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
   * but performing a static call.
   *
   * _Available since v3.3._
   */
  function functionStaticCall(
    address target,
    bytes memory data,
    string memory errorMessage
  ) internal view returns (bytes memory) {
    require(isContract(target), "Address: static call to non-contract");

    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory returndata) = target.staticcall(data);
    return _verifyCallResult(success, returndata, errorMessage);
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
   * but performing a delegate call.
   *
   * _Available since v3.3._
   */
  function functionDelegateCall(address target, bytes memory data)
    internal
    returns (bytes memory)
  {
    return
      functionDelegateCall(
        target,
        data,
        "Address: low-level delegate call failed"
      );
  }

  /**
   * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
   * but performing a delegate call.
   *
   * _Available since v3.3._
   */
  function functionDelegateCall(
    address target,
    bytes memory data,
    string memory errorMessage
  ) internal returns (bytes memory) {
    require(isContract(target), "Address: delegate call to non-contract");

    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory returndata) = target.delegatecall(data);
    return _verifyCallResult(success, returndata, errorMessage);
  }

  function _verifyCallResult(
    bool success,
    bytes memory returndata,
    string memory errorMessage
  ) private pure returns (bytes memory) {
    if (success) {
      return returndata;
    } else {
      // Look for revert reason and bubble it up if present
      if (returndata.length > 0) {
        // The easiest way to bubble the revert reason is using memory via assembly

        // solhint-disable-next-line no-inline-assembly
        assembly {
          let returndata_size := mload(returndata)
          revert(add(32, returndata), returndata_size)
        }
      } else {
        revert(errorMessage);
      }
    }
  }

  function addressToString(address _address)
    internal
    pure
    returns (string memory)
  {
    bytes32 _bytes = bytes32(uint256(_address));
    bytes memory HEX = "0123456789abcdef";
    bytes memory _addr = new bytes(42);

    _addr[0] = "0";
    _addr[1] = "x";

    for (uint256 i = 0; i < 20; i++) {
      _addr[2 + i * 2] = HEX[uint8(_bytes[i + 12] >> 4)];
      _addr[3 + i * 2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
    }

    return string(_addr);
  }
}

/**
 * @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);
}

interface ITreasury {
  function deposit(
    uint256 _amount,
    address _token,
    uint256 _profit
  ) external returns (uint256);
}

interface IPreImmortal {
  function burnFrom(address account_, uint256 amount_) external;
}

interface ICirculatingIMMO {
  function IMMOCirculatingSupply() external view returns (uint256);
}

contract ExercisePreImmortal {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  address public owner;
  address public newOwner;

  address public immutable pIMMO;
  address public immutable IMMO;
  address public immutable mcUSD;
  address public immutable treasury;
  address public immutable circulatingIMMOContract;

  struct Term {
    uint256 percent; // 4 decimals ( 5000 = 0.5% )
    uint256 claimed;
    uint256 max;
  }
  mapping(address => Term) public terms;

  mapping(address => address) public walletChange;

  constructor(
    address _pIMMO,
    address _IMMO,
    address _mcUSD,
    address _treasury,
    address _circulatingIMMOContract
  ) {
    owner = msg.sender;
    require(_pIMMO != address(0));
    pIMMO = _pIMMO;
    require(_IMMO != address(0));
    IMMO = _IMMO;
    require(_mcUSD != address(0));
    mcUSD = _mcUSD;
    require(_treasury != address(0));
    treasury = _treasury;
    require(_circulatingIMMOContract != address(0));
    circulatingIMMOContract = _circulatingIMMOContract;
  }

  // Sets terms for a new wallet
  function setTerms(
    address _vester,
    uint256 _amountCanClaim,
    uint256 _rate
  ) external returns (bool) {
    require(msg.sender == owner, "Sender is not owner");
    require(
      _amountCanClaim >= terms[_vester].max,
      "cannot lower amount claimable"
    );
    require(_rate >= terms[_vester].percent, "cannot lower vesting rate");

    terms[_vester].max = _amountCanClaim;
    terms[_vester].percent = _rate;

    return true;
  }

  // Allows wallet to redeem pIMMO for IMMO
  function exercise(uint256 _amount) external returns (bool) {
    Term memory info = terms[msg.sender];
    require(info.percent > 0, "Cannot claim");
    require(redeemable(info) >= _amount, "Not enough vested");
    require(info.max.sub(info.claimed) >= _amount, "Claimed over max");

    IERC20(mcUSD).safeTransferFrom(msg.sender, address(this), _amount);
    IPreImmortal(pIMMO).burnFrom(msg.sender, _amount);

    IERC20(mcUSD).approve(treasury, _amount);
    uint256 IMMOToSend = ITreasury(treasury).deposit(_amount, mcUSD, 0);

    terms[msg.sender].claimed = info.claimed.add(_amount);

    IERC20(IMMO).safeTransfer(msg.sender, IMMOToSend);

    return true;
  }

  // Allows wallet owner to transfer rights to a new address
  function pushWalletChange(address _newWallet) external returns (bool) {
    require(terms[msg.sender].percent != 0);
    walletChange[msg.sender] = _newWallet;
    return true;
  }

  // Allows wallet to pull rights from an old address
  function pullWalletChange(address _oldWallet) external returns (bool) {
    require(walletChange[_oldWallet] == msg.sender, "wallet did not push");

    walletChange[_oldWallet] = address(0);
    terms[msg.sender] = terms[_oldWallet];
    delete terms[_oldWallet];

    return true;
  }

  // Amount a wallet can redeem based on current supply
  function redeemableFor(address _vester) public view returns (uint256) {
    return redeemable(terms[_vester]);
  }

  function redeemable(Term memory _info) internal view returns (uint256) {
    return
      (
        ICirculatingIMMO(circulatingIMMOContract)
          .IMMOCirculatingSupply()
          .mul(_info.percent)
          .mul(1000)
      ).sub(_info.claimed);
  }

  function pushOwnership(address _newOwner) external returns (bool) {
    require(msg.sender == owner, "Sender is not owner");
    require(_newOwner != address(0));
    newOwner = _newOwner;
    return true;
  }

  function pullOwnership() external returns (bool) {
    require(msg.sender == newOwner);
    owner = newOwner;
    newOwner = address(0);
    return true;
  }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_pIMMO","internalType":"address"},{"type":"address","name":"_IMMO","internalType":"address"},{"type":"address","name":"_mcUSD","internalType":"address"},{"type":"address","name":"_treasury","internalType":"address"},{"type":"address","name":"_circulatingIMMOContract","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"IMMO","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"circulatingIMMOContract","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"exercise","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mcUSD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"newOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pIMMO","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"pullOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"pullWalletChange","inputs":[{"type":"address","name":"_oldWallet","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"pushOwnership","inputs":[{"type":"address","name":"_newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"pushWalletChange","inputs":[{"type":"address","name":"_newWallet","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemableFor","inputs":[{"type":"address","name":"_vester","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setTerms","inputs":[{"type":"address","name":"_vester","internalType":"address"},{"type":"uint256","name":"_amountCanClaim","internalType":"uint256"},{"type":"uint256","name":"_rate","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"percent","internalType":"uint256"},{"type":"uint256","name":"claimed","internalType":"uint256"},{"type":"uint256","name":"max","internalType":"uint256"}],"name":"terms","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"treasury","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"walletChange","inputs":[{"type":"address","name":"","internalType":"address"}]}]
              

Contract Creation Code

0x61012060405234801561001157600080fd5b506040516112c03803806112c0833981810160405260a081101561003457600080fd5b508051602082015160408301516060840151608090940151600080546001600160a01b03191633179055929391929091906001600160a01b03851661007857600080fd5b6001600160601b0319606086901b166080526001600160a01b03841661009d57600080fd5b6001600160601b0319606085901b1660a0526001600160a01b0383166100c257600080fd5b6001600160601b0319606084901b1660c0526001600160a01b0382166100e757600080fd5b6001600160601b0319606083901b1660e0526001600160a01b03811661010c57600080fd5b6001600160601b031960609190911b16610100525050505060805160601c60a05160601c60c05160601c60e05160601c6101005160601c61112661019a600039806105ef5280610b6e525080610588528061088c52806109705250806102fe52806107ad528061085d528061093d5250806102da5280610a1352508061032252806107fc52506111266000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0efb1211610097578063c7e41d3711610066578063c7e41d371461022e578063c8c819ac14610266578063d39ce77c146102aa578063d4ee1d90146102d057610100565b80638c0efb12146101db5780638da5cb5b146101e35780638dd031ed146101eb578063b07f0a411461021157610100565b806347c52135116100d357806347c521351461017f5780635d8fb88d146101a557806361d027b3146101cb5780637ff28d3a146101d357610100565b8063025de6cd14610105578063033775ce146101295780633f24a0911461013157806344a6a61214610139575b600080fd5b61010d6102d8565b604080516001600160a01b039092168252519081900360200190f35b61010d6102fc565b61010d610320565b61016b6004803603606081101561014f57600080fd5b506001600160a01b038135169060208101359060400135610344565b604080519115158252519081900360200190f35b61016b6004803603602081101561019557600080fd5b50356001600160a01b03166104a3565b61010d600480360360208110156101bb57600080fd5b50356001600160a01b031661056b565b61010d610586565b61016b6105aa565b61010d6105ed565b61010d610611565b61016b6004803603602081101561020157600080fd5b50356001600160a01b0316610620565b61016b6004803603602081101561022757600080fd5b503561066b565b6102546004803603602081101561024457600080fd5b50356001600160a01b0316610a4c565b60408051918252519081900360200190f35b61028c6004803603602081101561027c57600080fd5b50356001600160a01b0316610a99565b60408051938452602084019290925282820152519081900360600190f35b61016b600480360360208110156102c057600080fd5b50356001600160a01b0316610ab9565b61010d610b45565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080546001600160a01b0316331461039a576040805162461bcd60e51b815260206004820152601360248201527229b2b73232b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b0384166000908152600260208190526040909120015483101561040b576040805162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74206c6f77657220616d6f756e7420636c61696d61626c65000000604482015290519081900360640190fd5b6001600160a01b038416600090815260026020526040902054821015610478576040805162461bcd60e51b815260206004820152601960248201527f63616e6e6f74206c6f7765722076657374696e67207261746500000000000000604482015290519081900360640190fd5b506001600160a01b039290921660009081526002602081905260409091209081019190915555600190565b6001600160a01b038181166000908152600360205260408120549091163314610509576040805162461bcd60e51b81526020600482015260136024820152720eec2d8d8cae840c8d2c840dcdee840e0eae6d606b1b604482015290519081900360640190fd5b506001600160a01b0316600081815260036020908152604080832080546001600160a01b031916905560029182905280832033845290832081548155600182810180548383015583850180549390950192909255948452908390558290555590565b6003602052600090815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001546000906001600160a01b031633146105c457600080fd5b5060018054600080546001600160a01b03199081166001600160a01b0384161790915516815590565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b031681565b3360009081526002602052604081205461063957600080fd5b5033600090815260036020526040902080546001600160a01b0383166001600160a01b03199091161790556001919050565b6000610675611084565b50336000908152600260208181526040928390208351606081018552815480825260018301549382019390935292015492820192909252906106ed576040805162461bcd60e51b815260206004820152600c60248201526b43616e6e6f7420636c61696d60a01b604482015290519081900360640190fd5b826106f782610b54565b101561073e576040805162461bcd60e51b8152602060048201526011602482015270139bdd08195b9bdd59da081d995cdd1959607a1b604482015290519081900360640190fd5b8261075a82602001518360400151610bff90919063ffffffff16565b10156107a0576040805162461bcd60e51b815260206004820152601060248201526f086d8c2d2dacac840deeccae440dac2f60831b604482015290519081900360640190fd5b6107d56001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333086610c48565b6040805163079cc67960e41b81523360048201526024810185905290516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916379cc679091604480830192600092919082900301818387803b15801561084357600080fd5b505af1158015610857573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156108f257600080fd5b505af1158015610906573d6000803e3d6000fd5b505050506040513d602081101561091c57600080fd5b50506040805163bc157ac160e01b8152600481018590526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116602483015260006044830181905292517f00000000000000000000000000000000000000000000000000000000000000009091169163bc157ac191606480830192602092919082900301818787803b1580156109b957600080fd5b505af11580156109cd573d6000803e3d6000fd5b505050506040513d60208110156109e357600080fd5b505160208301519091506109f79085610ca8565b33600081815260026020526040902060010191909155610a42907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169083610d02565b5060019392505050565b6001600160a01b03811660009081526002602081815260408084208151606081018352815481526001820154938101939093529092015491810191909152610a9390610b54565b92915050565b600260208190526000918252604090912080546001820154919092015483565b600080546001600160a01b03163314610b0f576040805162461bcd60e51b815260206004820152601360248201527229b2b73232b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b038216610b2257600080fd5b50600180546001600160a01b0383166001600160a01b0319909116178155919050565b6001546001600160a01b031681565b6000610a938260200151610bfd6103e8610bf786600001517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633630bcb86040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc557600080fd5b505afa158015610bd9573d6000803e3d6000fd5b505050506040513d6020811015610bef57600080fd5b505190610d59565b90610d59565b905b6000610c4183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610db2565b9392505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ca2908590610e49565b50505050565b600082820183811015610c41576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d54908490610e49565b505050565b600082610d6857506000610a93565b82820282848281610d7557fe5b0414610c415760405162461bcd60e51b81526004018080602001828103825260218152602001806110a66021913960400191505060405180910390fd5b60008184841115610e415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e06578181015183820152602001610dee565b50505050905090810190601f168015610e335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6060610e9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610efa9092919063ffffffff16565b805190915015610d5457808060200190516020811015610ebd57600080fd5b5051610d545760405162461bcd60e51b815260040180806020018281038252602a8152602001806110c7602a913960400191505060405180910390fd5b6060610f098484600085610f11565b949350505050565b6060610f1c8561107e565b610f6d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610fac5780518252601f199092019160209182019101610f8d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461100e576040519150601f19603f3d011682016040523d82523d6000602084013e611013565b606091505b50915091508115611027579150610f099050565b8051156110375780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610e06578181015183820152602001610dee565b3b151590565b6040518060600160405280600081526020016000815260200160008152509056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4c5731fdffcf5ad3b39631512954a52bca3ab840ea99c2478ec76677b9139f664736f6c63430007050033000000000000000000000000459277127535efe9eb6c387f66432fbd615617f2000000000000000000000000e685d21b7b0fc7a248a6a8e03b8db22d013aa2ee000000000000000000000000918146359264c492bd6934071c6bd31c854edbc3000000000000000000000000e2adcd126b4275cd75e72ff7ddc8cf7e43fc13d400000000000000000000000043c964fea97da1ae1c07cf24b9d430f537f4dc2a

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0efb1211610097578063c7e41d3711610066578063c7e41d371461022e578063c8c819ac14610266578063d39ce77c146102aa578063d4ee1d90146102d057610100565b80638c0efb12146101db5780638da5cb5b146101e35780638dd031ed146101eb578063b07f0a411461021157610100565b806347c52135116100d357806347c521351461017f5780635d8fb88d146101a557806361d027b3146101cb5780637ff28d3a146101d357610100565b8063025de6cd14610105578063033775ce146101295780633f24a0911461013157806344a6a61214610139575b600080fd5b61010d6102d8565b604080516001600160a01b039092168252519081900360200190f35b61010d6102fc565b61010d610320565b61016b6004803603606081101561014f57600080fd5b506001600160a01b038135169060208101359060400135610344565b604080519115158252519081900360200190f35b61016b6004803603602081101561019557600080fd5b50356001600160a01b03166104a3565b61010d600480360360208110156101bb57600080fd5b50356001600160a01b031661056b565b61010d610586565b61016b6105aa565b61010d6105ed565b61010d610611565b61016b6004803603602081101561020157600080fd5b50356001600160a01b0316610620565b61016b6004803603602081101561022757600080fd5b503561066b565b6102546004803603602081101561024457600080fd5b50356001600160a01b0316610a4c565b60408051918252519081900360200190f35b61028c6004803603602081101561027c57600080fd5b50356001600160a01b0316610a99565b60408051938452602084019290925282820152519081900360600190f35b61016b600480360360208110156102c057600080fd5b50356001600160a01b0316610ab9565b61010d610b45565b7f000000000000000000000000e685d21b7b0fc7a248a6a8e03b8db22d013aa2ee81565b7f000000000000000000000000918146359264c492bd6934071c6bd31c854edbc381565b7f000000000000000000000000459277127535efe9eb6c387f66432fbd615617f281565b600080546001600160a01b0316331461039a576040805162461bcd60e51b815260206004820152601360248201527229b2b73232b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b0384166000908152600260208190526040909120015483101561040b576040805162461bcd60e51b815260206004820152601d60248201527f63616e6e6f74206c6f77657220616d6f756e7420636c61696d61626c65000000604482015290519081900360640190fd5b6001600160a01b038416600090815260026020526040902054821015610478576040805162461bcd60e51b815260206004820152601960248201527f63616e6e6f74206c6f7765722076657374696e67207261746500000000000000604482015290519081900360640190fd5b506001600160a01b039290921660009081526002602081905260409091209081019190915555600190565b6001600160a01b038181166000908152600360205260408120549091163314610509576040805162461bcd60e51b81526020600482015260136024820152720eec2d8d8cae840c8d2c840dcdee840e0eae6d606b1b604482015290519081900360640190fd5b506001600160a01b0316600081815260036020908152604080832080546001600160a01b031916905560029182905280832033845290832081548155600182810180548383015583850180549390950192909255948452908390558290555590565b6003602052600090815260409020546001600160a01b031681565b7f000000000000000000000000e2adcd126b4275cd75e72ff7ddc8cf7e43fc13d481565b6001546000906001600160a01b031633146105c457600080fd5b5060018054600080546001600160a01b03199081166001600160a01b0384161790915516815590565b7f00000000000000000000000043c964fea97da1ae1c07cf24b9d430f537f4dc2a81565b6000546001600160a01b031681565b3360009081526002602052604081205461063957600080fd5b5033600090815260036020526040902080546001600160a01b0383166001600160a01b03199091161790556001919050565b6000610675611084565b50336000908152600260208181526040928390208351606081018552815480825260018301549382019390935292015492820192909252906106ed576040805162461bcd60e51b815260206004820152600c60248201526b43616e6e6f7420636c61696d60a01b604482015290519081900360640190fd5b826106f782610b54565b101561073e576040805162461bcd60e51b8152602060048201526011602482015270139bdd08195b9bdd59da081d995cdd1959607a1b604482015290519081900360640190fd5b8261075a82602001518360400151610bff90919063ffffffff16565b10156107a0576040805162461bcd60e51b815260206004820152601060248201526f086d8c2d2dacac840deeccae440dac2f60831b604482015290519081900360640190fd5b6107d56001600160a01b037f000000000000000000000000918146359264c492bd6934071c6bd31c854edbc316333086610c48565b6040805163079cc67960e41b81523360048201526024810185905290516001600160a01b037f000000000000000000000000459277127535efe9eb6c387f66432fbd615617f216916379cc679091604480830192600092919082900301818387803b15801561084357600080fd5b505af1158015610857573d6000803e3d6000fd5b505050507f000000000000000000000000918146359264c492bd6934071c6bd31c854edbc36001600160a01b031663095ea7b37f000000000000000000000000e2adcd126b4275cd75e72ff7ddc8cf7e43fc13d4856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156108f257600080fd5b505af1158015610906573d6000803e3d6000fd5b505050506040513d602081101561091c57600080fd5b50506040805163bc157ac160e01b8152600481018590526001600160a01b037f000000000000000000000000918146359264c492bd6934071c6bd31c854edbc38116602483015260006044830181905292517f000000000000000000000000e2adcd126b4275cd75e72ff7ddc8cf7e43fc13d49091169163bc157ac191606480830192602092919082900301818787803b1580156109b957600080fd5b505af11580156109cd573d6000803e3d6000fd5b505050506040513d60208110156109e357600080fd5b505160208301519091506109f79085610ca8565b33600081815260026020526040902060010191909155610a42907f000000000000000000000000e685d21b7b0fc7a248a6a8e03b8db22d013aa2ee6001600160a01b03169083610d02565b5060019392505050565b6001600160a01b03811660009081526002602081815260408084208151606081018352815481526001820154938101939093529092015491810191909152610a9390610b54565b92915050565b600260208190526000918252604090912080546001820154919092015483565b600080546001600160a01b03163314610b0f576040805162461bcd60e51b815260206004820152601360248201527229b2b73232b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b038216610b2257600080fd5b50600180546001600160a01b0383166001600160a01b0319909116178155919050565b6001546001600160a01b031681565b6000610a938260200151610bfd6103e8610bf786600001517f00000000000000000000000043c964fea97da1ae1c07cf24b9d430f537f4dc2a6001600160a01b0316633630bcb86040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc557600080fd5b505afa158015610bd9573d6000803e3d6000fd5b505050506040513d6020811015610bef57600080fd5b505190610d59565b90610d59565b905b6000610c4183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610db2565b9392505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ca2908590610e49565b50505050565b600082820183811015610c41576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d54908490610e49565b505050565b600082610d6857506000610a93565b82820282848281610d7557fe5b0414610c415760405162461bcd60e51b81526004018080602001828103825260218152602001806110a66021913960400191505060405180910390fd5b60008184841115610e415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e06578181015183820152602001610dee565b50505050905090810190601f168015610e335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6060610e9e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610efa9092919063ffffffff16565b805190915015610d5457808060200190516020811015610ebd57600080fd5b5051610d545760405162461bcd60e51b815260040180806020018281038252602a8152602001806110c7602a913960400191505060405180910390fd5b6060610f098484600085610f11565b949350505050565b6060610f1c8561107e565b610f6d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610fac5780518252601f199092019160209182019101610f8d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461100e576040519150601f19603f3d011682016040523d82523d6000602084013e611013565b606091505b50915091508115611027579150610f099050565b8051156110375780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315610e06578181015183820152602001610dee565b3b151590565b6040518060600160405280600081526020016000815260200160008152509056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220a4c5731fdffcf5ad3b39631512954a52bca3ab840ea99c2478ec76677b9139f664736f6c63430007050033