Overview
MOVR Balance
0 MOVR
MOVR Value
$0.00More Info
Private Name Tags
ContractCreator:
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60a06040 | 4266548 | 315 days ago | IN | Create: TokenVesting | 0 MOVR | 0.00970789 |
Loading...
Loading
Contract Name:
TokenVesting
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./interfaces/IQAdmin.sol"; import "./interfaces/IQodaERC20.sol"; /** * @title TokenVesting */ contract TokenVesting is ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IQodaERC20; struct VestingSchedule { bool initialized; // beneficiary of tokens after they are released address beneficiary; // cliff period in seconds uint256 cliff; // start time of the vesting period uint256 start; // duration of the vesting period in seconds uint256 duration; // duration of a slice period for the vesting in seconds uint256 slicePeriodSeconds; // whether or not the vesting is revocable bool revocable; // total amount of tokens to be released at the end of the vesting uint256 amountTotal; // amount of tokens released uint256 released; // whether or not the vesting has been revoked bool revoked; } /// @notice Contract storing all global Qoda parameters IQAdmin private _qAdmin; /// @notice Address of underlying QODA token IQodaERC20 immutable private _qodaERC20; bytes32[] private vestingSchedulesIds; mapping(bytes32 => VestingSchedule) private vestingSchedules; uint256 private vestingSchedulesTotalAmount; mapping(address => uint256) private holdersVestingCount; event Released(uint256 amount); event Revoked(); /// @notice Modifier which checks that the caller has the `ADMIN` role modifier onlyAdmin() { require(_qAdmin.hasRole(_qAdmin.ADMIN_ROLE(), msg.sender), "TV1 only admin"); _; } /** * @dev Reverts if no vesting schedule matches the passed identifier. */ modifier onlyIfVestingScheduleExists(bytes32 vestingScheduleId) { require(vestingSchedules[vestingScheduleId].initialized == true); _; } /** * @dev Reverts if the vesting schedule does not exist or has been revoked. */ modifier onlyIfVestingScheduleNotRevoked(bytes32 vestingScheduleId) { require(vestingSchedules[vestingScheduleId].initialized == true); require(vestingSchedules[vestingScheduleId].revoked == false); _; } /** * @dev Creates a vesting contract. * @param qAdminAddress Address of `QAdmin` contract * @param qodaERC20Address Address of `QodaERC20` contract */ constructor(address qAdminAddress, address qodaERC20Address) { _qAdmin = IQAdmin(qAdminAddress); _qodaERC20 = IQodaERC20(qodaERC20Address); } receive() external payable {} fallback() external payable {} /** * @dev Returns the number of vesting schedules associated to a beneficiary. * @return the number of vesting schedules */ function getVestingSchedulesCountByBeneficiary(address _beneficiary) external view returns (uint256){ return holdersVestingCount[_beneficiary]; } /** * @dev Returns the vesting schedule id at the given index. * @return the vesting id */ function getVestingIdAtIndex(uint256 index) external view returns (bytes32){ require(index < getVestingSchedulesCount(), "TokenVesting: index out of bounds"); return vestingSchedulesIds[index]; } /** * @notice Returns the vesting schedule information for a given holder and index. * @return the vesting schedule structure information */ function getVestingScheduleByAddressAndIndex(address holder, uint256 index) external view returns (VestingSchedule memory){ return getVestingSchedule(computeVestingScheduleIdForAddressAndIndex(holder, index)); } /** * @notice Returns the total amount of vesting schedules. * @return the total amount of vesting schedules */ function getVestingSchedulesTotalAmount() external view returns (uint256){ return vestingSchedulesTotalAmount; } /// @notice Get the address of the `QAdmin` contract /// @return address Address of `QAdmin` contract function qAdmin() external view returns(address){ return address(_qAdmin); } /// @notice Get the address of the `QodaERC20` contract /// @return address Address of `QodaERC20` contract function qodaERC20() external view returns(address) { return address(_qodaERC20); } /** * @notice Creates a new vesting schedule for multiple beneficiary. * @param _beneficiaries addresses of the beneficiaries to whom vested tokens are transferred * @param _start start time of the vesting period * @param _cliff duration in seconds of the cliff in which tokens will begin to vest * @param _duration duration in seconds of the period in which the tokens will vest * @param _slicePeriodSeconds duration of a slice period for the vesting in seconds * @param _revocable whether the vesting is revocable or not * @param _amounts total amount of tokens to be released at the end of the vesting */ function createVestingSchedule( address[] memory _beneficiaries, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _slicePeriodSeconds, bool _revocable, uint256[] memory _amounts ) public onlyAdmin { require(_beneficiaries.length == _amounts.length, "TokenVesting: length mismatch between beneficiary and amount"); uint256 totalAmount = 0; for (uint i = 0; i < _amounts.length; i++) { totalAmount += _amounts[i]; } require(this.getWithdrawableAmount() >= totalAmount, "TokenVesting: cannot create vesting schedule because not sufficient tokens"); for (uint i = 0; i < _amounts.length; i++) { createVestingSchedule(_beneficiaries[i], _start, _cliff, _duration, _slicePeriodSeconds, _revocable, _amounts[i]); } } /** * @notice Creates a new vesting schedule for a beneficiary. * @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param _start start time of the vesting period * @param _cliff duration in seconds of the cliff in which tokens will begin to vest * @param _duration duration in seconds of the period in which the tokens will vest * @param _slicePeriodSeconds duration of a slice period for the vesting in seconds * @param _revocable whether the vesting is revocable or not * @param _amount total amount of tokens to be released at the end of the vesting */ function createVestingSchedule( address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _slicePeriodSeconds, bool _revocable, uint256 _amount ) public onlyAdmin { require( this.getWithdrawableAmount() >= _amount, "TokenVesting: cannot create vesting schedule because not sufficient tokens" ); require(_duration > 0, "TokenVesting: duration must be > 0"); require(_amount > 0, "TokenVesting: amount must be > 0"); require(_slicePeriodSeconds >= 1, "TokenVesting: slicePeriodSeconds must be >= 1"); bytes32 vestingScheduleId = this.computeNextVestingScheduleIdForHolder(_beneficiary); uint256 cliff = _start.add(_cliff); vestingSchedules[vestingScheduleId] = VestingSchedule( true, _beneficiary, cliff, _start, _duration, _slicePeriodSeconds, _revocable, _amount, 0, false ); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.add(_amount); vestingSchedulesIds.push(vestingScheduleId); uint256 currentVestingCount = holdersVestingCount[_beneficiary]; holdersVestingCount[_beneficiary] = currentVestingCount.add(1); } /** * @notice Revokes the vesting schedule for given identifier. * @param vestingScheduleId the vesting schedule identifier */ function revoke(bytes32 vestingScheduleId) public onlyAdmin onlyIfVestingScheduleNotRevoked(vestingScheduleId) { VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId]; require(vestingSchedule.revocable == true, "TokenVesting: vesting is not revocable"); uint256 vestedAmount = _computeReleasableAmount(vestingSchedule); if (vestedAmount > 0) { release(vestingScheduleId, vestedAmount); } uint256 unreleased = vestingSchedule.amountTotal.sub(vestingSchedule.released); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub(unreleased); vestingSchedule.revoked = true; } /** * @notice Withdraw the specified amount if possible. * @param amount the amount to withdraw */ function withdraw(uint256 amount) public nonReentrant onlyAdmin { require(this.getWithdrawableAmount() >= amount, "TokenVesting: not enough withdrawable funds"); _qodaERC20.safeTransfer(msg.sender, amount); } /** * @notice Release vested amount of tokens. * @param vestingScheduleId the vesting schedule identifier * @param amount the amount to release */ function release(bytes32 vestingScheduleId, uint256 amount) public nonReentrant onlyIfVestingScheduleNotRevoked(vestingScheduleId) { VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId]; bool isBeneficiary = msg.sender == vestingSchedule.beneficiary; require( isBeneficiary || isAdmin(msg.sender), "TokenVesting: only beneficiary and admin can release vested tokens" ); uint256 vestedAmount = _computeReleasableAmount(vestingSchedule); require(vestedAmount >= amount, "TokenVesting: cannot release tokens, not enough vested tokens"); vestingSchedule.released = vestingSchedule.released.add(amount); address payable beneficiaryPayable = payable(vestingSchedule.beneficiary); vestingSchedulesTotalAmount = vestingSchedulesTotalAmount.sub(amount); _qodaERC20.safeTransfer(beneficiaryPayable, amount); } function isAdmin(address account) public view returns (bool) { return _qAdmin.hasRole(_qAdmin.ADMIN_ROLE(), account); } /** * @dev Returns the number of vesting schedules managed by this contract. * @return the number of vesting schedules */ function getVestingSchedulesCount() public view returns (uint256){ return vestingSchedulesIds.length; } /** * @notice Computes the vested amount of tokens for the given vesting schedule identifier. * @return the vested amount */ function computeReleasableAmount(bytes32 vestingScheduleId) public onlyIfVestingScheduleNotRevoked(vestingScheduleId) view returns (uint256){ VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId]; return _computeReleasableAmount(vestingSchedule); } /** * @notice Returns the vesting schedule information for a given identifier. * @return the vesting schedule structure information */ function getVestingSchedule(bytes32 vestingScheduleId) public view returns (VestingSchedule memory){ return vestingSchedules[vestingScheduleId]; } /** * @dev Returns the amount of tokens that can be withdrawn by the admin. * @return the amount of tokens */ function getWithdrawableAmount() public view returns (uint256){ return _qodaERC20.balanceOf(address(this)).sub(vestingSchedulesTotalAmount); } /** * @dev Computes the next vesting schedule identifier for a given holder address. */ function computeNextVestingScheduleIdForHolder(address holder) public view returns (bytes32){ return computeVestingScheduleIdForAddressAndIndex(holder, holdersVestingCount[holder]); } /** * @dev Returns the last vesting schedule for a given holder address. */ function getLastVestingScheduleForHolder(address holder) public view returns (VestingSchedule memory){ return vestingSchedules[computeVestingScheduleIdForAddressAndIndex(holder, holdersVestingCount[holder] - 1)]; } /** * @dev Computes the vesting schedule identifier for an address and an index. */ function computeVestingScheduleIdForAddressAndIndex(address holder, uint256 index) public pure returns (bytes32){ return keccak256(abi.encodePacked(holder, index)); } /** * @dev Computes the releasable amount of tokens for a vesting schedule. * @return the amount of releasable tokens */ function _computeReleasableAmount(VestingSchedule memory vestingSchedule) internal view returns (uint256){ uint256 currentTime = getCurrentTime(); if ((currentTime < vestingSchedule.cliff) || vestingSchedule.revoked == true) { return 0; } else if (currentTime >= vestingSchedule.start.add(vestingSchedule.duration)) { return vestingSchedule.amountTotal.sub(vestingSchedule.released); } else { uint256 timeFromStart = currentTime.sub(vestingSchedule.start); uint secondsPerSlice = vestingSchedule.slicePeriodSeconds; uint256 vestedSlicePeriods = timeFromStart.div(secondsPerSlice); uint256 vestedSeconds = vestedSlicePeriods.mul(secondsPerSlice); uint256 vestedAmount = vestingSchedule.amountTotal.mul(vestedSeconds).div(vestingSchedule.duration); vestedAmount = vestedAmount.sub(vestingSchedule.released); return vestedAmount; } } function getCurrentTime() internal virtual view returns (uint256){ return block.timestamp; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @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 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' 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @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. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 1; } // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ 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) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { 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) { unchecked { // 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) { unchecked { 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) { unchecked { 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) { return a + b; } /** * @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 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) { return a * b; } /** * @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. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { 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) { 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) { unchecked { 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. * * 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) { unchecked { 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) { unchecked { require(b > 0, errorMessage); return a % b; } } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../libraries/QTypes.sol"; interface IQAdmin is IAccessControlUpgradeable { /// @notice Emitted when a new FixedRateMarket is deployed event CreateFixedRateMarket(address indexed marketAddress, address indexed tokenAddress, uint maturity); /// @notice Emitted when a new `Asset` is added event AddAsset( address indexed tokenAddress, bool isYieldBearing, address oracleFeed, uint collateralFactor, uint marketFactor); /// @notice Emitted when existing `Asset` is removed event RemoveAsset(address indexed tokenAddress); /// @notice Emitted when setting `_weth` event SetWETH(address wethAddress); /// @notice Emitted when setting `_qollateralManager` event SetQollateralManager(address qollateralManagerAddress); /// @notice Emitted when setting `_stakingEmissionsQontroller` event SetStakingEmissionsQontroller(address stakingEmissionsQontrollerAddress); /// @notice Emitted when setting `_tradingEmissionsQontroller` event SetTradingEmissionsQontroller(address tradingEmissionsQontrollerAddress); /// @notice Emitted when setting `_feeEmissionsQontroller` event SetFeeEmissionsQontroller(address feeEmissionsQontrollerAddress); /// @notice Emitted when setting `_veQoda` event SetVeQoda(address veQodaAddress); /// @notice Emitted when setting `_qodaLens` event SetQodaLens(address qodaLensAddress); /// @notice Emitted when setting `collateralFactor` event SetCollateralFactor(address indexed tokenAddress, uint oldValue, uint newValue); /// @notice Emitted when setting `marketFactor` event SetMarketFactor(address indexed tokenAddress, uint oldValue, uint newValue); /// @notice Emitted when setting `minQuoteSize` event SetMinQuoteSize(address indexed tokenAddress, uint oldValue, uint newValue); /// @notice Emitted when `_minCollateralRatioDefault` and `_initCollateralRatioDefault` get updated event SetCollateralRatio(uint oldMinValue, uint oldInitValue, uint newMinValue, uint newInitValue); /// @notice Emitted when `CreditFacility` gets updated event SetCreditFacility(address account, bool oldEnabled, uint oldMinValue, uint oldInitValue, uint oldCreditValue, bool newEnabled, uint newMinValue, uint newInitValue, uint newCreditValue); /// @notice Emitted when `_closeFactor` gets updated event SetCloseFactor(uint oldValue, uint newValue); /// @notice Emitted when `_repaymentGracePeriod` gets updated event SetRepaymentGracePeriod(uint oldValue, uint newValue); /// @notice Emitted when `_maturityGracePeriod` gets updated event SetMaturityGracePeriod(uint oldValue, uint newValue); /// @notice Emitted when `_liquidationIncentive` gets updated event SetLiquidationIncentive(uint oldValue, uint newValue); /// @notice Emitted when `_protocolFee` gets updated event SetProtocolFee(uint oldValue, uint newValue); /** ADMIN FUNCTIONS **/ /// @notice Call upon initialization after deploying `QAdmin` contract /// @param wethAddress Address of `WETH` contract of the network function _setWETH(address wethAddress) external; /// @notice Call upon initialization after deploying `QollateralManager` contract /// @param qollateralManagerAddress Address of `QollateralManager` deployment function _setQollateralManager(address qollateralManagerAddress) external; /// @notice Call upon initialization after deploying `StakingEmissionsQontroller` contract /// @param stakingEmissionsQontrollerAddress Address of `StakingEmissionsQontroller` deployment function _setStakingEmissionsQontroller(address stakingEmissionsQontrollerAddress) external; /// @notice Call upon initialization after deploying `TradingEmissionsQontroller` contract /// @param tradingEmissionsQontrollerAddress Address of `TradingEmissionsQontroller` deployment function _setTradingEmissionsQontroller(address tradingEmissionsQontrollerAddress) external; /// @notice Call upon initialization after deploying `FeeEmissionsQontroller` contract /// @param feeEmissionsQontrollerAddress Address of `FeeEmissionsQontroller` deployment function _setFeeEmissionsQontroller(address feeEmissionsQontrollerAddress) external; /// @notice Call upon initialization after deploying `veQoda` contract /// @param veQodaAddress Address of `veQoda` deployment function _setVeQoda(address veQodaAddress) external; /// @notice Call upon initialization after deploying `QodaLens` contract /// @param qodaLensAddress Address of `QodaLens` deployment function _setQodaLens(address qodaLensAddress) external; /// @notice Set credit facility for specified account /// @param account_ account for credit facility adjustment /// @param enabled_ If credit facility should be enabled /// @param minCollateralRatio_ New minimum collateral ratio value /// @param initCollateralRatio_ New initial collateral ratio value /// @param creditLimit_ new credit limit in USD, scaled by 1e18 function _setCreditFacility(address account_, bool enabled_, uint minCollateralRatio_, uint initCollateralRatio_, uint creditLimit_) external; /// @notice Admin function for adding new Assets. An Asset must be added before it /// can be used as collateral or borrowed. Note: We can create functionality for /// allowing borrows of a token but not using it as collateral by setting /// `collateralFactor` to zero. /// @param tokenAddress ERC20 token corresponding to the Asset /// @param isYieldBearing True if token bears interest (eg aToken, cToken, mToken, etc) /// @param underlying Address of the underlying token /// @param oracleFeed Chainlink price feed address /// @param collateralFactor 0.0 to 1.0 (scaled to 1e8) for discounting risky assets /// @param marketFactor 0.0 to 1.0 (scaled to 1e8) for premium on risky borrows function _addAsset( address tokenAddress, bool isYieldBearing, address underlying, address oracleFeed, uint collateralFactor, uint marketFactor ) external; /// @notice Admin function for removing an asset /// @param token ERC20 token corresponding to the Asset function _removeAsset(IERC20 token) external; /// @notice Adds a new `FixedRateMarket` contract into the internal mapping of /// whitelisted market addresses /// @param marketAddress New `FixedRateMarket` contract address /// @param protocolFee_ Corresponding protocol fee in basis points /// @param minQuoteSize_ Size in PV terms, local currency function _addFixedRateMarket( address marketAddress, uint protocolFee_, uint minQuoteSize_ ) external; /// @notice Update the `collateralFactor` for a given `Asset` /// @param token ERC20 token corresponding to the Asset /// @param collateralFactor 0.0 to 1.0 (scaled to 1e8) for discounting risky assets function _setCollateralFactor(IERC20 token, uint collateralFactor) external; /// @notice Update the `marketFactor` for a given `Asset` /// @param token Address of the token corresponding to the Asset /// @param marketFactor 0.0 to 1.0 (scaled to 1e8) for discounting risky assets function _setMarketFactor(IERC20 token, uint marketFactor) external; /// @notice Set the minimum quote size for a particular `FixedRateMarket` /// @param marketAddress Address of the `FixedRateMarket` contract /// @param minQuoteSize_ Size in PV terms, local currency function _setMinQuoteSize(address marketAddress, uint minQuoteSize_) external; /// @notice Set the global minimum and initial collateral ratio /// @param minCollateralRatio_ New global minimum collateral ratio value /// @param initCollateralRatio_ New global initial collateral ratio value function _setCollateralRatio(uint minCollateralRatio_, uint initCollateralRatio_) external; /// @notice Set the global close factor /// @param closeFactor_ New close factor value function _setCloseFactor(uint closeFactor_) external; /// @notice Set the global repayment grace period /// @param repaymentGracePeriod_ New repayment grace period function _setRepaymentGracePeriod(uint repaymentGracePeriod_) external; /// @notice Set the global maturity grace period /// @param maturityGracePeriod_ New maturity grace period function _setMaturityGracePeriod(uint maturityGracePeriod_) external; /// @notice Set the global liquidation incetive /// @param liquidationIncentive_ New liquidation incentive value function _setLiquidationIncentive(uint liquidationIncentive_) external; /// @notice Set the global annualized protocol fees for each market in basis points /// @param marketAddress Address of the `FixedRateMarket` contract /// @param protocolFee_ New protocol fee value (scaled to 1e4) function _setProtocolFee(address marketAddress, uint protocolFee_) external; /// @notice Set the global threshold in USD for protocol fee transfer /// @param thresholdUSD_ New threshold USD value (scaled by 1e6) function _setThresholdUSD(uint thresholdUSD_) external; /** VIEW FUNCTIONS **/ function ADMIN_ROLE() external view returns(bytes32); function MARKET_ROLE() external view returns(bytes32); function MINTER_ROLE() external view returns(bytes32); function VETOKEN_ROLE() external view returns(bytes32); /// @notice Get the address of the `WETH` contract function WETH() external view returns(address); /// @notice Get the address of the `QollateralManager` contract function qollateralManager() external view returns(address); /// @notice Get the address of the `QPriceOracle` contract function qPriceOracle() external view returns(address); /// @notice Get the address of the `StakingEmissionsQontroller` contract function stakingEmissionsQontroller() external view returns(address); /// @notice Get the address of the `TradingEmissionsQontroller` contract function tradingEmissionsQontroller() external view returns(address); /// @notice Get the address of the `FeeEmissionsQontroller` contract function feeEmissionsQontroller() external view returns(address); /// @notice Get the address of the `veQoda` contract function veQoda() external view returns(address); /// @notice Get the address of the `QodaLens` contract function qodaLens() external view returns(address); /// @notice Get the credit limit with associated address, scaled by 1e18 function creditLimit(address account_) external view returns(uint); /// @notice Gets the `Asset` mapped to the address of a ERC20 token /// @param token ERC20 token /// @return QTypes.Asset Associated `Asset` function assets(IERC20 token) external view returns(QTypes.Asset memory); /// @notice Get all enabled `Asset`s /// @return address[] iterable list of enabled `Asset`s function allAssets() external view returns(address[] memory); /// @notice Gets the `oracleFeed` associated with a ERC20 token /// @param token ERC20 token /// @return address Address of the oracle feed function oracleFeed(IERC20 token) external view returns(address); /// @notice Gets the `CollateralFactor` associated with a ERC20 token /// @param token ERC20 token /// @return uint Collateral Factor, scaled by 1e8 function collateralFactor(IERC20 token) external view returns(uint); /// @notice Gets the `MarketFactor` associated with a ERC20 token /// @param token ERC20 token /// @return uint Market Factor, scaled by 1e8 function marketFactor(IERC20 token) external view returns(uint); /// @notice Gets the `maturities` associated with a ERC20 token /// @param token ERC20 token /// @return uint[] array of UNIX timestamps (in seconds) of the maturity dates function maturities(IERC20 token) external view returns(uint[] memory); /// @notice Get the MToken market corresponding to any underlying ERC20 /// tokenAddress => mTokenAddress function underlyingToMToken(IERC20 token) external view returns(address); /// @notice Gets the address of the `FixedRateMarket` contract /// @param token ERC20 token /// @param maturity UNIX timestamp of the maturity date /// @return address Address of `FixedRateMarket` contract function fixedRateMarkets(IERC20 token, uint maturity) external view returns(address); /// @notice Check whether an address is a valid FixedRateMarket address. /// Can be used for checks for inter-contract admin/restricted function call. /// @param marketAddress Address of the `FixedRateMarket` contract /// @return bool True if valid false otherwise function isMarketEnabled(address marketAddress) external view returns(bool); function minQuoteSize(address marketAddress) external view returns(uint); function minCollateralRatio() external view returns(uint); function minCollateralRatio(address account) external view returns(uint); function initCollateralRatio() external view returns(uint); function initCollateralRatio(address account) external view returns(uint); function closeFactor() external view returns(uint); function repaymentGracePeriod() external view returns(uint); function maturityGracePeriod() external view returns(uint); function liquidationIncentive() external view returns(uint); /// @notice Annualized protocol fee in basis points, scaled by 1e4 function protocolFee(address marketAddress) external view returns(uint); /// @notice threshold in USD where protocol fee from each market will be transferred into `FeeEmissionsQontroller` /// once this amount is reached, scaled by 1e6 function thresholdUSD() external view returns(uint); /// @notice 2**256 - 1 function UINT_MAX() external pure returns(uint); /// @notice Generic mantissa corresponding to ETH decimals function MANTISSA_DEFAULT() external pure returns(uint); /// @notice Mantissa for USD function MANTISSA_USD() external pure returns(uint); /// @notice Mantissa for collateral ratio function MANTISSA_COLLATERAL_RATIO() external pure returns(uint); /// @notice `assetFactor` and `marketFactor` have up to 8 decimal places precision function MANTISSA_FACTORS() external pure returns(uint); /// @notice Basis points have 4 decimal place precision function MANTISSA_BPS() external pure returns(uint); /// @notice Staked Qoda has 6 decimal place precision function MANTISSA_STAKING() external pure returns(uint); /// @notice `collateralFactor` cannot be above 1.0 function MAX_COLLATERAL_FACTOR() external pure returns(uint); /// @notice `marketFactor` cannot be above 1.0 function MAX_MARKET_FACTOR() external pure returns(uint); /// @notice version number of this contract, will be bumped upon contractual change function VERSION_NUMBER() external pure returns(string memory); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IQodaERC20 is IERC20, IERC20Metadata { /// @notice Mints tokens to a recipient, as long as it is under the /// supply cap. Reverts if the caller does not have the minter role. /// @param recipient Account to mint tokens to /// @param amount Amount of tokens to mint function mint(address recipient, uint amount) external returns(bool); function supplyCap() external view returns(uint); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, 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"); (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.4._ */ 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.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; library QTypes { /// @notice Contains all the details of an Asset. Assets must be defined /// before they can be used as collateral. /// @member isEnabled True if an asset is defined, false otherwise /// @member isYieldBearing True if token bears interest (eg aToken, cToken, mToken, etc) /// @member underlying Address of the underlying token /// @member oracleFeed Address of the corresponding chainlink oracle feed /// @member collateralFactor 0.0 to 1.0 (scaled to 1e8) for discounting risky assets /// @member marketFactor 0.0 1.0 for premium on risky borrows /// @member maturities Iterable storage for all enabled maturities struct Asset { bool isEnabled; bool isYieldBearing; address underlying; address oracleFeed; uint collateralFactor; uint marketFactor; uint[] maturities; } /// @notice Contains all the fields of a created Quote /// @param id ID of the quote /// @param next Next quote in the list /// @param prev Previous quote in the list /// @param quoter Account of the Quoter /// @param quoteType 0 for PV+APR, 1 for FV+APR /// @param APR In decimal form scaled by 1e4 (ex. 10.52% = 1052) /// @param cashflow Can be PV or FV depending on `quoteType` /// @param filled Amount quote has got filled partially struct Quote { uint64 id; uint64 next; uint64 prev; address quoter; uint8 quoteType; uint64 APR; uint cashflow; uint filled; } /// @notice Contains all the configurations customizable to an address /// @member enabled If config for an address is enabled. When enabled is false, credit limit is infinite even if value is 0 /// @member minCollateralRatio If collateral ratio falls below `_minCollateralRatio`, it is subject to liquidation. Scaled by 1e8 /// @member initCollateralRatio When initially taking a loan, collateral ratio must be higher than this. `initCollateralRatio` should always be higher than `minCollateralRatio`. Scaled by 1e8 /// @member creditLimit Allowed limit in virtual USD for each address to do uncollateralized borrow, scaled by 1e18 struct CreditFacility { bool enabled; uint minCollateralRatio; uint initCollateralRatio; uint creditLimit; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"qAdminAddress","type":"address"},{"internalType":"address","name":"qodaERC20Address","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Released","type":"event"},{"anonymous":false,"inputs":[],"name":"Revoked","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"computeNextVestingScheduleIdForHolder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"computeReleasableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"computeVestingScheduleIdForAddressAndIndex","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"uint256","name":"_slicePeriodSeconds","type":"uint256"},{"internalType":"bool","name":"_revocable","type":"bool"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"createVestingSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_beneficiaries","type":"address[]"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_cliff","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"uint256","name":"_slicePeriodSeconds","type":"uint256"},{"internalType":"bool","name":"_revocable","type":"bool"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"createVestingSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"getLastVestingScheduleForHolder","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"slicePeriodSeconds","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct TokenVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVestingIdAtIndex","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"getVestingSchedule","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"slicePeriodSeconds","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct TokenVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getVestingScheduleByAddressAndIndex","outputs":[{"components":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"cliff","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"slicePeriodSeconds","type":"uint256"},{"internalType":"bool","name":"revocable","type":"bool"},{"internalType":"uint256","name":"amountTotal","type":"uint256"},{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"bool","name":"revoked","type":"bool"}],"internalType":"struct TokenVesting.VestingSchedule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVestingSchedulesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"getVestingSchedulesCountByBeneficiary","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVestingSchedulesTotalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWithdrawableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"qAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"qodaERC20","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"vestingScheduleId","type":"bytes32"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523480156200001157600080fd5b50604051620022363803806200223683398101604081905262000034916200007c565b6001600081905580546001600160a01b0319166001600160a01b0393841617905516608052620000b4565b80516001600160a01b03811681146200007757600080fd5b919050565b600080604083850312156200009057600080fd5b6200009b836200005f565b9150620000ab602084016200005f565b90509250929050565b608051612151620000e5600039600081816102e501528181610ba601528181611109015261128801526121516000f3fe60806040526004361061010c5760003560e01c80638af104da1161009a578063ce40130811610061578063ce4013081461031d578063ea1bb3d51461033b578063f51321d71461035b578063f7c469f01461037b578063f9079b371461039b57005b80638af104da1461026157806390be10cc146102815780639ef346b414610296578063b75c7dc6146102b6578063bf5d4332146102d657005b806337234cb5116100de57806337234cb5146101a957806348deb471146101c95780635a7bb69a146101de57806366afd8ef146102145780637e913dc61461023457005b8063130836171461011557806317e289e91461013957806324d7806c146101595780632e1a7d4d1461018957005b3661011357005b005b34801561012157600080fd5b506002545b6040519081526020015b60405180910390f35b34801561014557600080fd5b50610113610154366004611bd8565b6103bb565b34801561016557600080fd5b50610179610174366004611c3f565b610899565b6040519015158152602001610130565b34801561019557600080fd5b506101136101a4366004611c5a565b610984565b3480156101b557600080fd5b506101136101c4366004611d49565b610bd5565b3480156101d557600080fd5b50600454610126565b3480156101ea57600080fd5b506101266101f9366004611c3f565b6001600160a01b031660009081526005602052604090205490565b34801561022057600080fd5b5061011361022f366004611e40565b610e76565b34801561024057600080fd5b5061025461024f366004611c3f565b61113e565b6040516101309190611e62565b34801561026d57600080fd5b5061012661027c366004611eed565b611216565b34801561028d57600080fd5b5061012661125d565b3480156102a257600080fd5b506102546102b1366004611c5a565b6112fe565b3480156102c257600080fd5b506101136102d1366004611c5a565b6113a5565b3480156102e257600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b039091168152602001610130565b34801561032957600080fd5b506001546001600160a01b0316610305565b34801561034757600080fd5b50610126610356366004611c5a565b61163c565b34801561036757600080fd5b50610254610376366004611eed565b611726565b34801561038757600080fd5b50610126610396366004611c3f565b611742565b3480156103a757600080fd5b506101266103b6366004611c5a565b611766565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa15801561040d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104319190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190611f30565b6104bc5760405162461bcd60e51b81526004016104b390611f4d565b60405180910390fd5b80306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051f9190611f17565b101561053d5760405162461bcd60e51b81526004016104b390611f75565b600084116105985760405162461bcd60e51b815260206004820152602260248201527f546f6b656e56657374696e673a206475726174696f6e206d757374206265203e604482015261020360f41b60648201526084016104b3565b600081116105e85760405162461bcd60e51b815260206004820181905260248201527f546f6b656e56657374696e673a20616d6f756e74206d757374206265203e203060448201526064016104b3565b600183101561064f5760405162461bcd60e51b815260206004820152602d60248201527f546f6b656e56657374696e673a20736c696365506572696f645365636f6e647360448201526c206d757374206265203e3d203160981b60648201526084016104b3565b604051630f7c469f60e41b81526001600160a01b0388166004820152600090309063f7c469f090602401602060405180830381865afa158015610696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba9190611f17565b905060006106c888886117ee565b90506040518061014001604052806001151581526020018a6001600160a01b03168152602001828152602001898152602001878152602001868152602001851515815260200184815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c08201518160050160006101000a81548160ff02191690831515021790555060e0820151816006015561010082015181600701556101208201518160080160006101000a81548160ff021916908315150217905550905050610818836004546117ee90919063ffffffff16565b6004556002805460018181019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace018390556001600160a01b038a16600090815260056020526040902054906108719082906117ee565b6001600160a01b03909a16600090815260056020526040902099909955505050505050505050565b60015460408051631d6c8e3f60e21b815290516000926001600160a01b0316916391d148549183916375b238fc9160048083019260209291908290030181865afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190611f17565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b0385166024820152604401602060405180830381865afa15801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190611f30565b92915050565b600260005414156109d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b3565b600260005560015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa158015610a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a529190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190611f30565b610ad45760405162461bcd60e51b81526004016104b390611f4d565b80306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b379190611f17565b1015610b995760405162461bcd60e51b815260206004820152602b60248201527f546f6b656e56657374696e673a206e6f7420656e6f756768207769746864726160448201526a7761626c652066756e647360a81b60648201526084016104b3565b610bcd6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633836117fa565b506001600055565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb19190611f30565b610ccd5760405162461bcd60e51b81526004016104b390611f4d565b8051875114610d445760405162461bcd60e51b815260206004820152603c60248201527f546f6b656e56657374696e673a206c656e677468206d69736d6174636820626560448201527f747765656e2062656e656669636961727920616e6420616d6f756e740000000060648201526084016104b3565b6000805b8251811015610d8a57828181518110610d6357610d63611fe5565b602002602001015182610d769190612011565b915080610d8281612029565b915050610d48565b5080306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee9190611f17565b1015610e0c5760405162461bcd60e51b81526004016104b390611f75565b60005b8251811015610e6b57610e59898281518110610e2d57610e2d611fe5565b60200260200101518989898989898881518110610e4c57610e4c611fe5565b60200260200101516103bb565b80610e6381612029565b915050610e0f565b505050505050505050565b60026000541415610ec95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b3565b6002600090815582815260036020526040902054829060ff161515600114610ef057600080fd5b60008181526003602052604090206008015460ff1615610f0f57600080fd5b6000838152600360205260409020805461010090046001600160a01b031633148080610f3f5750610f3f33610899565b610fbc5760405162461bcd60e51b815260206004820152604260248201527f546f6b656e56657374696e673a206f6e6c792062656e6566696369617279206160448201527f6e642061646d696e2063616e2072656c656173652076657374656420746f6b656064820152616e7360f01b608482015260a4016104b3565b6040805161014081018252835460ff808216151583526001600160a01b03610100928390041660208401526001860154938301939093526002850154606083015260038501546080830152600485015460a083015260058501548316151560c0830152600685015460e08301526007850154908201526008840154909116151561012082015260009061104e90611851565b9050848110156110c65760405162461bcd60e51b815260206004820152603d60248201527f546f6b656e56657374696e673a2063616e6e6f742072656c6561736520746f6b60448201527f656e732c206e6f7420656e6f7567682076657374656420746f6b656e7300000060648201526084016104b3565b60078301546110d590866117ee565b600784015582546004546101009091046001600160a01b0316906110f99087611934565b6004556111306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001682886117fa565b505060016000555050505050565b611146611b3e565b6001600160a01b0382166000908152600560205260408120546003919061117590859061027c90600190612044565b81526020808201929092526040908101600020815161014081018352815460ff808216151583526001600160a01b036101009283900416958301959095526001830154938201939093526002820154606082015260038201546080820152600482015460a082015260058201548416151560c0820152600682015460e082015260078201549281019290925260080154909116151561012082015292915050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b600480546040516370a0823160e01b815230928101929092526000916112f991906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156112cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f39190611f17565b90611934565b905090565b611306611b3e565b50600090815260036020818152604092839020835161014081018552815460ff808216151583526001600160a01b0361010092839004169483019490945260018301549582019590955260028201546060820152928101546080840152600481015460a084015260058101548216151560c0840152600681015460e0840152600781015493830193909352600890920154909116151561012082015290565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa1580156113f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141b9190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114819190611f30565b61149d5760405162461bcd60e51b81526004016104b390611f4d565b600081815260036020526040902054819060ff1615156001146114bf57600080fd5b60008181526003602052604090206008015460ff16156114de57600080fd5b6000828152600360205260409020600581015460ff1615156001146115545760405162461bcd60e51b815260206004820152602660248201527f546f6b656e56657374696e673a2076657374696e67206973206e6f74207265766044820152656f6361626c6560d01b60648201526084016104b3565b6040805161014081018252825460ff808216151583526001600160a01b03610100928390041660208401526001850154938301939093526002840154606083015260038401546080830152600484015460a083015260058401548316151560c0830152600684015460e0830152600784015490820152600883015490911615156101208201526000906115e690611851565b905080156115f8576115f88482610e76565b60006116158360070154846006015461193490919063ffffffff16565b6004549091506116259082611934565b6004555050600801805460ff191660011790555050565b600081815260036020526040812054829060ff16151560011461165e57600080fd5b60008181526003602052604090206008015460ff161561167d57600080fd5b600083815260036020818152604092839020835161014081018552815460ff808216151583526001600160a01b0361010092839004169483019490945260018301549582019590955260028201546060820152928101546080840152600481015460a084015260058101548216151560c0840152600681015460e0840152600781015493830193909352600883015416151561012082015261171e90611851565b949350505050565b61172e611b3e565b61173b6102b18484611216565b9392505050565b6001600160a01b03811660009081526005602052604081205461097e908390611216565b600061177160025490565b82106117c95760405162461bcd60e51b815260206004820152602160248201527f546f6b656e56657374696e673a20696e646578206f7574206f6620626f756e646044820152607360f81b60648201526084016104b3565b600282815481106117dc576117dc611fe5565b90600052602060002001549050919050565b600061173b8284612011565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261184c908490611940565b505050565b6040810151600090429081108061186f575061012083015115156001145b1561187d5750600092915050565b60808301516060840151611890916117ee565b81106118aa5761010083015160e084015161173b91611934565b60006118c384606001518361193490919063ffffffff16565b60a085015190915060006118d78383611a12565b905060006118e58284611a1e565b9050600061190e8860800151611908848b60e00151611a1e90919063ffffffff16565b90611a12565b90506119288861010001518261193490919063ffffffff16565b98975050505050505050565b600061173b8284612044565b6000611995826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a2a9092919063ffffffff16565b80519091501561184c57808060200190518101906119b39190611f30565b61184c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104b3565b600061173b828461205b565b600061173b828461207d565b606061171e8484600085856001600160a01b0385163b611a8c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104b3565b600080866001600160a01b03168587604051611aa891906120cc565b60006040518083038185875af1925050503d8060008114611ae5576040519150601f19603f3d011682016040523d82523d6000602084013e611aea565b606091505b5091509150611afa828286611b05565b979650505050505050565b60608315611b1457508161173b565b825115611b245782518084602001fd5b8160405162461bcd60e51b81526004016104b391906120e8565b60405180610140016040528060001515815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160001515815260200160008152602001600081526020016000151581525090565b80356001600160a01b0381168114611bb757600080fd5b919050565b8015158114611bca57600080fd5b50565b8035611bb781611bbc565b600080600080600080600060e0888a031215611bf357600080fd5b611bfc88611ba0565b96506020880135955060408801359450606088013593506080880135925060a0880135611c2881611bbc565b8092505060c0880135905092959891949750929550565b600060208284031215611c5157600080fd5b61173b82611ba0565b600060208284031215611c6c57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611cb257611cb2611c73565b604052919050565b600067ffffffffffffffff821115611cd457611cd4611c73565b5060051b60200190565b600082601f830112611cef57600080fd5b81356020611d04611cff83611cba565b611c89565b82815260059290921b84018101918181019086841115611d2357600080fd5b8286015b84811015611d3e5780358352918301918301611d27565b509695505050505050565b600080600080600080600060e0888a031215611d6457600080fd5b873567ffffffffffffffff80821115611d7c57600080fd5b818a0191508a601f830112611d9057600080fd5b81356020611da0611cff83611cba565b82815260059290921b8401810191818101908e841115611dbf57600080fd5b948201945b83861015611de457611dd586611ba0565b82529482019490820190611dc4565b9b50508b013598505060408a0135965060608a0135955060808a01359450611e0e60a08b01611bcd565b935060c08a0135915080821115611e2457600080fd5b50611e318a828b01611cde565b91505092959891949750929550565b60008060408385031215611e5357600080fd5b50508035926020909101359150565b81511515815261014081016020830151611e8760208401826001600160a01b03169052565b5060408301516040830152606083015160608301526080830151608083015260a083015160a083015260c0830151611ec360c084018215159052565b5060e083810151908301526101008084015190830152610120928301511515929091019190915290565b60008060408385031215611f0057600080fd5b611f0983611ba0565b946020939093013593505050565b600060208284031215611f2957600080fd5b5051919050565b600060208284031215611f4257600080fd5b815161173b81611bbc565b6020808252600e908201526d2a2b189037b7363c9030b236b4b760911b604082015260600190565b6020808252604a908201527f546f6b656e56657374696e673a2063616e6e6f7420637265617465207665737460408201527f696e67207363686564756c652062656361757365206e6f742073756666696369606082015269656e7420746f6b656e7360b01b608082015260a00190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561202457612024611ffb565b500190565b600060001982141561203d5761203d611ffb565b5060010190565b60008282101561205657612056611ffb565b500390565b60008261207857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561209757612097611ffb565b500290565b60005b838110156120b757818101518382015260200161209f565b838111156120c6576000848401525b50505050565b600082516120de81846020870161209c565b9190910192915050565b602081526000825180602084015261210781604085016020870161209c565b601f01601f1916919091016040019291505056fea264697066735822122058e1434525f13ae836fed0133e57086d140fe63663c3efee3b42cd2f0d78ea9d64736f6c634300080a003300000000000000000000000030e2c2c7c2fcd90ba642e0563f03336b121f441b0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de
Deployed Bytecode
0x60806040526004361061010c5760003560e01c80638af104da1161009a578063ce40130811610061578063ce4013081461031d578063ea1bb3d51461033b578063f51321d71461035b578063f7c469f01461037b578063f9079b371461039b57005b80638af104da1461026157806390be10cc146102815780639ef346b414610296578063b75c7dc6146102b6578063bf5d4332146102d657005b806337234cb5116100de57806337234cb5146101a957806348deb471146101c95780635a7bb69a146101de57806366afd8ef146102145780637e913dc61461023457005b8063130836171461011557806317e289e91461013957806324d7806c146101595780632e1a7d4d1461018957005b3661011357005b005b34801561012157600080fd5b506002545b6040519081526020015b60405180910390f35b34801561014557600080fd5b50610113610154366004611bd8565b6103bb565b34801561016557600080fd5b50610179610174366004611c3f565b610899565b6040519015158152602001610130565b34801561019557600080fd5b506101136101a4366004611c5a565b610984565b3480156101b557600080fd5b506101136101c4366004611d49565b610bd5565b3480156101d557600080fd5b50600454610126565b3480156101ea57600080fd5b506101266101f9366004611c3f565b6001600160a01b031660009081526005602052604090205490565b34801561022057600080fd5b5061011361022f366004611e40565b610e76565b34801561024057600080fd5b5061025461024f366004611c3f565b61113e565b6040516101309190611e62565b34801561026d57600080fd5b5061012661027c366004611eed565b611216565b34801561028d57600080fd5b5061012661125d565b3480156102a257600080fd5b506102546102b1366004611c5a565b6112fe565b3480156102c257600080fd5b506101136102d1366004611c5a565b6113a5565b3480156102e257600080fd5b507f0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de5b6040516001600160a01b039091168152602001610130565b34801561032957600080fd5b506001546001600160a01b0316610305565b34801561034757600080fd5b50610126610356366004611c5a565b61163c565b34801561036757600080fd5b50610254610376366004611eed565b611726565b34801561038757600080fd5b50610126610396366004611c3f565b611742565b3480156103a757600080fd5b506101266103b6366004611c5a565b611766565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa15801561040d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104319190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104979190611f30565b6104bc5760405162461bcd60e51b81526004016104b390611f4d565b60405180910390fd5b80306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051f9190611f17565b101561053d5760405162461bcd60e51b81526004016104b390611f75565b600084116105985760405162461bcd60e51b815260206004820152602260248201527f546f6b656e56657374696e673a206475726174696f6e206d757374206265203e604482015261020360f41b60648201526084016104b3565b600081116105e85760405162461bcd60e51b815260206004820181905260248201527f546f6b656e56657374696e673a20616d6f756e74206d757374206265203e203060448201526064016104b3565b600183101561064f5760405162461bcd60e51b815260206004820152602d60248201527f546f6b656e56657374696e673a20736c696365506572696f645365636f6e647360448201526c206d757374206265203e3d203160981b60648201526084016104b3565b604051630f7c469f60e41b81526001600160a01b0388166004820152600090309063f7c469f090602401602060405180830381865afa158015610696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba9190611f17565b905060006106c888886117ee565b90506040518061014001604052806001151581526020018a6001600160a01b03168152602001828152602001898152602001878152602001868152602001851515815260200184815260200160008152602001600015158152506003600084815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c08201518160050160006101000a81548160ff02191690831515021790555060e0820151816006015561010082015181600701556101208201518160080160006101000a81548160ff021916908315150217905550905050610818836004546117ee90919063ffffffff16565b6004556002805460018181019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace018390556001600160a01b038a16600090815260056020526040902054906108719082906117ee565b6001600160a01b03909a16600090815260056020526040902099909955505050505050505050565b60015460408051631d6c8e3f60e21b815290516000926001600160a01b0316916391d148549183916375b238fc9160048083019260209291908290030181865afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190611f17565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b0385166024820152604401602060405180830381865afa15801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190611f30565b92915050565b600260005414156109d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b3565b600260005560015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa158015610a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a529190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190611f30565b610ad45760405162461bcd60e51b81526004016104b390611f4d565b80306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b379190611f17565b1015610b995760405162461bcd60e51b815260206004820152602b60248201527f546f6b656e56657374696e673a206e6f7420656e6f756768207769746864726160448201526a7761626c652066756e647360a81b60648201526084016104b3565b610bcd6001600160a01b037f0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de1633836117fa565b506001600055565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb19190611f30565b610ccd5760405162461bcd60e51b81526004016104b390611f4d565b8051875114610d445760405162461bcd60e51b815260206004820152603c60248201527f546f6b656e56657374696e673a206c656e677468206d69736d6174636820626560448201527f747765656e2062656e656669636961727920616e6420616d6f756e740000000060648201526084016104b3565b6000805b8251811015610d8a57828181518110610d6357610d63611fe5565b602002602001015182610d769190612011565b915080610d8281612029565b915050610d48565b5080306001600160a01b03166390be10cc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee9190611f17565b1015610e0c5760405162461bcd60e51b81526004016104b390611f75565b60005b8251811015610e6b57610e59898281518110610e2d57610e2d611fe5565b60200260200101518989898989898881518110610e4c57610e4c611fe5565b60200260200101516103bb565b80610e6381612029565b915050610e0f565b505050505050505050565b60026000541415610ec95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104b3565b6002600090815582815260036020526040902054829060ff161515600114610ef057600080fd5b60008181526003602052604090206008015460ff1615610f0f57600080fd5b6000838152600360205260409020805461010090046001600160a01b031633148080610f3f5750610f3f33610899565b610fbc5760405162461bcd60e51b815260206004820152604260248201527f546f6b656e56657374696e673a206f6e6c792062656e6566696369617279206160448201527f6e642061646d696e2063616e2072656c656173652076657374656420746f6b656064820152616e7360f01b608482015260a4016104b3565b6040805161014081018252835460ff808216151583526001600160a01b03610100928390041660208401526001860154938301939093526002850154606083015260038501546080830152600485015460a083015260058501548316151560c0830152600685015460e08301526007850154908201526008840154909116151561012082015260009061104e90611851565b9050848110156110c65760405162461bcd60e51b815260206004820152603d60248201527f546f6b656e56657374696e673a2063616e6e6f742072656c6561736520746f6b60448201527f656e732c206e6f7420656e6f7567682076657374656420746f6b656e7300000060648201526084016104b3565b60078301546110d590866117ee565b600784015582546004546101009091046001600160a01b0316906110f99087611934565b6004556111306001600160a01b037f0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de1682886117fa565b505060016000555050505050565b611146611b3e565b6001600160a01b0382166000908152600560205260408120546003919061117590859061027c90600190612044565b81526020808201929092526040908101600020815161014081018352815460ff808216151583526001600160a01b036101009283900416958301959095526001830154938201939093526002820154606082015260038201546080820152600482015460a082015260058201548416151560c0820152600682015460e082015260078201549281019290925260080154909116151561012082015292915050565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b600480546040516370a0823160e01b815230928101929092526000916112f991906001600160a01b037f0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de16906370a0823190602401602060405180830381865afa1580156112cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f39190611f17565b90611934565b905090565b611306611b3e565b50600090815260036020818152604092839020835161014081018552815460ff808216151583526001600160a01b0361010092839004169483019490945260018301549582019590955260028201546060820152928101546080840152600481015460a084015260058101548216151560c0840152600681015460e0840152600781015493830193909352600890920154909116151561012082015290565b60015460408051631d6c8e3f60e21b815290516001600160a01b03909216916391d148549183916375b238fc916004808201926020929091908290030181865afa1580156113f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141b9190611f17565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa15801561145d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114819190611f30565b61149d5760405162461bcd60e51b81526004016104b390611f4d565b600081815260036020526040902054819060ff1615156001146114bf57600080fd5b60008181526003602052604090206008015460ff16156114de57600080fd5b6000828152600360205260409020600581015460ff1615156001146115545760405162461bcd60e51b815260206004820152602660248201527f546f6b656e56657374696e673a2076657374696e67206973206e6f74207265766044820152656f6361626c6560d01b60648201526084016104b3565b6040805161014081018252825460ff808216151583526001600160a01b03610100928390041660208401526001850154938301939093526002840154606083015260038401546080830152600484015460a083015260058401548316151560c0830152600684015460e0830152600784015490820152600883015490911615156101208201526000906115e690611851565b905080156115f8576115f88482610e76565b60006116158360070154846006015461193490919063ffffffff16565b6004549091506116259082611934565b6004555050600801805460ff191660011790555050565b600081815260036020526040812054829060ff16151560011461165e57600080fd5b60008181526003602052604090206008015460ff161561167d57600080fd5b600083815260036020818152604092839020835161014081018552815460ff808216151583526001600160a01b0361010092839004169483019490945260018301549582019590955260028201546060820152928101546080840152600481015460a084015260058101548216151560c0840152600681015460e0840152600781015493830193909352600883015416151561012082015261171e90611851565b949350505050565b61172e611b3e565b61173b6102b18484611216565b9392505050565b6001600160a01b03811660009081526005602052604081205461097e908390611216565b600061177160025490565b82106117c95760405162461bcd60e51b815260206004820152602160248201527f546f6b656e56657374696e673a20696e646578206f7574206f6620626f756e646044820152607360f81b60648201526084016104b3565b600282815481106117dc576117dc611fe5565b90600052602060002001549050919050565b600061173b8284612011565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261184c908490611940565b505050565b6040810151600090429081108061186f575061012083015115156001145b1561187d5750600092915050565b60808301516060840151611890916117ee565b81106118aa5761010083015160e084015161173b91611934565b60006118c384606001518361193490919063ffffffff16565b60a085015190915060006118d78383611a12565b905060006118e58284611a1e565b9050600061190e8860800151611908848b60e00151611a1e90919063ffffffff16565b90611a12565b90506119288861010001518261193490919063ffffffff16565b98975050505050505050565b600061173b8284612044565b6000611995826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a2a9092919063ffffffff16565b80519091501561184c57808060200190518101906119b39190611f30565b61184c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104b3565b600061173b828461205b565b600061173b828461207d565b606061171e8484600085856001600160a01b0385163b611a8c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104b3565b600080866001600160a01b03168587604051611aa891906120cc565b60006040518083038185875af1925050503d8060008114611ae5576040519150601f19603f3d011682016040523d82523d6000602084013e611aea565b606091505b5091509150611afa828286611b05565b979650505050505050565b60608315611b1457508161173b565b825115611b245782518084602001fd5b8160405162461bcd60e51b81526004016104b391906120e8565b60405180610140016040528060001515815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160001515815260200160008152602001600081526020016000151581525090565b80356001600160a01b0381168114611bb757600080fd5b919050565b8015158114611bca57600080fd5b50565b8035611bb781611bbc565b600080600080600080600060e0888a031215611bf357600080fd5b611bfc88611ba0565b96506020880135955060408801359450606088013593506080880135925060a0880135611c2881611bbc565b8092505060c0880135905092959891949750929550565b600060208284031215611c5157600080fd5b61173b82611ba0565b600060208284031215611c6c57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611cb257611cb2611c73565b604052919050565b600067ffffffffffffffff821115611cd457611cd4611c73565b5060051b60200190565b600082601f830112611cef57600080fd5b81356020611d04611cff83611cba565b611c89565b82815260059290921b84018101918181019086841115611d2357600080fd5b8286015b84811015611d3e5780358352918301918301611d27565b509695505050505050565b600080600080600080600060e0888a031215611d6457600080fd5b873567ffffffffffffffff80821115611d7c57600080fd5b818a0191508a601f830112611d9057600080fd5b81356020611da0611cff83611cba565b82815260059290921b8401810191818101908e841115611dbf57600080fd5b948201945b83861015611de457611dd586611ba0565b82529482019490820190611dc4565b9b50508b013598505060408a0135965060608a0135955060808a01359450611e0e60a08b01611bcd565b935060c08a0135915080821115611e2457600080fd5b50611e318a828b01611cde565b91505092959891949750929550565b60008060408385031215611e5357600080fd5b50508035926020909101359150565b81511515815261014081016020830151611e8760208401826001600160a01b03169052565b5060408301516040830152606083015160608301526080830151608083015260a083015160a083015260c0830151611ec360c084018215159052565b5060e083810151908301526101008084015190830152610120928301511515929091019190915290565b60008060408385031215611f0057600080fd5b611f0983611ba0565b946020939093013593505050565b600060208284031215611f2957600080fd5b5051919050565b600060208284031215611f4257600080fd5b815161173b81611bbc565b6020808252600e908201526d2a2b189037b7363c9030b236b4b760911b604082015260600190565b6020808252604a908201527f546f6b656e56657374696e673a2063616e6e6f7420637265617465207665737460408201527f696e67207363686564756c652062656361757365206e6f742073756666696369606082015269656e7420746f6b656e7360b01b608082015260a00190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561202457612024611ffb565b500190565b600060001982141561203d5761203d611ffb565b5060010190565b60008282101561205657612056611ffb565b500390565b60008261207857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561209757612097611ffb565b500290565b60005b838110156120b757818101518382015260200161209f565b838111156120c6576000848401525b50505050565b600082516120de81846020870161209c565b9190910192915050565b602081526000825180602084015261210781604085016020870161209c565b601f01601f1916919091016040019291505056fea264697066735822122058e1434525f13ae836fed0133e57086d140fe63663c3efee3b42cd2f0d78ea9d64736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000030e2c2c7c2fcd90ba642e0563f03336b121f441b0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de
-----Decoded View---------------
Arg [0] : qAdminAddress (address): 0x30E2C2C7C2FCD90bA642E0563F03336B121F441B
Arg [1] : qodaERC20Address (address): 0x6f860Ca6d85989526629Ff2dd3E96581267093De
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000030e2c2c7c2fcd90ba642e0563f03336b121f441b
Arg [1] : 0000000000000000000000006f860ca6d85989526629ff2dd3e96581267093de
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 24 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
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.