Feature Tip: Add private address tag to any address under My Name Tag !
ERC-20
Overview
Max Total Supply
1,420.749290480760663251 ERC20 ***
Holders
6
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
995 ERC20 ***Value
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
SmartYield
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./lib/math/MathUtils.sol"; import "./IController.sol"; import "./ISmartYield.sol"; import "./IProvider.sol"; import "./model/IBondModel.sol"; import "./IBond.sol"; import "./JuniorToken.sol"; contract SmartYield is JuniorToken, ISmartYield { using SafeMath for uint256; uint256 public constant MAX_UINT256 = uint256(-1); uint256 public constant EXP_SCALE = 1e18; // controller address address public override controller; // address of IProviderPool address public pool; // senior BOND (NFT) address public seniorBond; // IBond // junior BOND (NFT) address public juniorBond; // IBond // underlying amount in matured and liquidated juniorBonds uint256 public underlyingLiquidatedJuniors; // tokens amount in unmatured juniorBonds or matured and unliquidated uint256 public tokensInJuniorBonds; // latest SeniorBond Id uint256 public seniorBondId; // latest JuniorBond Id uint256 public juniorBondId; // last index of juniorBondsMaturities that was liquidated uint256 public juniorBondsMaturitiesPrev; // list of junior bond maturities (timestamps) uint256[] public juniorBondsMaturities; // checkpoints for all JuniorBonds matureing at (timestamp) -> (JuniorBondsAt) // timestamp -> JuniorBondsAt mapping(uint256 => JuniorBondsAt) public juniorBondsMaturingAt; // metadata for senior bonds // bond id => bond (SeniorBond) mapping(uint256 => SeniorBond) public seniorBonds; // metadata for junior bonds // bond id => bond (JuniorBond) mapping(uint256 => JuniorBond) public juniorBonds; // pool state / average bond // holds rate of payment by juniors to seniors SeniorBond public abond; bool public _setup; // emitted when user buys junior ERC20 tokens event BuyTokens(address indexed buyer, uint256 underlyingIn, uint256 tokensOut, uint256 fee); // emitted when user sells junior ERC20 tokens and forfeits their share of the debt event SellTokens(address indexed seller, uint256 tokensIn, uint256 underlyingOut, uint256 forfeits); event BuySeniorBond(address indexed buyer, uint256 indexed seniorBondId, uint256 underlyingIn, uint256 gain, uint256 forDays); event RedeemSeniorBond(address indexed owner, uint256 indexed seniorBondId, uint256 fee); event BuyJuniorBond(address indexed buyer, uint256 indexed juniorBondId, uint256 tokensIn, uint256 maturesAt); event RedeemJuniorBond(address indexed owner, uint256 indexed juniorBondId, uint256 underlyingOut); modifier onlyControllerOrDao { require( msg.sender == controller || msg.sender == IController(controller).dao(), "PPC: only controller/DAO" ); _; } constructor( string memory name_, string memory symbol_, uint8 decimals_ ) JuniorToken(name_, symbol_, decimals_) {} function setup( address controller_, address pool_, address seniorBond_, address juniorBond_ ) external { require( false == _setup, "SY: already setup" ); controller = controller_; pool = pool_; seniorBond = seniorBond_; juniorBond = juniorBond_; _setup = true; } // externals // change the controller, only callable by old controller or dao function setController(address newController_) external override onlyControllerOrDao { controller = newController_; } // buy at least _minTokens with _underlyingAmount, before _deadline passes function buyTokens( uint256 underlyingAmount_, uint256 minTokens_, uint256 deadline_ ) external override { _beforeProviderOp(block.timestamp); require( false == IController(controller).PAUSED_BUY_JUNIOR_TOKEN(), "SY: buyTokens paused" ); require( block.timestamp <= deadline_, "SY: buyTokens deadline" ); uint256 fee = MathUtils.fractionOf(underlyingAmount_, IController(controller).FEE_BUY_JUNIOR_TOKEN()); // (underlyingAmount_ - fee) * EXP_SCALE / price() uint256 getsTokens = (underlyingAmount_.sub(fee)).mul(EXP_SCALE).div(price()); require( getsTokens >= minTokens_, "SY: buyTokens minTokens" ); // --- address buyer = msg.sender; IProvider(pool)._takeUnderlying(buyer, underlyingAmount_); IProvider(pool)._depositProvider(underlyingAmount_, fee); _mint(buyer, getsTokens); emit BuyTokens(buyer, underlyingAmount_, getsTokens, fee); } // sell _tokens for at least _minUnderlying, before _deadline and forfeit potential future gains function sellTokens( uint256 tokenAmount_, uint256 minUnderlying_, uint256 deadline_ ) external override { _beforeProviderOp(block.timestamp); require( block.timestamp <= deadline_, "SY: sellTokens deadline" ); // share of these tokens in the debt // tokenAmount_ * EXP_SCALE / totalSupply() uint256 debtShare = tokenAmount_.mul(EXP_SCALE).div(totalSupply()); // (abondDebt() * debtShare) / EXP_SCALE uint256 forfeits = abondDebt().mul(debtShare).div(EXP_SCALE); // debt share is forfeit, and only diff is returned to user // (tokenAmount_ * price()) / EXP_SCALE - forfeits uint256 toPay = tokenAmount_.mul(price()).div(EXP_SCALE).sub(forfeits); require( toPay >= minUnderlying_, "SY: sellTokens minUnderlying" ); // --- address seller = msg.sender; _burn(seller, tokenAmount_); IProvider(pool)._withdrawProvider(toPay, 0); IProvider(pool)._sendUnderlying(seller, toPay); emit SellTokens(seller, tokenAmount_, toPay, forfeits); } // Purchase a senior bond with principalAmount_ underlying for forDays_, buyer gets a bond with gain >= minGain_ or revert. deadline_ is timestamp before which tx is not rejected. // returns gain function buyBond( uint256 principalAmount_, uint256 minGain_, uint256 deadline_, uint16 forDays_ ) external override returns (uint256) { _beforeProviderOp(block.timestamp); require( false == IController(controller).PAUSED_BUY_SENIOR_BOND(), "SY: buyBond paused" ); require( block.timestamp <= deadline_, "SY: buyBond deadline" ); require( 0 < forDays_ && forDays_ <= IController(controller).BOND_LIFE_MAX(), "SY: buyBond forDays" ); uint256 gain = bondGain(principalAmount_, forDays_); require( gain >= minGain_, "SY: buyBond minGain" ); require( gain > 0, "SY: buyBond gain 0" ); require( gain < underlyingLoanable(), "SY: buyBond underlyingLoanable" ); uint256 issuedAt = block.timestamp; // --- address buyer = msg.sender; IProvider(pool)._takeUnderlying(buyer, principalAmount_); IProvider(pool)._depositProvider(principalAmount_, 0); SeniorBond memory b = SeniorBond( principalAmount_, gain, issuedAt, uint256(1 days) * uint256(forDays_) + issuedAt, false ); _mintBond(buyer, b); emit BuySeniorBond(buyer, seniorBondId, principalAmount_, gain, forDays_); return gain; } // buy an nft with tokenAmount_ jTokens, that matures at abond maturesAt function buyJuniorBond( uint256 tokenAmount_, uint256 maxMaturesAt_, uint256 deadline_ ) external override { _beforeProviderOp(block.timestamp); // 1 + abond.maturesAt / EXP_SCALE uint256 maturesAt = abond.maturesAt.div(EXP_SCALE).add(1); require( block.timestamp <= deadline_, "SY: buyJuniorBond deadline" ); require( maturesAt <= maxMaturesAt_, "SY: buyJuniorBond maxMaturesAt" ); JuniorBond memory jb = JuniorBond( tokenAmount_, maturesAt ); // --- address buyer = msg.sender; _takeTokens(buyer, tokenAmount_); _mintJuniorBond(buyer, jb); emit BuyJuniorBond(buyer, juniorBondId, tokenAmount_, maturesAt); // if abond.maturesAt is past we can liquidate, but juniorBondsMaturingAt might have already been liquidated if (block.timestamp >= maturesAt) { JuniorBondsAt memory jBondsAt = juniorBondsMaturingAt[jb.maturesAt]; if (jBondsAt.price == 0) { _liquidateJuniorsAt(jb.maturesAt); } else { // juniorBondsMaturingAt was previously liquidated, _burn(address(this), jb.tokens); // burns user's locked tokens reducing the jToken supply // underlyingLiquidatedJuniors += jb.tokens * jBondsAt.price / EXP_SCALE underlyingLiquidatedJuniors = underlyingLiquidatedJuniors.add( jb.tokens.mul(jBondsAt.price).div(EXP_SCALE) ); _unaccountJuniorBond(jb); } return this.redeemJuniorBond(juniorBondId); } } // Redeem a senior bond by it's id. Anyone can redeem but owner gets principal + gain function redeemBond( uint256 bondId_ ) external override { _beforeProviderOp(block.timestamp); require( block.timestamp >= seniorBonds[bondId_].maturesAt, "SY: redeemBond not matured" ); // bondToken.ownerOf will revert for burned tokens address payTo = IBond(seniorBond).ownerOf(bondId_); // seniorBonds[bondId_].gain + seniorBonds[bondId_].principal uint256 payAmnt = seniorBonds[bondId_].gain.add(seniorBonds[bondId_].principal); uint256 fee = MathUtils.fractionOf(seniorBonds[bondId_].gain, IController(controller).FEE_REDEEM_SENIOR_BOND()); payAmnt = payAmnt.sub(fee); // --- if (seniorBonds[bondId_].liquidated == false) { seniorBonds[bondId_].liquidated = true; _unaccountBond(seniorBonds[bondId_]); } // bondToken.burn will revert for already burned tokens IBond(seniorBond).burn(bondId_); IProvider(pool)._withdrawProvider(payAmnt, fee); IProvider(pool)._sendUnderlying(payTo, payAmnt); emit RedeemSeniorBond(payTo, bondId_, fee); } // once matured, redeem a jBond for underlying function redeemJuniorBond(uint256 jBondId_) external override { _beforeProviderOp(block.timestamp); JuniorBond memory jb = juniorBonds[jBondId_]; require( jb.maturesAt <= block.timestamp, "SY: redeemJuniorBond maturesAt" ); JuniorBondsAt memory jBondsAt = juniorBondsMaturingAt[jb.maturesAt]; // blows up if already burned address payTo = IBond(juniorBond).ownerOf(jBondId_); // jBondsAt.price * jb.tokens / EXP_SCALE uint256 payAmnt = jBondsAt.price.mul(jb.tokens).div(EXP_SCALE); // --- _burnJuniorBond(jBondId_); IProvider(pool)._withdrawProvider(payAmnt, 0); IProvider(pool)._sendUnderlying(payTo, payAmnt); underlyingLiquidatedJuniors = underlyingLiquidatedJuniors.sub(payAmnt); emit RedeemJuniorBond(payTo, jBondId_, payAmnt); } // returns the maximum theoretically possible daily rate for senior bonds, // in reality the actual rate given to a bond will always be lower due to slippage function maxBondDailyRate() external override returns (uint256) { return IBondModel(IController(controller).bondModel()).maxDailyRate( underlyingTotal(), underlyingLoanable(), IController(controller).providerRatePerDay() ); } function liquidateJuniorBonds(uint256 upUntilTimestamp_) external override { require( upUntilTimestamp_ <= block.timestamp, "SY: liquidateJuniorBonds in future" ); _beforeProviderOp(upUntilTimestamp_); } // /externals // publics // given a principal amount and a number of days, compute the guaranteed bond gain, excluding principal function bondGain(uint256 principalAmount_, uint16 forDays_) public override returns (uint256) { return IBondModel(IController(controller).bondModel()).gain( underlyingTotal(), underlyingLoanable(), IController(controller).providerRatePerDay(), principalAmount_, forDays_ ); } // jToken price * EXP_SCALE function price() public override returns (uint256) { uint256 ts = totalSupply(); // (ts == 0) ? EXP_SCALE : (underlyingJuniors() * EXP_SCALE) / ts return (ts == 0) ? EXP_SCALE : underlyingJuniors().mul(EXP_SCALE).div(ts); } function underlyingTotal() public virtual override returns(uint256) { // underlyingBalance() - underlyingLiquidatedJuniors return IProvider(pool).underlyingBalance().sub(underlyingLiquidatedJuniors); } function underlyingJuniors() public virtual override returns (uint256) { // underlyingTotal() - abond.principal - abondPaid() return underlyingTotal().sub(abond.principal).sub(abondPaid()); } function underlyingLoanable() public virtual override returns (uint256) { // underlyingTotal - abond.principal - abond.gain - queued withdrawls uint256 _underlyingTotal = underlyingTotal(); // abond.principal - abond.gain - (tokensInJuniorBonds * price() / EXP_SCALE) uint256 _lockedUnderlying = abond.principal.add(abond.gain).add( tokensInJuniorBonds.mul(price()).div(EXP_SCALE) ); if (_lockedUnderlying > _underlyingTotal) { // abond.gain and (tokensInJuniorBonds in underlying) can overlap, so there is a cases where _lockedUnderlying > _underlyingTotal return 0; } // underlyingTotal() - abond.principal - abond.gain - (tokensInJuniorBonds * price() / EXP_SCALE) return _underlyingTotal.sub(_lockedUnderlying); } function abondGain() public view override returns (uint256) { return abond.gain; } function abondPaid() public view override returns (uint256) { uint256 ts = block.timestamp * EXP_SCALE; if (ts <= abond.issuedAt || (abond.maturesAt <= abond.issuedAt)) { return 0; } uint256 duration = abond.maturesAt.sub(abond.issuedAt); uint256 paidDuration = MathUtils.min(ts.sub(abond.issuedAt), duration); // abondGain() * paidDuration / duration return abondGain().mul(paidDuration).div(duration); } function abondDebt() public view override returns (uint256) { // abondGain() - abondPaid() return abondGain().sub(abondPaid()); } // /publics // internals // liquidates junior bonds up to upUntilTimestamp_ timestamp function _beforeProviderOp(uint256 upUntilTimestamp_) internal { // this modifier will be added to the begginging of all (write) functions. // The first tx after a queued liquidation's timestamp will trigger the liquidation // reducing the jToken supply, and setting aside owed_dai for withdrawals for (uint256 i = juniorBondsMaturitiesPrev; i < juniorBondsMaturities.length; i++) { if (upUntilTimestamp_ >= juniorBondsMaturities[i]) { _liquidateJuniorsAt(juniorBondsMaturities[i]); juniorBondsMaturitiesPrev = i.add(1); } else { break; } } } function _liquidateJuniorsAt(uint256 timestamp_) internal { JuniorBondsAt storage jBondsAt = juniorBondsMaturingAt[timestamp_]; require( jBondsAt.tokens > 0, "SY: nothing to liquidate" ); require( jBondsAt.price == 0, "SY: already liquidated" ); jBondsAt.price = price(); // --- // underlyingLiquidatedJuniors += jBondsAt.tokens * jBondsAt.price / EXP_SCALE; underlyingLiquidatedJuniors = underlyingLiquidatedJuniors.add( jBondsAt.tokens.mul(jBondsAt.price).div(EXP_SCALE) ); _burn(address(this), jBondsAt.tokens); // burns Junior locked tokens reducing the jToken supply tokensInJuniorBonds = tokensInJuniorBonds.sub(jBondsAt.tokens); } // removes matured seniorBonds from being accounted in abond function unaccountBonds(uint256[] memory bondIds_) external override { uint256 currentTime = block.timestamp; for (uint256 f = 0; f < bondIds_.length; f++) { if ( currentTime >= seniorBonds[bondIds_[f]].maturesAt && seniorBonds[bondIds_[f]].liquidated == false ) { seniorBonds[bondIds_[f]].liquidated = true; _unaccountBond(seniorBonds[bondIds_[f]]); } } } function _mintBond(address to_, SeniorBond memory bond_) internal { require( seniorBondId < MAX_UINT256, "SY: _mintBond" ); seniorBondId++; seniorBonds[seniorBondId] = bond_; _accountBond(bond_); IBond(seniorBond).mint(to_, seniorBondId); } // when a new bond is added to the pool, we want: // - to average abond.maturesAt (the earliest date at which juniors can fully exit), this shortens the junior exit date compared to the date of the last active bond // - to keep the price for jTokens before a bond is bought ~equal with the price for jTokens after a bond is bought function _accountBond(SeniorBond memory b_) internal { uint256 _now = block.timestamp * EXP_SCALE; //abondDebt() + b_.gain uint256 newDebt = abondDebt().add(b_.gain); // for the very first bond or the first bond after abond maturity: abondDebt() = 0 => newMaturesAt = b.maturesAt // (abond.maturesAt * abondDebt() + b_.maturesAt * EXP_SCALE * b_.gain) / newDebt uint256 newMaturesAt = (abond.maturesAt.mul(abondDebt()).add(b_.maturesAt.mul(EXP_SCALE).mul(b_.gain))).div(newDebt); // (uint256(1) + ((abond.gain + b_.gain) * (newMaturesAt - _now)) / newDebt) uint256 newDuration = (abond.gain.add(b_.gain)).mul(newMaturesAt.sub(_now)).div(newDebt).add(1); // timestamp = timestamp - tokens * d / tokens uint256 newIssuedAt = newMaturesAt.sub(newDuration, "SY: liquidate some seniorBonds"); abond = SeniorBond( abond.principal.add(b_.principal), abond.gain.add(b_.gain), newIssuedAt, newMaturesAt, false ); } // when a bond is redeemed from the pool, we want: // - for abond.maturesAt (the earliest date at which juniors can fully exit) to remain the same as before the redeem // - to keep the price for jTokens before a bond is bought ~equal with the price for jTokens after a bond is bought function _unaccountBond(SeniorBond memory b_) internal { uint256 now_ = block.timestamp * EXP_SCALE; if ((now_ >= abond.maturesAt)) { // abond matured // abondDebt() == 0 abond = SeniorBond( abond.principal.sub(b_.principal), abond.gain - b_.gain, now_.sub(abond.maturesAt.sub(abond.issuedAt)), now_, false ); return; } // uint256(1) + (abond.gain - b_.gain) * (abond.maturesAt - now_) / abondDebt() uint256 newDuration = (abond.gain.sub(b_.gain)).mul(abond.maturesAt.sub(now_)).div(abondDebt()).add(1); // timestamp = timestamp - tokens * d / tokens uint256 newIssuedAt = abond.maturesAt.sub(newDuration, "SY: liquidate some seniorBonds"); abond = SeniorBond( abond.principal.sub(b_.principal), abond.gain.sub(b_.gain), newIssuedAt, abond.maturesAt, false ); } function _mintJuniorBond(address to_, JuniorBond memory jb_) internal { require( juniorBondId < MAX_UINT256, "SY: _mintJuniorBond" ); juniorBondId++; juniorBonds[juniorBondId] = jb_; _accountJuniorBond(jb_); IBond(juniorBond).mint(to_, juniorBondId); } function _accountJuniorBond(JuniorBond memory jb_) internal { // tokensInJuniorBonds += jb_.tokens tokensInJuniorBonds = tokensInJuniorBonds.add(jb_.tokens); JuniorBondsAt storage jBondsAt = juniorBondsMaturingAt[jb_.maturesAt]; uint256 tmp; if (jBondsAt.tokens == 0 && block.timestamp < jb_.maturesAt) { juniorBondsMaturities.push(jb_.maturesAt); for (uint256 i = juniorBondsMaturities.length - 1; i >= MathUtils.max(1, juniorBondsMaturitiesPrev); i--) { if (juniorBondsMaturities[i] > juniorBondsMaturities[i - 1]) { break; } tmp = juniorBondsMaturities[i - 1]; juniorBondsMaturities[i - 1] = juniorBondsMaturities[i]; juniorBondsMaturities[i] = tmp; } } // jBondsAt.tokens += jb_.tokens jBondsAt.tokens = jBondsAt.tokens.add(jb_.tokens); } function _burnJuniorBond(uint256 bondId_) internal { // blows up if already burned IBond(juniorBond).burn(bondId_); } function _unaccountJuniorBond(JuniorBond memory jb_) internal { // tokensInJuniorBonds -= jb_.tokens; tokensInJuniorBonds = tokensInJuniorBonds.sub(jb_.tokens); JuniorBondsAt storage jBondsAt = juniorBondsMaturingAt[jb_.maturesAt]; // jBondsAt.tokens -= jb_.tokens; jBondsAt.tokens = jBondsAt.tokens.sub(jb_.tokens); } function _takeTokens(address from_, uint256 amount_) internal { _transfer(from_, address(this), amount_); } // /internals }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; library MathUtils { using SafeMath for uint256; uint256 public constant EXP_SCALE = 1e18; function min(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x < y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x > y ? x : y; } function compound( // in wei uint256 principal, // rate is * EXP_SCALE uint256 ratePerPeriod, uint16 periods ) internal pure returns (uint256) { if (0 == ratePerPeriod) { return principal; } while (periods > 0) { // principal += principal * ratePerPeriod / EXP_SCALE; principal = principal.add(principal.mul(ratePerPeriod).div(EXP_SCALE)); periods -= 1; } return principal; } function compound2( uint256 principal, uint256 ratePerPeriod, uint16 periods ) internal pure returns (uint256) { if (0 == ratePerPeriod) { return principal; } while (periods > 0) { if (periods % 2 == 1) { //principal += principal * ratePerPeriod / EXP_SCALE; principal = principal.add(principal.mul(ratePerPeriod).div(EXP_SCALE)); periods -= 1; } else { //ratePerPeriod = ((2 * ratePerPeriod * EXP_SCALE) + (ratePerPeriod * ratePerPeriod)) / EXP_SCALE; ratePerPeriod = ((uint256(2).mul(ratePerPeriod).mul(EXP_SCALE)).add(ratePerPeriod.mul(ratePerPeriod))).div(EXP_SCALE); periods /= 2; } } return principal; } // computes a * f / EXP_SCALE function fractionOf(uint256 a, uint256 f) internal pure returns (uint256) { return a.mul(f).div(EXP_SCALE); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "./Governed.sol"; import "./IProvider.sol"; import "./ISmartYield.sol"; abstract contract IController is Governed { uint256 public constant EXP_SCALE = 1e18; address public pool; // compound provider pool address public smartYield; // smartYield address public oracle; // IYieldOracle address public bondModel; // IBondModel address public feesOwner; // fees are sent here // max accepted cost of harvest when converting COMP -> underlying, // if harvest gets less than (COMP to underlying at spot price) - HARVEST_COST%, it will revert. // if it gets more, the difference goes to the harvest caller uint256 public HARVEST_COST = 40 * 1e15; // 4% // fee for buying jTokens uint256 public FEE_BUY_JUNIOR_TOKEN = 3 * 1e15; // 0.3% // fee for redeeming a sBond uint256 public FEE_REDEEM_SENIOR_BOND = 100 * 1e15; // 10% // max rate per day for sBonds uint256 public BOND_MAX_RATE_PER_DAY = 719065000000000; // APY 30% / year // max duration of a purchased sBond uint16 public BOND_LIFE_MAX = 90; // in days bool public PAUSED_BUY_JUNIOR_TOKEN = false; bool public PAUSED_BUY_SENIOR_BOND = false; function setHarvestCost(uint256 newValue_) public onlyDao { require( HARVEST_COST < EXP_SCALE, "IController: HARVEST_COST too large" ); HARVEST_COST = newValue_; } function setBondMaxRatePerDay(uint256 newVal_) public onlyDao { BOND_MAX_RATE_PER_DAY = newVal_; } function setBondLifeMax(uint16 newVal_) public onlyDao { BOND_LIFE_MAX = newVal_; } function setFeeBuyJuniorToken(uint256 newVal_) public onlyDao { FEE_BUY_JUNIOR_TOKEN = newVal_; } function setFeeRedeemSeniorBond(uint256 newVal_) public onlyDao { FEE_REDEEM_SENIOR_BOND = newVal_; } function setPaused(bool buyJToken_, bool buySBond_) public onlyDaoOrGuardian { PAUSED_BUY_JUNIOR_TOKEN = buyJToken_; PAUSED_BUY_SENIOR_BOND = buySBond_; } function setOracle(address newVal_) public onlyDao { oracle = newVal_; } function setBondModel(address newVal_) public onlyDao { bondModel = newVal_; } function setFeesOwner(address newVal_) public onlyDao { feesOwner = newVal_; } function yieldControllTo(address newController_) public onlyDao { IProvider(pool).setController(newController_); ISmartYield(smartYield).setController(newController_); } function providerRatePerDay() external virtual returns (uint256); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; interface ISmartYield { // a senior BOND (metadata for NFT) struct SeniorBond { // amount seniors put in uint256 principal; // amount yielded at the end. total = principal + gain uint256 gain; // bond was issued at timestamp uint256 issuedAt; // bond matures at timestamp uint256 maturesAt; // was it liquidated yet bool liquidated; } // a junior BOND (metadata for NFT) struct JuniorBond { // amount of tokens (jTokens) junior put in uint256 tokens; // bond matures at timestamp uint256 maturesAt; } // a checkpoint for all JuniorBonds with same maturity date JuniorBond.maturesAt struct JuniorBondsAt { // sum of JuniorBond.tokens for JuniorBonds with the same JuniorBond.maturesAt uint256 tokens; // price at which JuniorBonds will be paid. Initially 0 -> unliquidated (price is in the future or not yet liquidated) uint256 price; } function controller() external view returns (address); function buyBond(uint256 principalAmount_, uint256 minGain_, uint256 deadline_, uint16 forDays_) external returns (uint256); function redeemBond(uint256 bondId_) external; function unaccountBonds(uint256[] memory bondIds_) external; function buyTokens(uint256 underlyingAmount_, uint256 minTokens_, uint256 deadline_) external; /** * sell all tokens instantly */ function sellTokens(uint256 tokens_, uint256 minUnderlying_, uint256 deadline_) external; function buyJuniorBond(uint256 tokenAmount_, uint256 maxMaturesAt_, uint256 deadline_) external; function redeemJuniorBond(uint256 jBondId_) external; function liquidateJuniorBonds(uint256 upUntilTimestamp_) external; /** * token purchase price */ function price() external returns (uint256); function abondPaid() external view returns (uint256); function abondDebt() external view returns (uint256); function abondGain() external view returns (uint256); /** * @notice current total underlying balance, without accruing interest */ function underlyingTotal() external returns (uint256); /** * @notice current underlying loanable, without accruing interest */ function underlyingLoanable() external returns (uint256); function underlyingJuniors() external returns (uint256); function bondGain(uint256 principalAmount_, uint16 forDays_) external returns (uint256); function maxBondDailyRate() external returns (uint256); function setController(address newController_) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; interface IProvider { function smartYield() external view returns (address); function controller() external view returns (address); function underlyingFees() external view returns (uint256); // deposit underlyingAmount_ into provider, add takeFees_ to fees function _depositProvider(uint256 underlyingAmount_, uint256 takeFees_) external; // withdraw underlyingAmount_ from provider, add takeFees_ to fees function _withdrawProvider(uint256 underlyingAmount_, uint256 takeFees_) external; function _takeUnderlying(address from_, uint256 amount_) external; function _sendUnderlying(address to_, uint256 amount_) external; function transferFees() external; // current total underlying balance as measured by the provider pool, without fees function underlyingBalance() external returns (uint256); function setController(address newController_) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; interface IBondModel { function gain(uint256 total_, uint256 loanable_, uint256 dailyRate_, uint256 principal_, uint16 forDays_) external pure returns (uint256); function maxDailyRate(uint256 total_, uint256 loanable_, uint256 dailyRate_) external pure returns (uint256); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; interface IBond is IERC721 { function smartYield() external view returns (address); function mint(address to, uint256 tokenId) external; function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; abstract contract JuniorToken is ERC20 { constructor( string memory name_, string memory symbol_, uint8 decimals_ ) ERC20(name_, symbol_) { _setupDecimals(decimals_); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; abstract contract Governed { address public dao; address public guardian; modifier onlyDao { require( dao == msg.sender, "GOV: not dao" ); _; } modifier onlyDaoOrGuardian { require( msg.sender == dao || msg.sender == guardian, "GOV: not dao/guardian" ); _; } constructor() { dao = msg.sender; guardian = msg.sender; } function setDao(address dao_) external onlyDao { dao = dao_; } function setGuardian(address guardian_) external onlyDao { guardian = guardian_; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"juniorBondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maturesAt","type":"uint256"}],"name":"BuyJuniorBond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"uint256","name":"seniorBondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gain","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"forDays","type":"uint256"}],"name":"BuySeniorBond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokensOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"BuyTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"juniorBondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingOut","type":"uint256"}],"name":"RedeemJuniorBond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"seniorBondId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"RedeemSeniorBond","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokensIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"underlyingOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"forfeits","type":"uint256"}],"name":"SellTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"EXP_SCALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_UINT256","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_setup","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"abond","outputs":[{"internalType":"uint256","name":"principal","type":"uint256"},{"internalType":"uint256","name":"gain","type":"uint256"},{"internalType":"uint256","name":"issuedAt","type":"uint256"},{"internalType":"uint256","name":"maturesAt","type":"uint256"},{"internalType":"bool","name":"liquidated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"abondDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"abondGain","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"abondPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"principalAmount_","type":"uint256"},{"internalType":"uint16","name":"forDays_","type":"uint16"}],"name":"bondGain","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"principalAmount_","type":"uint256"},{"internalType":"uint256","name":"minGain_","type":"uint256"},{"internalType":"uint256","name":"deadline_","type":"uint256"},{"internalType":"uint16","name":"forDays_","type":"uint16"}],"name":"buyBond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount_","type":"uint256"},{"internalType":"uint256","name":"maxMaturesAt_","type":"uint256"},{"internalType":"uint256","name":"deadline_","type":"uint256"}],"name":"buyJuniorBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"underlyingAmount_","type":"uint256"},{"internalType":"uint256","name":"minTokens_","type":"uint256"},{"internalType":"uint256","name":"deadline_","type":"uint256"}],"name":"buyTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"juniorBond","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"juniorBondId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"juniorBonds","outputs":[{"internalType":"uint256","name":"tokens","type":"uint256"},{"internalType":"uint256","name":"maturesAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"juniorBondsMaturingAt","outputs":[{"internalType":"uint256","name":"tokens","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"juniorBondsMaturities","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"juniorBondsMaturitiesPrev","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upUntilTimestamp_","type":"uint256"}],"name":"liquidateJuniorBonds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxBondDailyRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bondId_","type":"uint256"}],"name":"redeemBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"jBondId_","type":"uint256"}],"name":"redeemJuniorBond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount_","type":"uint256"},{"internalType":"uint256","name":"minUnderlying_","type":"uint256"},{"internalType":"uint256","name":"deadline_","type":"uint256"}],"name":"sellTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seniorBond","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"seniorBondId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"seniorBonds","outputs":[{"internalType":"uint256","name":"principal","type":"uint256"},{"internalType":"uint256","name":"gain","type":"uint256"},{"internalType":"uint256","name":"issuedAt","type":"uint256"},{"internalType":"uint256","name":"maturesAt","type":"uint256"},{"internalType":"bool","name":"liquidated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newController_","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller_","type":"address"},{"internalType":"address","name":"pool_","type":"address"},{"internalType":"address","name":"seniorBond_","type":"address"},{"internalType":"address","name":"juniorBond_","type":"address"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensInJuniorBonds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"bondIds_","type":"uint256[]"}],"name":"unaccountBonds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingJuniors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingLiquidatedJuniors","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingLoanable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162003ed538038062003ed58339810160408190526200003491620001eb565b8282828282816003908051906020019062000051929190620000a4565b50805162000067906004906020840190620000a4565b50506005805460ff191660121790555062000082816200008e565b5050505050506200026c565b6005805460ff191660ff92909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282620000dc576000855562000127565b82601f10620000f757805160ff191683800117855562000127565b8280016001018555821562000127579182015b82811115620001275782518255916020019190600101906200010a565b506200013592915062000139565b5090565b5b808211156200013557600081556001016200013a565b600082601f83011262000161578081fd5b81516001600160401b03808211156200017657fe5b6040516020601f8401601f19168201810183811183821017156200019657fe5b6040528382528584018101871015620001ad578485fd5b8492505b83831015620001d05785830181015182840182015291820191620001b1565b83831115620001e157848185840101525b5095945050505050565b60008060006060848603121562000200578283fd5b83516001600160401b038082111562000217578485fd5b620002258783880162000150565b945060208601519150808211156200023b578384fd5b506200024a8682870162000150565b925050604084015160ff8116811462000261578182fd5b809150509250925092565b613c59806200027c6000396000f3fe608060405234801561001057600080fd5b50600436106103155760003560e01c806370a08231116101a7578063a4ce25a7116100ee578063d92cc50011610097578063e823917d11610071578063e823917d146105d7578063f77c4791146105df578063f7ea4adc146105e757610315565b8063d92cc500146105a9578063dd62ed3e146105b1578063e0a18fcf146105c457610315565b8063bbba205d116100c8578063bbba205d14610591578063c6adec5d14610599578063ce846173146105a157610315565b8063a4ce25a714610558578063a9059cbb1461056b578063b642f2c01461057e57610315565b806392eefe9b11610150578063a035b1fe1161012a578063a035b1fe14610535578063a2d685e81461053d578063a457c2d71461054557610315565b806392eefe9b1461050757806395d89b411461051a57806396fe4ddc1461052257610315565b80637b3ee7fc116101815780637b3ee7fc146104e457806382b65cf5146104ec5780638c5fbd08146104f457610315565b806370a08231146104b6578063740f10a2146104c957806374972557146104d157610315565b806333a581d21161026b57806352661118116102145780635b1ae157116101ee5780635b1ae157146104885780636ed0ad9514610490578063709ef231146104a357610315565b8063526611181461044c57806354c35a3c1461046d578063557bf7621461048057610315565b80634171d79a116102455780634171d79a1461042957806345c6fe8a1461043157806350d7ede21461044457610315565b806333a581d2146103fb57806339509351146104035780633ae394971461041657610315565b806318160ddd116102cd578063244633ce116102a7578063244633ce146103d6578063313ce567146103de57806333631400146103f357610315565b806318160ddd14610397578063225a14671461039f57806323b872dd146103c357610315565b8063095ea7b3116102fe578063095ea7b31461034d57806313d5328f1461036d57806316f0115b1461038257610315565b8063042a20771461031a57806306fdde031461032f575b600080fd5b61032d6103283660046133bb565b6105ef565b005b6103376109e5565b60405161034491906134a7565b60405180910390f35b61036061035b3660046132a6565b610a7c565b604051610344919061349c565b610375610a9a565b60405161034491906139f8565b61038a610aa0565b604051610344919061346f565b610375610aaf565b6103b26103ad3660046133bb565b610ab5565b604051610344959493929190613a3f565b6103606103d1366004613266565b610ae7565b610375610b6e565b6103e6610b74565b6040516103449190613a8b565b61038a610b7d565b610375610b8c565b6103606104113660046132a6565b610b92565b61032d6104243660046132d1565b610be0565b610375610d19565b61032d61043f3660046133bb565b610d8c565b6103b2610db8565b61045f61045a3660046133bb565b610dcd565b604051610344929190613a01565b61032d61047b36600461320b565b610de6565b610375610e9e565b610375610ea4565b61032d61049e36600461340f565b611045565b61032d6104b136600461340f565b611235565b6103756104c436600461319b565b611441565b61037561145c565b6103756104df3660046133bb565b611476565b610360611497565b6103756114a0565b61045f6105023660046133bb565b6114a6565b61032d61051536600461319b565b6114bf565b6103376115ce565b61037561053036600461343a565b61162f565b6103756119c0565b610375611a00565b6103606105533660046132a6565b611a06565b61032d61056636600461340f565b611a6e565b6103606105793660046132a6565b611d26565b61032d61058c3660046133bb565b611d3a565b610375611fdc565b610375611fe8565b610375612078565b61037561207e565b6103756105bf3660046131d3565b612103565b6103756105d23660046133eb565b61212e565b61038a6122d5565b61038a6122e4565b6103756122f8565b6105f84261230d565b6000818152601060205260409020600301544210156106325760405162461bcd60e51b815260040161062990613764565b60405180910390fd5b6007546040517f6352211e0000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690636352211e9061067c9085906004016139f8565b60206040518083038186803b15801561069457600080fd5b505afa1580156106a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cc91906131b7565b6000838152601060205260408120805460019091015492935090916106f09161237d565b905060006107996010600086815260200190815260200160002060010154600560019054906101000a90046001600160a01b03166001600160a01b0316633c9e3e7f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075c57600080fd5b505afa158015610770573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079491906133d3565b6123d7565b90506107a582826123ef565b60008581526010602052604090206004015490925060ff166108285760008481526010602090815260409182902060048101805460ff1916600190811791829055845160a08101865283548152908301549381019390935260028201549383019390935260030154606082015260ff91909116151560808201526108289061244c565b6007546040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906342966c68906108719087906004016139f8565b600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50506006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063ef9f5d2791506108ee9085908590600401613a01565b600060405180830381600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e915061096b9086908690600401613483565b600060405180830381600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b5050505083836001600160a01b03167ffa51bdcf530ef35114732d8f7598a2938621008a16d9bb235a8c84fe82e4841e836040516109d791906139f8565b60405180910390a350505050565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b820191906000526020600020905b815481529060010190602001808311610a5457829003601f168201915b505050505090505b90565b6000610a90610a8961260f565b8484612613565b5060015b92915050565b60135490565b6006546001600160a01b031681565b60025490565b601060205260009081526040902080546001820154600283015460038401546004909401549293919290919060ff1685565b6000610af48484846126ff565b610b6484610b0061260f565b610b5f85604051806060016040528060288152602001613b6d602891396001600160a01b038a16600090815260016020526040812090610b3e61260f565b6001600160a01b03168152602081019190915260400160002054919061285a565b612613565b5060019392505050565b600b5481565b60055460ff1690565b6007546001600160a01b031681565b60001981565b6000610a90610b9f61260f565b84610b5f8560016000610bb061260f565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061237d565b4260005b8251811015610d145760106000848381518110610bfd57fe5b60200260200101518152602001908152602001600020600301548210158015610c54575060106000848381518110610c3157fe5b60209081029190910181015182528101919091526040016000206004015460ff16155b15610d0c57600160106000858481518110610c6b57fe5b6020026020010151815260200190815260200160002060040160006101000a81548160ff021916908315150217905550610d0c60106000858481518110610cae57fe5b6020908102919091018101518252818101929092526040908101600020815160a08101835281548152600182015493810193909352600281015491830191909152600381015460608301526004015460ff161515608082015261244c565b600101610be4565b505050565b600080610d24611fe8565b90506000610d66610d51670de0b6b3a7640000610d4b610d426119c0565b600a54906128f1565b9061294a565b601354601254610d609161237d565b9061237d565b905081811115610d7b57600092505050610a79565b610d8582826123ef565b9250505090565b42811115610dac5760405162461bcd60e51b815260040161062990613586565b610db58161230d565b50565b60125460135460145460155460165460ff1685565b600f602052600090815260409020805460019091015482565b60175460ff1615610e095760405162461bcd60e51b81526004016106299061391c565b600580546001600160a01b03958616610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909116179055600680549385167fffffffffffffffffffffffff00000000000000000000000000000000000000009485161790556007805492851692841692909217909155600880549190931691161790556017805460ff19166001179055565b600c5481565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637fd08aa86040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef457600080fd5b505afa158015610f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2c91906131b7565b6001600160a01b031663d101c82a610f42611fe8565b610f4a610d19565b600560019054906101000a90046001600160a01b03166001600160a01b03166379524b4c6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f9a57600080fd5b505af1158015610fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd291906133d3565b6040518463ffffffff1660e01b8152600401610ff093929190613a29565b60206040518083038186803b15801561100857600080fd5b505afa15801561101c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104091906133d3565b905090565b61104e4261230d565b60155460009061106d90600190610d6090670de0b6b3a764000061294a565b90508142111561108f5760405162461bcd60e51b8152600401610629906136f6565b828111156110af5760405162461bcd60e51b815260040161062990613877565b6040805180820190915284815260208101829052336110ce81876129b1565b6110d881836129bc565b600c54816001600160a01b03167f93f0f0774770973693e0c5a43673d8aef029f09f65f442397777c9af9fadc60c8886604051611116929190613a01565b60405180910390a382421061122d576020808301516000908152600f82526040908190208151808301909252805482526001015491810182905290611167576111628360200151612a8c565b6111b4565b611175308460000151612b2c565b6111a861119f670de0b6b3a7640000610d4b846020015187600001516128f190919063ffffffff16565b6009549061237d565b6009556111b483612c28565b600c546040517fb642f2c0000000000000000000000000000000000000000000000000000000008152309163b642f2c0916111f291906004016139f8565b600060405180830381600087803b15801561120c57600080fd5b505af1158015611220573d6000803e3d6000fd5b5050505050505050610d14565b505050505050565b61123e4261230d565b8042111561125e5760405162461bcd60e51b81526004016106299061372d565b600061127d61126b610aaf565b610d4b86670de0b6b3a76400006128f1565b9050600061129f670de0b6b3a7640000610d4b846112996122f8565b906128f1565b905060006112cb826112c5670de0b6b3a7640000610d4b6112be6119c0565b8b906128f1565b906123ef565b9050848110156112ed5760405162461bcd60e51b8152600401610629906138e5565b336112f88188612b2c565b6006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ef9f5d2790611344908590600090600401613a01565b600060405180830381600087803b15801561135e57600080fd5b505af1158015611372573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e91506113c19084908690600401613483565b600060405180830381600087803b1580156113db57600080fd5b505af11580156113ef573d6000803e3d6000fd5b50505050806001600160a01b03167f95ff24e35ad23e93c0738cee55f0903db5c47b23968d07627a68fe23ebd11b6d88848660405161143093929190613a29565b60405180910390a250505050505050565b6001600160a01b031660009081526020819052604090205490565b600061104061146961207e565b6012546112c59081611fe8565b600e818154811061148657600080fd5b600091825260209091200154905081565b60175460ff1681565b60095481565b6011602052600090815260409020805460019091015482565b60055461010090046001600160a01b03163314806115735750600560019054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561152657600080fd5b505afa15801561153a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155e91906131b7565b6001600160a01b0316336001600160a01b0316145b61158f5760405162461bcd60e51b815260040161062990613688565b600580546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b600061163a4261230d565b600560019054906101000a90046001600160a01b03166001600160a01b031663566a92556040518163ffffffff1660e01b815260040160206040518083038186803b15801561168857600080fd5b505afa15801561169c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c0919061337f565b156116dd5760405162461bcd60e51b8152600401610629906135e3565b824211156116fd5760405162461bcd60e51b815260040161062990613518565b8161ffff16600010801561179e5750600560019054906101000a90046001600160a01b03166001600160a01b031663b0612d696040518163ffffffff1660e01b815260040160206040518083038186803b15801561175a57600080fd5b505afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611792919061339f565b61ffff168261ffff1611155b6117ba5760405162461bcd60e51b815260040161062990613840565b60006117c6868461212e565b9050848110156117e85760405162461bcd60e51b815260040161062990613953565b600081116118085760405162461bcd60e51b815260040161062990613809565b611810610d19565b811061182e5760405162461bcd60e51b815260040161062990613651565b6006546040517fa11b4f2a000000000000000000000000000000000000000000000000000000008152429133916001600160a01b039091169063a11b4f2a9061187d9084908c90600401613483565b600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b50506006546040517fbbbf2df40000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bbbf2df491506118fb908b90600090600401613a01565b600060405180830381600087803b15801561191557600080fd5b505af1158015611929573d6000803e3d6000fd5b50506040805160a0810182528b8152602081018790529081018590526201518061ffff8916028501606082015260006080820152915061196b90508282612c5f565b600b54826001600160a01b03167f2108cac1cef8ac37dbe265869f744fd7ae754c3ed949530f24fb62a47f71b23c8b878a6040516119ab93929190613a0f565b60405180910390a35091979650505050505050565b6000806119cb610aaf565b905080156119f0576119eb81610d4b670de0b6b3a764000061129961145c565b6119fa565b670de0b6b3a76400005b91505090565b600a5481565b6000610a90611a1361260f565b84610b5f85604051806060016040528060258152602001613bff6025913960016000611a3d61260f565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061285a565b611a774261230d565b600560019054906101000a90046001600160a01b03166001600160a01b031663a2cff6836040518163ffffffff1660e01b815260040160206040518083038186803b158015611ac557600080fd5b505afa158015611ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afd919061337f565b15611b1a5760405162461bcd60e51b8152600401610629906137d2565b80421115611b3a5760405162461bcd60e51b81526004016106299061398a565b6000611b8e84600560019054906101000a90046001600160a01b03166001600160a01b0316634684129e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075c57600080fd5b90506000611bb3611b9d6119c0565b610d4b670de0b6b3a764000061129989876123ef565b905083811015611bd55760405162461bcd60e51b8152600401610629906138ae565b6006546040517fa11b4f2a00000000000000000000000000000000000000000000000000000000815233916001600160a01b03169063a11b4f2a90611c209084908a90600401613483565b600060405180830381600087803b158015611c3a57600080fd5b505af1158015611c4e573d6000803e3d6000fd5b50506006546040517fbbbf2df40000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bbbf2df49150611c9d9089908790600401613a01565b600060405180830381600087803b158015611cb757600080fd5b505af1158015611ccb573d6000803e3d6000fd5b50505050611cd98183612d32565b806001600160a01b03167f90d8b08a6c17cc6733ded05f205dd10dd0538fb7890449f561eedef38c91a6fa878486604051611d1693929190613a29565b60405180910390a2505050505050565b6000610a90611d3361260f565b84846126ff565b611d434261230d565b60008181526011602090815260409182902082518084019093528054835260010154908201819052421015611d8a5760405162461bcd60e51b81526004016106299061361a565b6020808201516000908152600f8252604080822081518083018352815481526001909101549381019390935260085490517f6352211e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690636352211e90611dfe9087906004016139f8565b60206040518083038186803b158015611e1657600080fd5b505afa158015611e2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4e91906131b7565b90506000611e79670de0b6b3a7640000610d4b866000015186602001516128f190919063ffffffff16565b9050611e8485612e22565b6006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ef9f5d2790611ed0908490600090600401613a01565b600060405180830381600087803b158015611eea57600080fd5b505af1158015611efe573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e9150611f4d9085908590600401613483565b600060405180830381600087803b158015611f6757600080fd5b505af1158015611f7b573d6000803e3d6000fd5b5050600954611f8d92509050826123ef565b60098190555084826001600160a01b03167fe34274b2ac2992188914cc9b0f4cb53202d013fc7b1996edb6b8564431f7bd5383604051611fcd91906139f8565b60405180910390a35050505050565b670de0b6b3a764000081565b6000611040600954600660009054906101000a90046001600160a01b03166001600160a01b03166359356c5c6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561204057600080fd5b505af1158015612054573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c591906133d3565b600d5481565b60145460009042670de0b6b3a76400000290811115806120a2575060145460155411155b156120b1576000915050610a79565b6014546015546000916120c491906123ef565b905060006120e96120e3601260020154856123ef90919063ffffffff16565b83612ea0565b90506120fb82610d4b83611299610a9a565b935050505090565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637fd08aa86040518163ffffffff1660e01b815260040160206040518083038186803b15801561217e57600080fd5b505afa158015612192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b691906131b7565b6001600160a01b0316634b855b346121cc611fe8565b6121d4610d19565b600560019054906101000a90046001600160a01b03166001600160a01b03166379524b4c6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561222457600080fd5b505af1158015612238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225c91906133d3565b87876040518663ffffffff1660e01b815260040161227e959493929190613a64565b60206040518083038186803b15801561229657600080fd5b505afa1580156122aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ce91906133d3565b9392505050565b6008546001600160a01b031681565b60055461010090046001600160a01b031681565b600061104061230561207e565b6112c5610a9a565b600d545b600e5481101561237957600e818154811061232857fe5b9060005260206000200154821061236c57612359600e828154811061234957fe5b9060005260206000200154612a8c565b61236481600161237d565b600d55612371565b612379565b600101612311565b5050565b6000828201838110156122ce576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006122ce670de0b6b3a7640000610d4b85856128f1565b600082821115612446576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60155442670de0b6b3a7640000029081106124f6576040805160a081019091528251601254829161247d91906123ef565b815260208481015160135403908201526014546015546040909201916124ae916124a791906123ef565b84906123ef565b81526020808201939093526000604091820152815160125591810151601355908101516014556060810151601555608001516016805460ff1916911515919091179055610db5565b600061252a6001610d606125086122f8565b601554610d4b9061251990886123ef565b6020890151601354611299916123ef565b60408051808201909152601e81527f53593a206c697175696461746520736f6d652073656e696f72426f6e64730000602082015260155491925060009161257291849061285a565b90506040518060a0016040528061259b86600001516012600001546123ef90919063ffffffff16565b81526020016125bc86602001516012600101546123ef90919063ffffffff16565b815260208082019390935260158054604080840191909152600060609384015283516012559383015160135592820151601455810151909155608001516016805460ff1916911515919091179055505050565b3390565b6001600160a01b0383166126585760405162461bcd60e51b8152600401808060200182810382526024815260200180613bdb6024913960400191505060405180910390fd5b6001600160a01b03821661269d5760405162461bcd60e51b8152600401808060200182810382526022815260200180613b046022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166127445760405162461bcd60e51b8152600401808060200182810382526025815260200180613bb66025913960400191505060405180910390fd5b6001600160a01b0382166127895760405162461bcd60e51b8152600401808060200182810382526023815260200180613abf6023913960400191505060405180910390fd5b612794838383610d14565b6127d181604051806060016040528060268152602001613b26602691396001600160a01b038616600090815260208190526040902054919061285a565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612800908261237d565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156128e95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156128ae578181015183820152602001612896565b50505050905090810190601f1680156128db5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008261290057506000610a94565b8282028284828161290d57fe5b04146122ce5760405162461bcd60e51b8152600401808060200182810382526021815260200180613b4c6021913960400191505060405180910390fd5b60008082116129a0576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816129a957fe5b049392505050565b6123798230836126ff565b600019600c54106129df5760405162461bcd60e51b81526004016106299061354f565b600c805460019081019182905560009182526011602090815260409092208351815591830151910155612a1181612eb6565b600854600c546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916340c10f1991612a5e91869190600401613483565b600060405180830381600087803b158015612a7857600080fd5b505af115801561122d573d6000803e3d6000fd5b6000818152600f602052604090208054612ab85760405162461bcd60e51b81526004016106299061379b565b600181015415612ada5760405162461bcd60e51b8152600401610629906139c1565b612ae26119c0565b600182018190558154612b079161119f91670de0b6b3a764000091610d4b91906128f1565b6009558054612b17903090612b2c565b8054600a54612b25916123ef565b600a555050565b6001600160a01b038216612b715760405162461bcd60e51b8152600401808060200182810382526021815260200180613b956021913960400191505060405180910390fd5b612b7d82600083610d14565b612bba81604051806060016040528060228152602001613ae2602291396001600160a01b038516600090815260208190526040902054919061285a565b6001600160a01b038316600090815260208190526040902055600254612be090826123ef565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b8051600a54612c36916123ef565b600a556020808201516000908152600f9091526040902081518154612c5a916123ef565b905550565b600019600b5410612c825760405162461bcd60e51b8152600401610629906136bf565b600b80546001908101918290556000918252601060209081526040928390208451815590840151918101919091559082015160028201556060820151600382015560808201516004909101805460ff1916911515919091179055612ce581613012565b600754600b546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916340c10f1991612a5e91869190600401613483565b6001600160a01b038216612d8d576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b612d9960008383610d14565b600254612da6908261237d565b6002556001600160a01b038216600090815260208190526040902054612dcc908261237d565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6008546040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906342966c6890612e6b9084906004016139f8565b600060405180830381600087803b158015612e8557600080fd5b505af1158015612e99573d6000803e3d6000fd5b5050505050565b6000818310612eaf57816122ce565b5090919050565b8051600a54612ec49161237d565b600a556020808201516000908152600f909152604081208054909190158015612ef05750826020015142105b15612ffe576020830151600e805460018101825560008290527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd019190915554600019015b612f426001600d5461318c565b8110612ffc57600e6001820381548110612f5857fe5b9060005260206000200154600e8281548110612f7057fe5b90600052602060002001541115612f8657612ffc565b600e6001820381548110612f9657fe5b90600052602060002001549150600e8181548110612fb057fe5b9060005260206000200154600e6001830381548110612fcb57fe5b906000526020600020018190555081600e8281548110612fe757fe5b60009182526020909120015560001901612f35565b505b8251825461300b9161237d565b9091555050565b6000670de0b6b3a76400004202905060006130338360200151610d606122f8565b9050600061307982610d4b6130658760200151611299670de0b6b3a76400008a606001516128f190919063ffffffff16565b610d606130706122f8565b601554906128f1565b905060006130a46001610d6085610d4b613093878a6123ef565b60208b01516013546112999161237d565b905060006130f2826040518060400160405280601e81526020017f53593a206c697175696461746520736f6d652073656e696f72426f6e647300008152508561285a9092919063ffffffff16565b90506040518060a0016040528061311b886000015160126000015461237d90919063ffffffff16565b815260200161313c886020015160126001015461237d90919063ffffffff16565b815260208082019390935260408082019590955260006060918201528151601255918101516013559283015160145582015160155550608001516016805460ff1916911515919091179055505050565b6000818311612eaf57816122ce565b6000602082840312156131ac578081fd5b81356122ce81613a99565b6000602082840312156131c8578081fd5b81516122ce81613a99565b600080604083850312156131e5578081fd5b82356131f081613a99565b9150602083013561320081613a99565b809150509250929050565b60008060008060808587031215613220578182fd5b843561322b81613a99565b9350602085013561323b81613a99565b9250604085013561324b81613a99565b9150606085013561325b81613a99565b939692955090935050565b60008060006060848603121561327a578283fd5b833561328581613a99565b9250602084013561329581613a99565b929592945050506040919091013590565b600080604083850312156132b8578182fd5b82356132c381613a99565b946020939093013593505050565b600060208083850312156132e3578182fd5b823567ffffffffffffffff808211156132fa578384fd5b818501915085601f83011261330d578384fd5b81358181111561331957fe5b8381026040518582820101818110858211171561333257fe5b604052828152858101935084860182860187018a1015613350578788fd5b8795505b83861015613372578035855260019590950194938601938601613354565b5098975050505050505050565b600060208284031215613390578081fd5b815180151581146122ce578182fd5b6000602082840312156133b0578081fd5b81516122ce81613aae565b6000602082840312156133cc578081fd5b5035919050565b6000602082840312156133e4578081fd5b5051919050565b600080604083850312156133fd578182fd5b82359150602083013561320081613aae565b600080600060608486031215613423578283fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561344f578384fd5b843593506020850135925060408501359150606085013561325b81613aae565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602080835283518082850152825b818110156134d3578581018301518582016040015282016134b7565b818111156134e45783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526014908201527f53593a20627579426f6e6420646561646c696e65000000000000000000000000604082015260600190565b60208082526013908201527f53593a205f6d696e744a756e696f72426f6e6400000000000000000000000000604082015260600190565b60208082526022908201527f53593a206c69717569646174654a756e696f72426f6e647320696e206675747560408201527f7265000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f53593a20627579426f6e64207061757365640000000000000000000000000000604082015260600190565b6020808252601e908201527f53593a2072656465656d4a756e696f72426f6e64206d61747572657341740000604082015260600190565b6020808252601e908201527f53593a20627579426f6e6420756e6465726c79696e674c6f616e61626c650000604082015260600190565b60208082526018908201527f5050433a206f6e6c7920636f6e74726f6c6c65722f44414f0000000000000000604082015260600190565b6020808252600d908201527f53593a205f6d696e74426f6e6400000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f53593a206275794a756e696f72426f6e6420646561646c696e65000000000000604082015260600190565b60208082526017908201527f53593a2073656c6c546f6b656e7320646561646c696e65000000000000000000604082015260600190565b6020808252601a908201527f53593a2072656465656d426f6e64206e6f74206d617475726564000000000000604082015260600190565b60208082526018908201527f53593a206e6f7468696e6720746f206c69717569646174650000000000000000604082015260600190565b60208082526014908201527f53593a20627579546f6b656e7320706175736564000000000000000000000000604082015260600190565b60208082526012908201527f53593a20627579426f6e64206761696e20300000000000000000000000000000604082015260600190565b60208082526013908201527f53593a20627579426f6e6420666f724461797300000000000000000000000000604082015260600190565b6020808252601e908201527f53593a206275794a756e696f72426f6e64206d61784d61747572657341740000604082015260600190565b60208082526017908201527f53593a20627579546f6b656e73206d696e546f6b656e73000000000000000000604082015260600190565b6020808252601c908201527f53593a2073656c6c546f6b656e73206d696e556e6465726c79696e6700000000604082015260600190565b60208082526011908201527f53593a20616c7265616479207365747570000000000000000000000000000000604082015260600190565b60208082526013908201527f53593a20627579426f6e64206d696e4761696e00000000000000000000000000604082015260600190565b60208082526016908201527f53593a20627579546f6b656e7320646561646c696e6500000000000000000000604082015260600190565b60208082526016908201527f53593a20616c7265616479206c69717569646174656400000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b928352602083019190915261ffff16604082015260600190565b9283526020830191909152604082015260600190565b9485526020850193909352604084019190915260608301521515608082015260a00190565b94855260208501939093526040840191909152606083015261ffff16608082015260a00190565b60ff91909116815260200190565b6001600160a01b0381168114610db557600080fd5b61ffff81168114610db557600080fdfe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220937a9baa48095cad1ee2a7353c22198c42e02265c6c4118419b6a26d027a317664736f6c63430007060033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000164261726e427269646765206a756e696f72206344414900000000000000000000000000000000000000000000000000000000000000000000000000000000000762625f6344414900000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103155760003560e01c806370a08231116101a7578063a4ce25a7116100ee578063d92cc50011610097578063e823917d11610071578063e823917d146105d7578063f77c4791146105df578063f7ea4adc146105e757610315565b8063d92cc500146105a9578063dd62ed3e146105b1578063e0a18fcf146105c457610315565b8063bbba205d116100c8578063bbba205d14610591578063c6adec5d14610599578063ce846173146105a157610315565b8063a4ce25a714610558578063a9059cbb1461056b578063b642f2c01461057e57610315565b806392eefe9b11610150578063a035b1fe1161012a578063a035b1fe14610535578063a2d685e81461053d578063a457c2d71461054557610315565b806392eefe9b1461050757806395d89b411461051a57806396fe4ddc1461052257610315565b80637b3ee7fc116101815780637b3ee7fc146104e457806382b65cf5146104ec5780638c5fbd08146104f457610315565b806370a08231146104b6578063740f10a2146104c957806374972557146104d157610315565b806333a581d21161026b57806352661118116102145780635b1ae157116101ee5780635b1ae157146104885780636ed0ad9514610490578063709ef231146104a357610315565b8063526611181461044c57806354c35a3c1461046d578063557bf7621461048057610315565b80634171d79a116102455780634171d79a1461042957806345c6fe8a1461043157806350d7ede21461044457610315565b806333a581d2146103fb57806339509351146104035780633ae394971461041657610315565b806318160ddd116102cd578063244633ce116102a7578063244633ce146103d6578063313ce567146103de57806333631400146103f357610315565b806318160ddd14610397578063225a14671461039f57806323b872dd146103c357610315565b8063095ea7b3116102fe578063095ea7b31461034d57806313d5328f1461036d57806316f0115b1461038257610315565b8063042a20771461031a57806306fdde031461032f575b600080fd5b61032d6103283660046133bb565b6105ef565b005b6103376109e5565b60405161034491906134a7565b60405180910390f35b61036061035b3660046132a6565b610a7c565b604051610344919061349c565b610375610a9a565b60405161034491906139f8565b61038a610aa0565b604051610344919061346f565b610375610aaf565b6103b26103ad3660046133bb565b610ab5565b604051610344959493929190613a3f565b6103606103d1366004613266565b610ae7565b610375610b6e565b6103e6610b74565b6040516103449190613a8b565b61038a610b7d565b610375610b8c565b6103606104113660046132a6565b610b92565b61032d6104243660046132d1565b610be0565b610375610d19565b61032d61043f3660046133bb565b610d8c565b6103b2610db8565b61045f61045a3660046133bb565b610dcd565b604051610344929190613a01565b61032d61047b36600461320b565b610de6565b610375610e9e565b610375610ea4565b61032d61049e36600461340f565b611045565b61032d6104b136600461340f565b611235565b6103756104c436600461319b565b611441565b61037561145c565b6103756104df3660046133bb565b611476565b610360611497565b6103756114a0565b61045f6105023660046133bb565b6114a6565b61032d61051536600461319b565b6114bf565b6103376115ce565b61037561053036600461343a565b61162f565b6103756119c0565b610375611a00565b6103606105533660046132a6565b611a06565b61032d61056636600461340f565b611a6e565b6103606105793660046132a6565b611d26565b61032d61058c3660046133bb565b611d3a565b610375611fdc565b610375611fe8565b610375612078565b61037561207e565b6103756105bf3660046131d3565b612103565b6103756105d23660046133eb565b61212e565b61038a6122d5565b61038a6122e4565b6103756122f8565b6105f84261230d565b6000818152601060205260409020600301544210156106325760405162461bcd60e51b815260040161062990613764565b60405180910390fd5b6007546040517f6352211e0000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690636352211e9061067c9085906004016139f8565b60206040518083038186803b15801561069457600080fd5b505afa1580156106a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cc91906131b7565b6000838152601060205260408120805460019091015492935090916106f09161237d565b905060006107996010600086815260200190815260200160002060010154600560019054906101000a90046001600160a01b03166001600160a01b0316633c9e3e7f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075c57600080fd5b505afa158015610770573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079491906133d3565b6123d7565b90506107a582826123ef565b60008581526010602052604090206004015490925060ff166108285760008481526010602090815260409182902060048101805460ff1916600190811791829055845160a08101865283548152908301549381019390935260028201549383019390935260030154606082015260ff91909116151560808201526108289061244c565b6007546040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906342966c68906108719087906004016139f8565b600060405180830381600087803b15801561088b57600080fd5b505af115801561089f573d6000803e3d6000fd5b50506006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063ef9f5d2791506108ee9085908590600401613a01565b600060405180830381600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e915061096b9086908690600401613483565b600060405180830381600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b5050505083836001600160a01b03167ffa51bdcf530ef35114732d8f7598a2938621008a16d9bb235a8c84fe82e4841e836040516109d791906139f8565b60405180910390a350505050565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b820191906000526020600020905b815481529060010190602001808311610a5457829003601f168201915b505050505090505b90565b6000610a90610a8961260f565b8484612613565b5060015b92915050565b60135490565b6006546001600160a01b031681565b60025490565b601060205260009081526040902080546001820154600283015460038401546004909401549293919290919060ff1685565b6000610af48484846126ff565b610b6484610b0061260f565b610b5f85604051806060016040528060288152602001613b6d602891396001600160a01b038a16600090815260016020526040812090610b3e61260f565b6001600160a01b03168152602081019190915260400160002054919061285a565b612613565b5060019392505050565b600b5481565b60055460ff1690565b6007546001600160a01b031681565b60001981565b6000610a90610b9f61260f565b84610b5f8560016000610bb061260f565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061237d565b4260005b8251811015610d145760106000848381518110610bfd57fe5b60200260200101518152602001908152602001600020600301548210158015610c54575060106000848381518110610c3157fe5b60209081029190910181015182528101919091526040016000206004015460ff16155b15610d0c57600160106000858481518110610c6b57fe5b6020026020010151815260200190815260200160002060040160006101000a81548160ff021916908315150217905550610d0c60106000858481518110610cae57fe5b6020908102919091018101518252818101929092526040908101600020815160a08101835281548152600182015493810193909352600281015491830191909152600381015460608301526004015460ff161515608082015261244c565b600101610be4565b505050565b600080610d24611fe8565b90506000610d66610d51670de0b6b3a7640000610d4b610d426119c0565b600a54906128f1565b9061294a565b601354601254610d609161237d565b9061237d565b905081811115610d7b57600092505050610a79565b610d8582826123ef565b9250505090565b42811115610dac5760405162461bcd60e51b815260040161062990613586565b610db58161230d565b50565b60125460135460145460155460165460ff1685565b600f602052600090815260409020805460019091015482565b60175460ff1615610e095760405162461bcd60e51b81526004016106299061391c565b600580546001600160a01b03958616610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909116179055600680549385167fffffffffffffffffffffffff00000000000000000000000000000000000000009485161790556007805492851692841692909217909155600880549190931691161790556017805460ff19166001179055565b600c5481565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637fd08aa86040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef457600080fd5b505afa158015610f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2c91906131b7565b6001600160a01b031663d101c82a610f42611fe8565b610f4a610d19565b600560019054906101000a90046001600160a01b03166001600160a01b03166379524b4c6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f9a57600080fd5b505af1158015610fae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd291906133d3565b6040518463ffffffff1660e01b8152600401610ff093929190613a29565b60206040518083038186803b15801561100857600080fd5b505afa15801561101c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104091906133d3565b905090565b61104e4261230d565b60155460009061106d90600190610d6090670de0b6b3a764000061294a565b90508142111561108f5760405162461bcd60e51b8152600401610629906136f6565b828111156110af5760405162461bcd60e51b815260040161062990613877565b6040805180820190915284815260208101829052336110ce81876129b1565b6110d881836129bc565b600c54816001600160a01b03167f93f0f0774770973693e0c5a43673d8aef029f09f65f442397777c9af9fadc60c8886604051611116929190613a01565b60405180910390a382421061122d576020808301516000908152600f82526040908190208151808301909252805482526001015491810182905290611167576111628360200151612a8c565b6111b4565b611175308460000151612b2c565b6111a861119f670de0b6b3a7640000610d4b846020015187600001516128f190919063ffffffff16565b6009549061237d565b6009556111b483612c28565b600c546040517fb642f2c0000000000000000000000000000000000000000000000000000000008152309163b642f2c0916111f291906004016139f8565b600060405180830381600087803b15801561120c57600080fd5b505af1158015611220573d6000803e3d6000fd5b5050505050505050610d14565b505050505050565b61123e4261230d565b8042111561125e5760405162461bcd60e51b81526004016106299061372d565b600061127d61126b610aaf565b610d4b86670de0b6b3a76400006128f1565b9050600061129f670de0b6b3a7640000610d4b846112996122f8565b906128f1565b905060006112cb826112c5670de0b6b3a7640000610d4b6112be6119c0565b8b906128f1565b906123ef565b9050848110156112ed5760405162461bcd60e51b8152600401610629906138e5565b336112f88188612b2c565b6006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ef9f5d2790611344908590600090600401613a01565b600060405180830381600087803b15801561135e57600080fd5b505af1158015611372573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e91506113c19084908690600401613483565b600060405180830381600087803b1580156113db57600080fd5b505af11580156113ef573d6000803e3d6000fd5b50505050806001600160a01b03167f95ff24e35ad23e93c0738cee55f0903db5c47b23968d07627a68fe23ebd11b6d88848660405161143093929190613a29565b60405180910390a250505050505050565b6001600160a01b031660009081526020819052604090205490565b600061104061146961207e565b6012546112c59081611fe8565b600e818154811061148657600080fd5b600091825260209091200154905081565b60175460ff1681565b60095481565b6011602052600090815260409020805460019091015482565b60055461010090046001600160a01b03163314806115735750600560019054906101000a90046001600160a01b03166001600160a01b0316634162169f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561152657600080fd5b505afa15801561153a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155e91906131b7565b6001600160a01b0316336001600160a01b0316145b61158f5760405162461bcd60e51b815260040161062990613688565b600580546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a715780601f10610a4657610100808354040283529160200191610a71565b600061163a4261230d565b600560019054906101000a90046001600160a01b03166001600160a01b031663566a92556040518163ffffffff1660e01b815260040160206040518083038186803b15801561168857600080fd5b505afa15801561169c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c0919061337f565b156116dd5760405162461bcd60e51b8152600401610629906135e3565b824211156116fd5760405162461bcd60e51b815260040161062990613518565b8161ffff16600010801561179e5750600560019054906101000a90046001600160a01b03166001600160a01b031663b0612d696040518163ffffffff1660e01b815260040160206040518083038186803b15801561175a57600080fd5b505afa15801561176e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611792919061339f565b61ffff168261ffff1611155b6117ba5760405162461bcd60e51b815260040161062990613840565b60006117c6868461212e565b9050848110156117e85760405162461bcd60e51b815260040161062990613953565b600081116118085760405162461bcd60e51b815260040161062990613809565b611810610d19565b811061182e5760405162461bcd60e51b815260040161062990613651565b6006546040517fa11b4f2a000000000000000000000000000000000000000000000000000000008152429133916001600160a01b039091169063a11b4f2a9061187d9084908c90600401613483565b600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b50506006546040517fbbbf2df40000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bbbf2df491506118fb908b90600090600401613a01565b600060405180830381600087803b15801561191557600080fd5b505af1158015611929573d6000803e3d6000fd5b50506040805160a0810182528b8152602081018790529081018590526201518061ffff8916028501606082015260006080820152915061196b90508282612c5f565b600b54826001600160a01b03167f2108cac1cef8ac37dbe265869f744fd7ae754c3ed949530f24fb62a47f71b23c8b878a6040516119ab93929190613a0f565b60405180910390a35091979650505050505050565b6000806119cb610aaf565b905080156119f0576119eb81610d4b670de0b6b3a764000061129961145c565b6119fa565b670de0b6b3a76400005b91505090565b600a5481565b6000610a90611a1361260f565b84610b5f85604051806060016040528060258152602001613bff6025913960016000611a3d61260f565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061285a565b611a774261230d565b600560019054906101000a90046001600160a01b03166001600160a01b031663a2cff6836040518163ffffffff1660e01b815260040160206040518083038186803b158015611ac557600080fd5b505afa158015611ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afd919061337f565b15611b1a5760405162461bcd60e51b8152600401610629906137d2565b80421115611b3a5760405162461bcd60e51b81526004016106299061398a565b6000611b8e84600560019054906101000a90046001600160a01b03166001600160a01b0316634684129e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075c57600080fd5b90506000611bb3611b9d6119c0565b610d4b670de0b6b3a764000061129989876123ef565b905083811015611bd55760405162461bcd60e51b8152600401610629906138ae565b6006546040517fa11b4f2a00000000000000000000000000000000000000000000000000000000815233916001600160a01b03169063a11b4f2a90611c209084908a90600401613483565b600060405180830381600087803b158015611c3a57600080fd5b505af1158015611c4e573d6000803e3d6000fd5b50506006546040517fbbbf2df40000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063bbbf2df49150611c9d9089908790600401613a01565b600060405180830381600087803b158015611cb757600080fd5b505af1158015611ccb573d6000803e3d6000fd5b50505050611cd98183612d32565b806001600160a01b03167f90d8b08a6c17cc6733ded05f205dd10dd0538fb7890449f561eedef38c91a6fa878486604051611d1693929190613a29565b60405180910390a2505050505050565b6000610a90611d3361260f565b84846126ff565b611d434261230d565b60008181526011602090815260409182902082518084019093528054835260010154908201819052421015611d8a5760405162461bcd60e51b81526004016106299061361a565b6020808201516000908152600f8252604080822081518083018352815481526001909101549381019390935260085490517f6352211e0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690636352211e90611dfe9087906004016139f8565b60206040518083038186803b158015611e1657600080fd5b505afa158015611e2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4e91906131b7565b90506000611e79670de0b6b3a7640000610d4b866000015186602001516128f190919063ffffffff16565b9050611e8485612e22565b6006546040517fef9f5d270000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063ef9f5d2790611ed0908490600090600401613a01565b600060405180830381600087803b158015611eea57600080fd5b505af1158015611efe573d6000803e3d6000fd5b50506006546040517ff147a80e0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116925063f147a80e9150611f4d9085908590600401613483565b600060405180830381600087803b158015611f6757600080fd5b505af1158015611f7b573d6000803e3d6000fd5b5050600954611f8d92509050826123ef565b60098190555084826001600160a01b03167fe34274b2ac2992188914cc9b0f4cb53202d013fc7b1996edb6b8564431f7bd5383604051611fcd91906139f8565b60405180910390a35050505050565b670de0b6b3a764000081565b6000611040600954600660009054906101000a90046001600160a01b03166001600160a01b03166359356c5c6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561204057600080fd5b505af1158015612054573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c591906133d3565b600d5481565b60145460009042670de0b6b3a76400000290811115806120a2575060145460155411155b156120b1576000915050610a79565b6014546015546000916120c491906123ef565b905060006120e96120e3601260020154856123ef90919063ffffffff16565b83612ea0565b90506120fb82610d4b83611299610a9a565b935050505090565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000600560019054906101000a90046001600160a01b03166001600160a01b0316637fd08aa86040518163ffffffff1660e01b815260040160206040518083038186803b15801561217e57600080fd5b505afa158015612192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b691906131b7565b6001600160a01b0316634b855b346121cc611fe8565b6121d4610d19565b600560019054906101000a90046001600160a01b03166001600160a01b03166379524b4c6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561222457600080fd5b505af1158015612238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061225c91906133d3565b87876040518663ffffffff1660e01b815260040161227e959493929190613a64565b60206040518083038186803b15801561229657600080fd5b505afa1580156122aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122ce91906133d3565b9392505050565b6008546001600160a01b031681565b60055461010090046001600160a01b031681565b600061104061230561207e565b6112c5610a9a565b600d545b600e5481101561237957600e818154811061232857fe5b9060005260206000200154821061236c57612359600e828154811061234957fe5b9060005260206000200154612a8c565b61236481600161237d565b600d55612371565b612379565b600101612311565b5050565b6000828201838110156122ce576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006122ce670de0b6b3a7640000610d4b85856128f1565b600082821115612446576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60155442670de0b6b3a7640000029081106124f6576040805160a081019091528251601254829161247d91906123ef565b815260208481015160135403908201526014546015546040909201916124ae916124a791906123ef565b84906123ef565b81526020808201939093526000604091820152815160125591810151601355908101516014556060810151601555608001516016805460ff1916911515919091179055610db5565b600061252a6001610d606125086122f8565b601554610d4b9061251990886123ef565b6020890151601354611299916123ef565b60408051808201909152601e81527f53593a206c697175696461746520736f6d652073656e696f72426f6e64730000602082015260155491925060009161257291849061285a565b90506040518060a0016040528061259b86600001516012600001546123ef90919063ffffffff16565b81526020016125bc86602001516012600101546123ef90919063ffffffff16565b815260208082019390935260158054604080840191909152600060609384015283516012559383015160135592820151601455810151909155608001516016805460ff1916911515919091179055505050565b3390565b6001600160a01b0383166126585760405162461bcd60e51b8152600401808060200182810382526024815260200180613bdb6024913960400191505060405180910390fd5b6001600160a01b03821661269d5760405162461bcd60e51b8152600401808060200182810382526022815260200180613b046022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166127445760405162461bcd60e51b8152600401808060200182810382526025815260200180613bb66025913960400191505060405180910390fd5b6001600160a01b0382166127895760405162461bcd60e51b8152600401808060200182810382526023815260200180613abf6023913960400191505060405180910390fd5b612794838383610d14565b6127d181604051806060016040528060268152602001613b26602691396001600160a01b038616600090815260208190526040902054919061285a565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612800908261237d565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156128e95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156128ae578181015183820152602001612896565b50505050905090810190601f1680156128db5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008261290057506000610a94565b8282028284828161290d57fe5b04146122ce5760405162461bcd60e51b8152600401808060200182810382526021815260200180613b4c6021913960400191505060405180910390fd5b60008082116129a0576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816129a957fe5b049392505050565b6123798230836126ff565b600019600c54106129df5760405162461bcd60e51b81526004016106299061354f565b600c805460019081019182905560009182526011602090815260409092208351815591830151910155612a1181612eb6565b600854600c546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916340c10f1991612a5e91869190600401613483565b600060405180830381600087803b158015612a7857600080fd5b505af115801561122d573d6000803e3d6000fd5b6000818152600f602052604090208054612ab85760405162461bcd60e51b81526004016106299061379b565b600181015415612ada5760405162461bcd60e51b8152600401610629906139c1565b612ae26119c0565b600182018190558154612b079161119f91670de0b6b3a764000091610d4b91906128f1565b6009558054612b17903090612b2c565b8054600a54612b25916123ef565b600a555050565b6001600160a01b038216612b715760405162461bcd60e51b8152600401808060200182810382526021815260200180613b956021913960400191505060405180910390fd5b612b7d82600083610d14565b612bba81604051806060016040528060228152602001613ae2602291396001600160a01b038516600090815260208190526040902054919061285a565b6001600160a01b038316600090815260208190526040902055600254612be090826123ef565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b8051600a54612c36916123ef565b600a556020808201516000908152600f9091526040902081518154612c5a916123ef565b905550565b600019600b5410612c825760405162461bcd60e51b8152600401610629906136bf565b600b80546001908101918290556000918252601060209081526040928390208451815590840151918101919091559082015160028201556060820151600382015560808201516004909101805460ff1916911515919091179055612ce581613012565b600754600b546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03909216916340c10f1991612a5e91869190600401613483565b6001600160a01b038216612d8d576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b612d9960008383610d14565b600254612da6908261237d565b6002556001600160a01b038216600090815260208190526040902054612dcc908261237d565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6008546040517f42966c680000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906342966c6890612e6b9084906004016139f8565b600060405180830381600087803b158015612e8557600080fd5b505af1158015612e99573d6000803e3d6000fd5b5050505050565b6000818310612eaf57816122ce565b5090919050565b8051600a54612ec49161237d565b600a556020808201516000908152600f909152604081208054909190158015612ef05750826020015142105b15612ffe576020830151600e805460018101825560008290527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd019190915554600019015b612f426001600d5461318c565b8110612ffc57600e6001820381548110612f5857fe5b9060005260206000200154600e8281548110612f7057fe5b90600052602060002001541115612f8657612ffc565b600e6001820381548110612f9657fe5b90600052602060002001549150600e8181548110612fb057fe5b9060005260206000200154600e6001830381548110612fcb57fe5b906000526020600020018190555081600e8281548110612fe757fe5b60009182526020909120015560001901612f35565b505b8251825461300b9161237d565b9091555050565b6000670de0b6b3a76400004202905060006130338360200151610d606122f8565b9050600061307982610d4b6130658760200151611299670de0b6b3a76400008a606001516128f190919063ffffffff16565b610d606130706122f8565b601554906128f1565b905060006130a46001610d6085610d4b613093878a6123ef565b60208b01516013546112999161237d565b905060006130f2826040518060400160405280601e81526020017f53593a206c697175696461746520736f6d652073656e696f72426f6e647300008152508561285a9092919063ffffffff16565b90506040518060a0016040528061311b886000015160126000015461237d90919063ffffffff16565b815260200161313c886020015160126001015461237d90919063ffffffff16565b815260208082019390935260408082019590955260006060918201528151601255918101516013559283015160145582015160155550608001516016805460ff1916911515919091179055505050565b6000818311612eaf57816122ce565b6000602082840312156131ac578081fd5b81356122ce81613a99565b6000602082840312156131c8578081fd5b81516122ce81613a99565b600080604083850312156131e5578081fd5b82356131f081613a99565b9150602083013561320081613a99565b809150509250929050565b60008060008060808587031215613220578182fd5b843561322b81613a99565b9350602085013561323b81613a99565b9250604085013561324b81613a99565b9150606085013561325b81613a99565b939692955090935050565b60008060006060848603121561327a578283fd5b833561328581613a99565b9250602084013561329581613a99565b929592945050506040919091013590565b600080604083850312156132b8578182fd5b82356132c381613a99565b946020939093013593505050565b600060208083850312156132e3578182fd5b823567ffffffffffffffff808211156132fa578384fd5b818501915085601f83011261330d578384fd5b81358181111561331957fe5b8381026040518582820101818110858211171561333257fe5b604052828152858101935084860182860187018a1015613350578788fd5b8795505b83861015613372578035855260019590950194938601938601613354565b5098975050505050505050565b600060208284031215613390578081fd5b815180151581146122ce578182fd5b6000602082840312156133b0578081fd5b81516122ce81613aae565b6000602082840312156133cc578081fd5b5035919050565b6000602082840312156133e4578081fd5b5051919050565b600080604083850312156133fd578182fd5b82359150602083013561320081613aae565b600080600060608486031215613423578283fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561344f578384fd5b843593506020850135925060408501359150606085013561325b81613aae565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602080835283518082850152825b818110156134d3578581018301518582016040015282016134b7565b818111156134e45783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526014908201527f53593a20627579426f6e6420646561646c696e65000000000000000000000000604082015260600190565b60208082526013908201527f53593a205f6d696e744a756e696f72426f6e6400000000000000000000000000604082015260600190565b60208082526022908201527f53593a206c69717569646174654a756e696f72426f6e647320696e206675747560408201527f7265000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526012908201527f53593a20627579426f6e64207061757365640000000000000000000000000000604082015260600190565b6020808252601e908201527f53593a2072656465656d4a756e696f72426f6e64206d61747572657341740000604082015260600190565b6020808252601e908201527f53593a20627579426f6e6420756e6465726c79696e674c6f616e61626c650000604082015260600190565b60208082526018908201527f5050433a206f6e6c7920636f6e74726f6c6c65722f44414f0000000000000000604082015260600190565b6020808252600d908201527f53593a205f6d696e74426f6e6400000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f53593a206275794a756e696f72426f6e6420646561646c696e65000000000000604082015260600190565b60208082526017908201527f53593a2073656c6c546f6b656e7320646561646c696e65000000000000000000604082015260600190565b6020808252601a908201527f53593a2072656465656d426f6e64206e6f74206d617475726564000000000000604082015260600190565b60208082526018908201527f53593a206e6f7468696e6720746f206c69717569646174650000000000000000604082015260600190565b60208082526014908201527f53593a20627579546f6b656e7320706175736564000000000000000000000000604082015260600190565b60208082526012908201527f53593a20627579426f6e64206761696e20300000000000000000000000000000604082015260600190565b60208082526013908201527f53593a20627579426f6e6420666f724461797300000000000000000000000000604082015260600190565b6020808252601e908201527f53593a206275794a756e696f72426f6e64206d61784d61747572657341740000604082015260600190565b60208082526017908201527f53593a20627579546f6b656e73206d696e546f6b656e73000000000000000000604082015260600190565b6020808252601c908201527f53593a2073656c6c546f6b656e73206d696e556e6465726c79696e6700000000604082015260600190565b60208082526011908201527f53593a20616c7265616479207365747570000000000000000000000000000000604082015260600190565b60208082526013908201527f53593a20627579426f6e64206d696e4761696e00000000000000000000000000604082015260600190565b60208082526016908201527f53593a20627579546f6b656e7320646561646c696e6500000000000000000000604082015260600190565b60208082526016908201527f53593a20616c7265616479206c69717569646174656400000000000000000000604082015260600190565b90815260200190565b918252602082015260400190565b928352602083019190915261ffff16604082015260600190565b9283526020830191909152604082015260600190565b9485526020850193909352604084019190915260608301521515608082015260a00190565b94855260208501939093526040840191909152606083015261ffff16608082015260a00190565b60ff91909116815260200190565b6001600160a01b0381168114610db557600080fd5b61ffff81168114610db557600080fdfe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220937a9baa48095cad1ee2a7353c22198c42e02265c6c4118419b6a26d027a317664736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000164261726e427269646765206a756e696f72206344414900000000000000000000000000000000000000000000000000000000000000000000000000000000000762625f6344414900000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): BarnBridge junior cDAI
Arg [1] : symbol_ (string): bb_cDAI
Arg [2] : decimals_ (uint8): 18
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [4] : 4261726e427269646765206a756e696f72206344414900000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [6] : 62625f6344414900000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.