More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 69 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 10918798 | 66 days ago | IN | 0 ETH | 0.00001022 | ||||
Approve | 10918736 | 66 days ago | IN | 0 ETH | 0.00001102 | ||||
Approve | 10918655 | 66 days ago | IN | 0 ETH | 0.00001243 | ||||
Approve | 10918603 | 66 days ago | IN | 0 ETH | 0.00001089 | ||||
Approve | 10918546 | 66 days ago | IN | 0 ETH | 0.00001054 | ||||
Approve | 10918458 | 66 days ago | IN | 0 ETH | 0.00000989 | ||||
Approve | 10918379 | 66 days ago | IN | 0 ETH | 0.00000836 | ||||
Approve | 10894644 | 66 days ago | IN | 0 ETH | 0.00001432 | ||||
Approve | 10894470 | 66 days ago | IN | 0 ETH | 0.00001396 | ||||
Approve | 10894411 | 66 days ago | IN | 0 ETH | 0.00001282 | ||||
Approve | 10894350 | 66 days ago | IN | 0 ETH | 0.00001402 | ||||
Approve | 10894272 | 66 days ago | IN | 0 ETH | 0.0000134 | ||||
Approve | 10894216 | 66 days ago | IN | 0 ETH | 0.00001302 | ||||
Approve | 10894148 | 66 days ago | IN | 0 ETH | 0.00001255 | ||||
Approve | 10894083 | 66 days ago | IN | 0 ETH | 0.00001238 | ||||
Approve | 10893963 | 66 days ago | IN | 0 ETH | 0.000013 | ||||
Approve | 10893870 | 66 days ago | IN | 0 ETH | 0.00001366 | ||||
Approve | 10893804 | 66 days ago | IN | 0 ETH | 0.00001428 | ||||
Approve | 10893753 | 66 days ago | IN | 0 ETH | 0.00001282 | ||||
Approve | 10893672 | 66 days ago | IN | 0 ETH | 0.00001298 | ||||
Approve | 10893604 | 66 days ago | IN | 0 ETH | 0.00001478 | ||||
Approve | 10893498 | 66 days ago | IN | 0 ETH | 0.00001281 | ||||
Approve | 10893429 | 66 days ago | IN | 0 ETH | 0.00001231 | ||||
Approve | 10893363 | 66 days ago | IN | 0 ETH | 0.0000129 | ||||
Approve | 10892955 | 66 days ago | IN | 0 ETH | 0.00001079 |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xb5031D4c...05d94c14D The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
LiquidityGaugeV2
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../interfaces/ILiquidityGauge.sol"; import "../interfaces/IChessSchedule.sol"; import "../interfaces/IChessController.sol"; import "../interfaces/IFundV3.sol"; import "../interfaces/ITrancheIndexV2.sol"; import "../interfaces/IStableSwap.sol"; import "../interfaces/IVotingEscrow.sol"; import "../utils/CoreUtility.sol"; import "../utils/SafeDecimalMath.sol"; interface ISwapBonus { function bonusToken() external view returns (address); function getBonus() external returns (uint256); } contract LiquidityGaugeV2 is ILiquidityGauge, ITrancheIndexV2, CoreUtility, ERC20 { using Math for uint256; using SafeMath for uint256; using SafeDecimalMath for uint256; using SafeERC20 for IERC20; struct Distribution { uint256 amountQ; uint256 amountB; uint256 amountR; uint256 quoteAmount; } uint256 private constant MAX_ITERATIONS = 500; uint256 private constant MAX_BOOSTING_FACTOR = 3e18; uint256 private constant MAX_BOOSTING_FACTOR_MINUS_ONE = MAX_BOOSTING_FACTOR - 1e18; address public immutable stableSwap; IERC20 private immutable _quoteToken; IChessSchedule public immutable chessSchedule; IChessController public immutable chessController; IFundV3 public immutable fund; IVotingEscrow private immutable _votingEscrow; address public immutable swapBonus; IERC20 private immutable _bonusToken; uint256 private _workingSupply; mapping(address => uint256) private _workingBalances; uint256 public latestVersion; mapping(uint256 => Distribution) public distributions; mapping(uint256 => uint256) public distributionTotalSupplies; mapping(address => Distribution) public userDistributions; mapping(address => uint256) public userVersions; uint256 private _chessIntegral; uint256 private _chessIntegralTimestamp; mapping(address => uint256) private _chessUserIntegrals; mapping(address => uint256) private _claimableChess; uint256 private _bonusIntegral; mapping(address => uint256) private _bonusUserIntegral; mapping(address => uint256) private _claimableBonus; /// @dev Per-gauge CHESS emission rate. The product of CHESS emission rate /// and weekly percentage of the gauge uint256 private _rate; constructor( string memory name_, string memory symbol_, address stableSwap_, address chessSchedule_, address chessController_, address fund_, address votingEscrow_, address swapBonus_ ) public ERC20(name_, symbol_) { stableSwap = stableSwap_; _quoteToken = IERC20(IStableSwap(stableSwap_).quoteAddress()); chessSchedule = IChessSchedule(chessSchedule_); chessController = IChessController(chessController_); fund = IFundV3(fund_); _votingEscrow = IVotingEscrow(votingEscrow_); swapBonus = swapBonus_; _bonusToken = IERC20(ISwapBonus(swapBonus_).bonusToken()); _chessIntegralTimestamp = block.timestamp; } modifier onlyStableSwap() { require(msg.sender == stableSwap, "Only stable swap"); _; } function getRate() external view returns (uint256) { return _rate / 1e18; } function mint(address account, uint256 amount) external override onlyStableSwap { uint256 oldWorkingBalance = _workingBalances[account]; uint256 oldWorkingSupply = _workingSupply; uint256 oldBalance = balanceOf(account); _checkpoint(account, oldBalance, oldWorkingBalance, oldWorkingSupply); _mint(account, amount); _updateWorkingBalance(account, oldWorkingBalance, oldWorkingSupply, oldBalance.add(amount)); } function burnFrom(address account, uint256 amount) external override onlyStableSwap { uint256 oldWorkingBalance = _workingBalances[account]; uint256 oldWorkingSupply = _workingSupply; uint256 oldBalance = balanceOf(account); _checkpoint(account, oldBalance, oldWorkingBalance, oldWorkingSupply); _burn(account, amount); _updateWorkingBalance(account, oldWorkingBalance, oldWorkingSupply, oldBalance.sub(amount)); } function _transfer(address, address, uint256) internal override { revert("Transfer is not allowed"); } function workingBalanceOf(address account) external view override returns (uint256) { return _workingBalances[account]; } function workingSupply() external view override returns (uint256) { return _workingSupply; } function claimableRewards( address account ) external override returns ( uint256 chessAmount, uint256 bonusAmount, uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount ) { return _checkpoint(account, balanceOf(account), _workingBalances[account], _workingSupply); } function claimRewards(address account) external override { uint256 balance = balanceOf(account); uint256 oldWorkingBalance = _workingBalances[account]; uint256 oldWorkingSupply = _workingSupply; ( uint256 chessAmount, uint256 bonusAmount, uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount ) = _checkpoint(account, balance, oldWorkingBalance, oldWorkingSupply); _updateWorkingBalance(account, oldWorkingBalance, oldWorkingSupply, balance); if (chessAmount != 0) { chessSchedule.mint(account, chessAmount); delete _claimableChess[account]; } if (bonusAmount != 0) { _bonusToken.safeTransfer(account, bonusAmount); delete _claimableBonus[account]; } if (amountQ != 0 || amountB != 0 || amountR != 0 || quoteAmount != 0) { uint256 version = latestVersion; if (amountQ != 0) { fund.trancheTransfer(TRANCHE_Q, account, amountQ, version); } if (amountB != 0) { fund.trancheTransfer(TRANCHE_B, account, amountB, version); } if (amountR != 0) { fund.trancheTransfer(TRANCHE_R, account, amountR, version); } if (quoteAmount != 0) { _quoteToken.safeTransfer(account, quoteAmount); } delete userDistributions[account]; } } function syncWithVotingEscrow(address account) external { uint256 balance = balanceOf(account); uint256 oldWorkingBalance = _workingBalances[account]; uint256 oldWorkingSupply = _workingSupply; _checkpoint(account, balance, oldWorkingBalance, oldWorkingSupply); _updateWorkingBalance(account, oldWorkingBalance, oldWorkingSupply, balance); } function distribute( uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount, uint256 version ) external override onlyStableSwap { // Update global state distributions[version].amountQ = amountQ; distributions[version].amountB = amountB; distributions[version].amountR = amountR; distributions[version].quoteAmount = quoteAmount; distributionTotalSupplies[version] = totalSupply(); latestVersion = version; } function _updateWorkingBalance( address account, uint256 oldWorkingBalance, uint256 oldWorkingSupply, uint256 newBalance ) private { uint256 newWorkingBalance = newBalance; uint256 veBalance = _votingEscrow.balanceOf(account); if (veBalance > 0) { uint256 veTotalSupply = _votingEscrow.totalSupply(); uint256 maxWorkingBalance = newWorkingBalance.multiplyDecimal(MAX_BOOSTING_FACTOR); uint256 boostedWorkingBalance = newWorkingBalance.add( totalSupply().mul(veBalance).multiplyDecimal(MAX_BOOSTING_FACTOR_MINUS_ONE).div( veTotalSupply ) ); newWorkingBalance = maxWorkingBalance.min(boostedWorkingBalance); } _workingSupply = oldWorkingSupply.sub(oldWorkingBalance).add(newWorkingBalance); _workingBalances[account] = newWorkingBalance; } function _checkpoint( address account, uint256 balance, uint256 weight, uint256 totalWeight ) private returns ( uint256 chessAmount, uint256 bonusAmount, uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount ) { chessAmount = _chessCheckpoint(account, weight, totalWeight); bonusAmount = _bonusCheckpoint(account, weight, totalWeight); (amountQ, amountB, amountR, quoteAmount) = _distributionCheckpoint(account, balance); } function _chessCheckpoint( address account, uint256 weight, uint256 totalWeight ) private returns (uint256 amount) { // Update global state uint256 timestamp = _chessIntegralTimestamp; uint256 integral = _chessIntegral; uint256 endWeek = _endOfWeek(timestamp); uint256 rate = _rate; if (rate == 0) { // CHESS emission may update in the middle of a week due to cross-chain lag. // We re-calculate the rate if it was zero after the last checkpoint. uint256 weeklySupply = chessSchedule.getWeeklySupply(timestamp); if (weeklySupply != 0) { rate = (weeklySupply / (endWeek - timestamp)).mul( chessController.getFundRelativeWeight(address(this), timestamp) ); } } for (uint256 i = 0; i < MAX_ITERATIONS && timestamp < block.timestamp; i++) { uint256 endTimestamp = endWeek.min(block.timestamp); if (totalWeight != 0) { integral = integral.add( rate.mul(endTimestamp - timestamp).decimalToPreciseDecimal().div(totalWeight) ); } if (endTimestamp == endWeek) { rate = chessSchedule.getRate(endWeek).mul( chessController.getFundRelativeWeight(address(this), endWeek) ); endWeek += 1 weeks; } timestamp = endTimestamp; } _chessIntegralTimestamp = block.timestamp; _chessIntegral = integral; _rate = rate; // Update per-user state amount = _claimableChess[account].add( weight.multiplyDecimalPrecise(integral.sub(_chessUserIntegrals[account])) ); _claimableChess[account] = amount; _chessUserIntegrals[account] = integral; } function _bonusCheckpoint( address account, uint256 weight, uint256 totalWeight ) private returns (uint256 amount) { // Update global state uint256 newBonus = ISwapBonus(swapBonus).getBonus(); uint256 integral = _bonusIntegral; if (totalWeight != 0 && newBonus != 0) { integral = integral.add(newBonus.divideDecimalPrecise(totalWeight)); _bonusIntegral = integral; } // Update per-user state uint256 oldUserIntegral = _bonusUserIntegral[account]; if (oldUserIntegral == integral) { return _claimableBonus[account]; } amount = _claimableBonus[account].add( weight.multiplyDecimalPrecise(integral.sub(oldUserIntegral)) ); _claimableBonus[account] = amount; _bonusUserIntegral[account] = integral; } function _distributionCheckpoint( address account, uint256 balance ) private returns (uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount) { uint256 version = userVersions[account]; uint256 newVersion = latestVersion; // Update per-user state Distribution storage userDist = userDistributions[account]; amountQ = userDist.amountQ; amountB = userDist.amountB; amountR = userDist.amountR; quoteAmount = userDist.quoteAmount; if (version == newVersion) { return (amountQ, amountB, amountR, quoteAmount); } for (uint256 i = version; i < newVersion; i++) { if (amountQ != 0 || amountB != 0 || amountR != 0) { (amountQ, amountB, amountR) = fund.doRebalance(amountQ, amountB, amountR, i); } Distribution storage dist = distributions[i + 1]; uint256 distTotalSupply = distributionTotalSupplies[i + 1]; if (distTotalSupply != 0) { amountQ = amountQ.add(dist.amountQ.mul(balance).div(distTotalSupply)); amountB = amountB.add(dist.amountB.mul(balance).div(distTotalSupply)); amountR = amountR.add(dist.amountR.mul(balance).div(distTotalSupply)); quoteAmount = quoteAmount.add(dist.quoteAmount.mul(balance).div(distTotalSupply)); } } userDist.amountQ = amountQ; userDist.amountB = amountB; userDist.amountR = amountR; userDist.quoteAmount = quoteAmount; userVersions[account] = newVersion; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
// 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; 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 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: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; interface IChessController { function getFundRelativeWeight(address account, uint256 timestamp) external returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; interface IChessSchedule { function getWeeklySupply(uint256 timestamp) external view returns (uint256); function getRate(uint256 timestamp) external view returns (uint256); function mint(address account, uint256 amount) external; function addMinter(address account) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "./ITwapOracleV2.sol"; interface IFundV3 { /// @notice A linear transformation matrix that represents a rebalance. /// /// ``` /// [ 1 0 0 ] /// R = [ ratioB2Q ratioBR 0 ] /// [ ratioR2Q 0 ratioBR ] /// ``` /// /// Amounts of the three tranches `q`, `b` and `r` can be rebalanced by multiplying the matrix: /// /// ``` /// [ q', b', r' ] = [ q, b, r ] * R /// ``` struct Rebalance { uint256 ratioB2Q; uint256 ratioR2Q; uint256 ratioBR; uint256 timestamp; } function tokenUnderlying() external view returns (address); function tokenQ() external view returns (address); function tokenB() external view returns (address); function tokenR() external view returns (address); function tokenShare(uint256 tranche) external view returns (address); function primaryMarket() external view returns (address); function primaryMarketUpdateProposal() external view returns (address, uint256); function strategy() external view returns (address); function strategyUpdateProposal() external view returns (address, uint256); function underlyingDecimalMultiplier() external view returns (uint256); function twapOracle() external view returns (ITwapOracleV2); function feeCollector() external view returns (address); function endOfDay(uint256 timestamp) external pure returns (uint256); function trancheTotalSupply(uint256 tranche) external view returns (uint256); function trancheBalanceOf(uint256 tranche, address account) external view returns (uint256); function trancheAllBalanceOf(address account) external view returns (uint256, uint256, uint256); function trancheBalanceVersion(address account) external view returns (uint256); function trancheAllowance( uint256 tranche, address owner, address spender ) external view returns (uint256); function trancheAllowanceVersion( address owner, address spender ) external view returns (uint256); function trancheTransfer( uint256 tranche, address recipient, uint256 amount, uint256 version ) external; function trancheTransferFrom( uint256 tranche, address sender, address recipient, uint256 amount, uint256 version ) external; function trancheApprove( uint256 tranche, address spender, uint256 amount, uint256 version ) external; function getRebalanceSize() external view returns (uint256); function getRebalance(uint256 index) external view returns (Rebalance memory); function getRebalanceTimestamp(uint256 index) external view returns (uint256); function currentDay() external view returns (uint256); function splitRatio() external view returns (uint256); function historicalSplitRatio(uint256 version) external view returns (uint256); function fundActivityStartTime() external view returns (uint256); function isFundActive(uint256 timestamp) external view returns (bool); function getEquivalentTotalB() external view returns (uint256); function getEquivalentTotalQ() external view returns (uint256); function historicalEquivalentTotalB(uint256 timestamp) external view returns (uint256); function historicalNavs(uint256 timestamp) external view returns (uint256 navB, uint256 navR); function extrapolateNav(uint256 price) external view returns (uint256, uint256, uint256); function doRebalance( uint256 amountQ, uint256 amountB, uint256 amountR, uint256 index ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR); function batchRebalance( uint256 amountQ, uint256 amountB, uint256 amountR, uint256 fromIndex, uint256 toIndex ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR); function refreshBalance(address account, uint256 targetVersion) external; function refreshAllowance(address owner, address spender, uint256 targetVersion) external; function shareTransfer(address sender, address recipient, uint256 amount) external; function shareTransferFrom( address spender, address sender, address recipient, uint256 amount ) external returns (uint256 newAllowance); function shareIncreaseAllowance( address sender, address spender, uint256 addedValue ) external returns (uint256 newAllowance); function shareDecreaseAllowance( address sender, address spender, uint256 subtractedValue ) external returns (uint256 newAllowance); function shareApprove(address owner, address spender, uint256 amount) external; function historicalUnderlying(uint256 timestamp) external view returns (uint256); function getTotalUnderlying() external view returns (uint256); function getStrategyUnderlying() external view returns (uint256); function getTotalDebt() external view returns (uint256); event RebalanceTriggered( uint256 indexed index, uint256 indexed day, uint256 navSum, uint256 navB, uint256 navROrZero, uint256 ratioB2Q, uint256 ratioR2Q, uint256 ratioBR ); event Settled(uint256 indexed day, uint256 navB, uint256 navR, uint256 interestRate); event InterestRateUpdated(uint256 baseInterestRate, uint256 floatingInterestRate); event BalancesRebalanced( address indexed account, uint256 version, uint256 balanceQ, uint256 balanceB, uint256 balanceR ); event AllowancesRebalanced( address indexed owner, address indexed spender, uint256 version, uint256 allowanceQ, uint256 allowanceB, uint256 allowanceR ); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface ILiquidityGauge is IERC20 { function mint(address account, uint256 amount) external; function burnFrom(address account, uint256 amount) external; function workingSupply() external view returns (uint256); function workingBalanceOf(address account) external view returns (uint256); function claimableRewards( address account ) external returns ( uint256 chessAmount, uint256 bonusAmount, uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount ); function claimRewards(address account) external; function distribute( uint256 amountQ, uint256 amountB, uint256 amountR, uint256 quoteAmount, uint256 version ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; import "../interfaces/IFundV3.sol"; interface IStableSwapCore { function getQuoteOut(uint256 baseIn) external view returns (uint256 quoteOut); function getQuoteIn(uint256 baseOut) external view returns (uint256 quoteIn); function getBaseOut(uint256 quoteIn) external view returns (uint256 baseOut); function getBaseIn(uint256 quoteOut) external view returns (uint256 baseIn); function buy( uint256 version, uint256 baseOut, address recipient, bytes calldata data ) external returns (uint256 realBaseOut); function sell( uint256 version, uint256 quoteOut, address recipient, bytes calldata data ) external returns (uint256 realQuoteOut); } interface IStableSwap is IStableSwapCore { function fund() external view returns (IFundV3); function baseTranche() external view returns (uint256); function baseAddress() external view returns (address); function quoteAddress() external view returns (address); function allBalances() external view returns (uint256, uint256); function getOraclePrice() external view returns (uint256); function getCurrentD() external view returns (uint256); function getCurrentPriceOverOracle() external view returns (uint256); function getCurrentPrice() external view returns (uint256); function getPriceOverOracleIntegral() external view returns (uint256); function addLiquidity(uint256 version, address recipient) external returns (uint256); function removeLiquidity( uint256 version, uint256 lpIn, uint256 minBaseOut, uint256 minQuoteOut ) external returns (uint256 baseOut, uint256 quoteOut); function removeLiquidityUnwrap( uint256 version, uint256 lpIn, uint256 minBaseOut, uint256 minQuoteOut ) external returns (uint256 baseOut, uint256 quoteOut); function removeBaseLiquidity( uint256 version, uint256 lpIn, uint256 minBaseOut ) external returns (uint256 baseOut); function removeQuoteLiquidity( uint256 version, uint256 lpIn, uint256 minQuoteOut ) external returns (uint256 quoteOut); function removeQuoteLiquidityUnwrap( uint256 version, uint256 lpIn, uint256 minQuoteOut ) external returns (uint256 quoteOut); } /// @dev The interface shares the same function names as in `IStableSwapCore`; /// all getters are defined as non-view functions in order to parse and /// return the internal revert messages interface IStableSwapCoreInternalRevertExpected { function getQuoteOut(uint256 baseIn) external returns (uint256 quoteOut); function getQuoteIn(uint256 baseOut) external returns (uint256 quoteIn); function getBaseOut(uint256 quoteIn) external returns (uint256 baseOut); function getBaseIn(uint256 quoteOut) external returns (uint256 baseIn); function buy( uint256 version, uint256 baseOut, address recipient, bytes calldata data ) external returns (uint256 realBaseOut); function sell( uint256 version, uint256 quoteOut, address recipient, bytes calldata data ) external returns (uint256 realQuoteOut); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; /// @notice Amounts of QUEEN, BISHOP and ROOK are sometimes stored in a `uint256[3]` array. /// This contract defines index of each tranche in this array. /// /// Solidity does not allow constants to be defined in interfaces. So this contract follows /// the naming convention of interfaces but is implemented as an `abstract contract`. abstract contract ITrancheIndexV2 { uint256 internal constant TRANCHE_Q = 0; uint256 internal constant TRANCHE_B = 1; uint256 internal constant TRANCHE_R = 2; uint256 internal constant TRANCHE_COUNT = 3; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; interface ITwapOracle { enum UpdateType { PRIMARY, SECONDARY, OWNER, CHAINLINK, UNISWAP_V2 } function getTwap(uint256 timestamp) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; import "./ITwapOracle.sol"; interface ITwapOracleV2 is ITwapOracle { function getLatest() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; interface IAddressWhitelist { function check(address account) external view returns (bool); } interface IVotingEscrowCallback { function syncWithVotingEscrow(address account) external; } interface IVotingEscrow { struct LockedBalance { uint256 amount; uint256 unlockTime; } function token() external view returns (address); function maxTime() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function totalSupply() external view returns (uint256); function balanceOfAtTimestamp( address account, uint256 timestamp ) external view returns (uint256); function getTimestampDropBelow( address account, uint256 threshold ) external view returns (uint256); function getLockedBalance(address account) external view returns (LockedBalance memory); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; abstract contract CoreUtility { using SafeMath for uint256; /// @dev UTC time of a day when the fund settles. uint256 internal constant SETTLEMENT_TIME = 14 hours; /// @dev Return end timestamp of the trading week containing a given timestamp. /// /// A trading week starts at UTC time `SETTLEMENT_TIME` on a Thursday (inclusive) /// and ends at the same time of the next Thursday (exclusive). /// @param timestamp The given timestamp /// @return End timestamp of the trading week. function _endOfWeek(uint256 timestamp) internal pure returns (uint256) { return ((timestamp.add(1 weeks) - SETTLEMENT_TIME) / 1 weeks) * 1 weeks + SETTLEMENT_TIME; } }
// SPDX-License-Identifier: MIT // // Copyright (c) 2019 Synthetix // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; library SafeDecimalMath { using SafeMath for uint256; /* Number of decimal places in the representations. */ uint256 private constant decimals = 18; uint256 private constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint256 private constant UNIT = 10 ** uint256(decimals); /* The number representing 1.0 for higher fidelity numbers. */ uint256 private constant PRECISE_UNIT = 10 ** uint256(highPrecisionDecimals); uint256 private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10 ** uint256(highPrecisionDecimals - decimals); /** * @return The result of multiplying x and y, interpreting the operands as fixed-point * decimals. * * @dev A unit factor is divided out after the product of x and y is evaluated, * so that product must be less than 2**256. As this is an integer division, * the internal division always rounds down. This helps save on gas. Rounding * is more expensive on gas. */ function multiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y).div(UNIT); } function multiplyDecimalPrecise(uint256 x, uint256 y) internal pure returns (uint256) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y).div(PRECISE_UNIT); } /** * @return The result of safely dividing x and y. The return value is a high * precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and UNIT must be less than 2**256. As * this is an integer division, the result is always rounded down. * This helps save on gas. Rounding is more expensive on gas. */ function divideDecimal(uint256 x, uint256 y) internal pure returns (uint256) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(UNIT).div(y); } function divideDecimalPrecise(uint256 x, uint256 y) internal pure returns (uint256) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(PRECISE_UNIT).div(y); } /** * @dev Convert a standard decimal representation to a high precision one. */ function decimalToPreciseDecimal(uint256 i) internal pure returns (uint256) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); } /** * @dev Convert a high precision decimal to a standard decimal representation. */ function preciseDecimalToDecimal(uint256 i) internal pure returns (uint256) { uint256 quotientTimesTen = i.mul(10).div(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); if (quotientTimesTen % 10 >= 5) { quotientTimesTen = quotientTimesTen.add(10); } return quotientTimesTen.div(10); } /** * @dev Returns the multiplication of two unsigned integers, and the max value of * uint256 on overflow. */ function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; return c / a != b ? type(uint256).max : c; } function saturatingMultiplyDecimal(uint256 x, uint256 y) internal pure returns (uint256) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return saturatingMul(x, y).div(UNIT); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "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":"address","name":"stableSwap_","type":"address"},{"internalType":"address","name":"chessSchedule_","type":"address"},{"internalType":"address","name":"chessController_","type":"address"},{"internalType":"address","name":"fund_","type":"address"},{"internalType":"address","name":"votingEscrow_","type":"address"},{"internalType":"address","name":"swapBonus_","type":"address"}],"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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"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":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chessController","outputs":[{"internalType":"contract IChessController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chessSchedule","outputs":[{"internalType":"contract IChessSchedule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"claimableRewards","outputs":[{"internalType":"uint256","name":"chessAmount","type":"uint256"},{"internalType":"uint256","name":"bonusAmount","type":"uint256"},{"internalType":"uint256","name":"amountQ","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"amountR","type":"uint256"},{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"stateMutability":"nonpayable","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":"uint256","name":"amountQ","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"amountR","type":"uint256"},{"internalType":"uint256","name":"quoteAmount","type":"uint256"},{"internalType":"uint256","name":"version","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributionTotalSupplies","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributions","outputs":[{"internalType":"uint256","name":"amountQ","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"amountR","type":"uint256"},{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fund","outputs":[{"internalType":"contract IFundV3","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"latestVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stableSwap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapBonus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"syncWithVotingEscrow","outputs":[],"stateMutability":"nonpayable","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":"address","name":"","type":"address"}],"name":"userDistributions","outputs":[{"internalType":"uint256","name":"amountQ","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"amountR","type":"uint256"},{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userVersions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"workingBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"workingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638136619211610104578063a457c2d7116100a2578063c8562f7211610071578063c8562f72146103b0578063dc01f60d146103b8578063dd62ed3e146103dd578063ef5cfb8c146103f0576101da565b8063a457c2d71461037a578063a9059cbb1461038d578063b60d4288146103a0578063c07f47d4146103a8576101da565b8063919c2aa2116100de578063919c2aa21461034f578063929304cb1461035757806395d89b411461036a5780639e548b7f14610372576101da565b8063813661921461032157806382812290146103295780639050fd4e1461033c576101da565b8063313ce5671161017c5780634487d3df1161014b5780634487d3df146102d0578063679aefce146102f357806370a08231146102fb57806379cc67901461030e576101da565b8063313ce5671461027e578063395093511461029357806340c10f19146102a657806341d06e08146102bb576101da565b80630d1efb8e116101b85780630d1efb8e1461023d5780631507537c1461025057806318160ddd1461026357806323b872dd1461026b576101da565b806306fdde03146101df578063095ea7b3146101fd5780630c7c97c71461021d575b600080fd5b6101e7610403565b6040516101f49190611f56565b60405180910390f35b61021061020b366004611e21565b610499565b6040516101f49190611f4b565b61023061022b366004611d92565b6104b7565b6040516101f49190612295565b61023061024b366004611e6b565b6104d2565b61023061025e366004611d92565b6104e4565b6102306104f6565b610210610279366004611de1565b6104fc565b610286610584565b6040516101f49190612305565b6102106102a1366004611e21565b61058d565b6102b96102b4366004611e21565b6105db565b005b6102c361068d565b6040516101f49190611f1e565b6102e36102de366004611e6b565b6106b1565b6040516101f494939291906122c2565b6102306106d8565b610230610309366004611d92565b6106f3565b6102b961031c366004611e21565b61070e565b6102c36107ab565b6102b9610337366004611ec8565b6107cf565b6102b961034a366004611d92565b61085c565b6102c36108ab565b6102e3610365366004611d92565b6108cf565b6101e76108f6565b6102c3610957565b610210610388366004611e21565b61097b565b61021061039b366004611e21565b6109e3565b6102c36109f7565b610230610a1b565b610230610a21565b6103cb6103c6366004611d92565b610a27565b6040516101f4969594939291906122dd565b6102306103eb366004611dad565b610a72565b6102b96103fe366004611d92565b610a9d565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561048f5780601f106104645761010080835404028352916020019161048f565b820191906000526020600020905b81548152906001019060200180831161047257829003601f168201915b5050505050905090565b60006104ad6104a6610e28565b8484610e2c565b5060015b92915050565b6001600160a01b031660009081526007602052604090205490565b600a6020526000908152604090205481565b600c6020526000908152604090205481565b60025490565b6000610509848484610ee0565b61057984610515610e28565b6105748560405180606001604052806028815260200161237a602891396001600160a01b038a16600090815260016020526040812090610553610e28565b6001600160a01b031681526020810191909152604001600020549190610ef8565b610e2c565b5060015b9392505050565b60055460ff1690565b60006104ad61059a610e28565b8461057485600160006105ab610e28565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610f24565b336001600160a01b037f000000000000000000000000d151ce31322aea25e4779678df0a3f376f9ffc6f161461062c5760405162461bcd60e51b8152600401610623906120ed565b60405180910390fd5b6001600160a01b0382166000908152600760205260408120546006549091610653856106f3565b905061066185828585610f49565b5050505050506106718585610f88565b6106868584846106818589610f24565b611048565b5050505050565b7f000000000000000000000000fae0e20b4d74531e58ea31a964adfc61c08fa13b81565b60096020526000908152604090208054600182015460028301546003909301549192909184565b6000670de0b6b3a7640000601454816106ed57fe5b04905090565b6001600160a01b031660009081526020819052604090205490565b336001600160a01b037f000000000000000000000000d151ce31322aea25e4779678df0a3f376f9ffc6f16146107565760405162461bcd60e51b8152600401610623906120ed565b6001600160a01b038216600090815260076020526040812054600654909161077d856106f3565b905061078b85828585610f49565b50505050505061079b8585611222565b61068685848461068185896112f8565b7f00000000000000000000000033b5ad38dcd817090474d4f79b75e1403384e0c881565b336001600160a01b037f000000000000000000000000d151ce31322aea25e4779678df0a3f376f9ffc6f16146108175760405162461bcd60e51b8152600401610623906120ed565b600081815260096020526040902085815560018101859055600281018490556003018290556108446104f6565b6000828152600a602052604090205560085550505050565b6000610867826106f3565b6001600160a01b0383166000908152600760205260409020546006549192509061089384848484610f49565b5050505050506108a584838386611048565b50505050565b7f000000000000000000000000f3bf24b8fdb80b167b3fb6b97131fb942579dafa81565b600b6020526000908152604090208054600182015460028301546003909301549192909184565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561048f5780601f106104645761010080835404028352916020019161048f565b7f000000000000000000000000d151ce31322aea25e4779678df0a3f376f9ffc6f81565b60006104ad610988610e28565b84610574856040518060600160405280602581526020016123a260259139600160006109b2610e28565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610ef8565b60006104ad6109f0610e28565b8484610ee0565b7f000000000000000000000000289e69e5b611f6193694f6cfa2f93b7cf161253f81565b60085481565b60065490565b600080600080600080610a5e87610a3d896106f3565b6001600160a01b038a16600090815260076020526040902054600654610f49565b949c939b5091995097509550909350915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610aa8826106f3565b6001600160a01b03831660009081526007602052604081205460065492935091908080808080610ada8a8a8a8a610f49565b955095509550955095509550610af28a89898c611048565b8515610b92576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000f3bf24b8fdb80b167b3fb6b97131fb942579dafa16906340c10f1990610b46908d908a90600401611f32565b600060405180830381600087803b158015610b6057600080fd5b505af1158015610b74573d6000803e3d6000fd5b5050506001600160a01b038b16600090815260106020526040812055505b8415610be657610bcc6001600160a01b037f0000000000000000000000009735fb1126b521a913697a541f768376011bccf9168b87611320565b6001600160a01b038a166000908152601360205260408120555b83151580610bf357508215155b80610bfd57508115155b80610c0757508015155b15610e1c576008548415610c9b57604051634d1eef9360e11b81526001600160a01b037f000000000000000000000000289e69e5b611f6193694f6cfa2f93b7cf161253f1690639a3ddf2690610c68906000908f908a90879060040161229e565b600060405180830381600087803b158015610c8257600080fd5b505af1158015610c96573d6000803e3d6000fd5b505050505b8315610d2757604051634d1eef9360e11b81526001600160a01b037f000000000000000000000000289e69e5b611f6193694f6cfa2f93b7cf161253f1690639a3ddf2690610cf4906001908f908990879060040161229e565b600060405180830381600087803b158015610d0e57600080fd5b505af1158015610d22573d6000803e3d6000fd5b505050505b8215610db357604051634d1eef9360e11b81526001600160a01b037f000000000000000000000000289e69e5b611f6193694f6cfa2f93b7cf161253f1690639a3ddf2690610d80906002908f908890879060040161229e565b600060405180830381600087803b158015610d9a57600080fd5b505af1158015610dae573d6000803e3d6000fd5b505050505b8115610ded57610ded6001600160a01b037f00000000000000000000000080137510979822322193fc997d400d5a6c747bf7168c84611320565b506001600160a01b038a166000908152600b602052604081208181556001810182905560028101829055600301555b50505050505050505050565b3390565b6001600160a01b038316610e525760405162461bcd60e51b815260040161062390612199565b6001600160a01b038216610e785760405162461bcd60e51b815260040161062390611f89565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610ed3908590612295565b60405180910390a3505050565b60405162461bcd60e51b815260040161062390612002565b60008184841115610f1c5760405162461bcd60e51b81526004016106239190611f56565b505050900390565b60008282018381101561057d5760405162461bcd60e51b815260040161062390611fcb565b600080600080600080610f5d8a898961137b565b9550610f6a8a8989611739565b9450610f768a8a6118b1565b989d979c50919a509850965050505050565b6001600160a01b038216610fae5760405162461bcd60e51b81526004016106239061225e565b610fba60008383611376565b600254610fc79082610f24565b6002556001600160a01b038216600090815260208190526040902054610fed9082610f24565b6001600160a01b0383166000818152602081905260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061103c908590612295565b60405180910390a35050565b6040516370a0823160e01b815281906000906001600160a01b037f000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba16906370a0823190611099908990600401611f1e565b60206040518083038186803b1580156110b157600080fd5b505afa1580156110c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e99190611e83565b905080156111e85760007f000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561114c57600080fd5b505afa158015611160573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111849190611e83565b9050600061119a846729a2241af62c0000611acd565b905060006111d66111cf846111c9671bc16d674ec800006111c3896111bd6104f6565b90611ae1565b90611acd565b90611b1b565b8690610f24565b90506111e28282611b4d565b94505050505b6111fc826111f686886112f8565b90610f24565b600655506001600160a01b03909416600090815260076020526040902093909355505050565b6001600160a01b0382166112485760405162461bcd60e51b815260040161062390612158565b61125482600083611376565b61129181604051806060016040528060228152602001612358602291396001600160a01b0385166000908152602081905260409020549190610ef8565b6001600160a01b0383166000908152602081905260409020556002546112b790826112f8565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061103c908590612295565b60008282111561131a5760405162461bcd60e51b815260040161062390612039565b50900390565b6113768363a9059cbb60e01b848460405160240161133f929190611f32565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611b63565b505050565b600e54600d54600091908261138f83611bf2565b601454909150806114fc576040516354cb065d60e11b81526000906001600160a01b037f000000000000000000000000f3bf24b8fdb80b167b3fb6b97131fb942579dafa169063a9960cba906113e9908890600401612295565b60206040518083038186803b15801561140157600080fd5b505afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114399190611e83565b905080156114fa57604051636910f41760e01b81526114f7906001600160a01b037f000000000000000000000000fae0e20b4d74531e58ea31a964adfc61c08fa13b1690636910f417906114939030908a90600401611f32565b602060405180830381600087803b1580156114ad57600080fd5b505af11580156114c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e59190611e83565b86850383816114f057fe5b0490611ae1565b91505b505b60005b6101f48110801561150f57504285105b156116a35760006115208442611b4d565b90508715611546576115436111cf896111c961153e878b8703611ae1565b611c1c565b94505b8381141561169957604051636910f41760e01b815261168e906001600160a01b037f000000000000000000000000fae0e20b4d74531e58ea31a964adfc61c08fa13b1690636910f417906115a09030908990600401611f32565b602060405180830381600087803b1580156115ba57600080fd5b505af11580156115ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f29190611e83565b6040516315dd902560e21b81526001600160a01b037f000000000000000000000000f3bf24b8fdb80b167b3fb6b97131fb942579dafa169063577640949061163e908990600401612295565b60206040518083038186803b15801561165657600080fd5b505afa15801561166a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bd9190611e83565b925062093a80840193505b94506001016114ff565b5042600e55600d83905560148190556001600160a01b0388166000908152600f6020526040902054611704906116e5906116de9086906112f8565b8990611c2c565b6001600160a01b038a1660009081526010602052604090205490610f24565b6001600160a01b0390981660009081526010602090815260408083208b9055600f909152902092909255509495945050505050565b6000807f00000000000000000000000033b5ad38dcd817090474d4f79b75e1403384e0c86001600160a01b0316638bdff1616040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561179757600080fd5b505af11580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cf9190611e83565b60115490915083158015906117e357508115155b15611804576117fc6117f58386611c48565b8290610f24565b601181905590505b6001600160a01b0386166000908152601260205260409020548181141561184757505050506001600160a01b03831660009081526013602052604090205461057d565b61187d61185e61185784846112f8565b8890611c2c565b6001600160a01b03891660009081526013602052604090205490610f24565b6001600160a01b03881660009081526013602090815260408083208490556012909152902092909255509150509392505050565b6001600160a01b0382166000908152600c6020908152604080832054600854600b90935292208054600182015460028301546003840154929591949093818314156118fe57505050611ac4565b825b82811015611a91578715158061191557508615155b8061191f57508515155b156119ce57604051636809de6b60e01b81526001600160a01b037f000000000000000000000000289e69e5b611f6193694f6cfa2f93b7cf161253f1690636809de6b90611976908b908b908b9087906004016122c2565b60606040518083038186803b15801561198e57600080fd5b505afa1580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c69190611e9b565b919950975095505b600181016000908152600960209081526040808320600a909252909120548015611a87578154611a0f90611a089083906111c9908f611ae1565b8b90610f24565b9950611a36611a2f826111c98e8660010154611ae190919063ffffffff16565b8a90610f24565b9850611a5d611a56826111c98e8660020154611ae190919063ffffffff16565b8990610f24565b9750611a84611a7d826111c98e8660030154611ae190919063ffffffff16565b8890610f24565b96505b5050600101611900565b5086815560018101869055600281018590556003018390556001600160a01b0388166000908152600c6020526040902055505b92959194509250565b600061057d670de0b6b3a76400006111c985855b600082611af0575060006104b1565b82820282848281611afd57fe5b041461057d5760405162461bcd60e51b815260040161062390612117565b6000808211611b3c5760405162461bcd60e51b8152600401610623906120b6565b818381611b4557fe5b049392505050565b6000818310611b5c578161057d565b5090919050565b6060611bb8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c649092919063ffffffff16565b8051909150156113765780806020019051810190611bd69190611e4b565b6113765760405162461bcd60e51b815260040161062390612214565b600061c4e062093a8081611c068583610f24565b0381611c0e57fe5b0462093a8002019050919050565b60006104b182633b9aca00611ae1565b600061057d6b033b2e3c9fd0803ce80000006111c98585611ae1565b600061057d826111c9856b033b2e3c9fd0803ce8000000611ae1565b6060611c738484600085611c7b565b949350505050565b606082471015611c9d5760405162461bcd60e51b815260040161062390612070565b611ca685611d3c565b611cc25760405162461bcd60e51b8152600401610623906121dd565b60006060866001600160a01b03168587604051611cdf9190611f02565b60006040518083038185875af1925050503d8060008114611d1c576040519150601f19603f3d011682016040523d82523d6000602084013e611d21565b606091505b5091509150611d31828286611d42565b979650505050505050565b3b151590565b60608315611d5157508161057d565b825115611d615782518084602001fd5b8160405162461bcd60e51b81526004016106239190611f56565b80356001600160a01b03811681146104b157600080fd5b600060208284031215611da3578081fd5b61057d8383611d7b565b60008060408385031215611dbf578081fd5b611dc98484611d7b565b9150611dd88460208501611d7b565b90509250929050565b600080600060608486031215611df5578081fd5b8335611e008161233f565b92506020840135611e108161233f565b929592945050506040919091013590565b60008060408385031215611e33578182fd5b611e3d8484611d7b565b946020939093013593505050565b600060208284031215611e5c578081fd5b8151801515811461057d578182fd5b600060208284031215611e7c578081fd5b5035919050565b600060208284031215611e94578081fd5b5051919050565b600080600060608486031215611eaf578283fd5b8351925060208401519150604084015190509250925092565b600080600080600060a08688031215611edf578081fd5b505083359560208501359550604085013594606081013594506080013592509050565b60008251611f14818460208701612313565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152611f75816040850160208701612313565b601f01601f19169190910160400192915050565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f5472616e73666572206973206e6f7420616c6c6f776564000000000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526010908201526f04f6e6c7920737461626c6520737761760841b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604082015260600190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b93845260208401929092526040830152606082015260800190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60ff91909116815260200190565b60005b8381101561232e578181015183820152602001612316565b838111156108a55750506000910152565b6001600160a01b038116811461235457600080fd5b5056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a725368bf233e8051430484de0607d0fb51dc583765bb7b5dc20d7b3ddfc715264736f6c634300060c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
SCROLL | 100.00% | $0.171817 | 117,594.5494 | $20,204.74 |
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.