Overview
ETH Balance
ETH Value
$0.00Latest 25 from a total of 1,226 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Cast | 13241761 | 352 days ago | IN | 0 ETH | 0.00000594 | ||||
| Cast | 13233810 | 352 days ago | IN | 0 ETH | 0.00000624 | ||||
| Cast | 13162447 | 355 days ago | IN | 0 ETH | 0.00002152 | ||||
| Cast | 13142618 | 356 days ago | IN | 0 ETH | 0.0001179 | ||||
| Cast | 13142572 | 356 days ago | IN | 0 ETH | 0.00001241 | ||||
| Cast | 13104884 | 357 days ago | IN | 0 ETH | 0.00001141 | ||||
| Cast | 13087534 | 358 days ago | IN | 0 ETH | 0.00000733 | ||||
| Cast | 13079110 | 359 days ago | IN | 0 ETH | 0.00002077 | ||||
| Cast | 12988187 | 362 days ago | IN | 0 ETH | 0.00005469 | ||||
| Cast | 12980824 | 363 days ago | IN | 0 ETH | 0.00003447 | ||||
| Cast | 12960769 | 364 days ago | IN | 0 ETH | 0.00001746 | ||||
| Cast | 12960738 | 364 days ago | IN | 0 ETH | 0.00001959 | ||||
| Cast | 12960362 | 364 days ago | IN | 0 ETH | 0.00013546 | ||||
| Cast | 12960140 | 364 days ago | IN | 0 ETH | 0.00003158 | ||||
| Cast | 12960138 | 364 days ago | IN | 0 ETH | 0.00004541 | ||||
| Cast | 12945850 | 364 days ago | IN | 0 ETH | 0.00001111 | ||||
| Cast | 12937364 | 365 days ago | IN | 0 ETH | 0.00001531 | ||||
| Cast | 12935541 | 365 days ago | IN | 0 ETH | 0.00002171 | ||||
| Cast | 12931440 | 365 days ago | IN | 0 ETH | 0.00008536 | ||||
| Cast | 12930798 | 365 days ago | IN | 0 ETH | 0.0000324 | ||||
| Cast | 12926368 | 365 days ago | IN | 0 ETH | 0.00001442 | ||||
| Cast | 12924985 | 365 days ago | IN | 0 ETH | 0.00001631 | ||||
| Cast | 12898850 | 366 days ago | IN | 0 ETH | 0.00000839 | ||||
| Cast | 12767383 | 372 days ago | IN | 0 ETH | 0.00001096 | ||||
| Cast | 12765667 | 372 days ago | IN | 0 ETH | 0.00000961 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ControllerBallotV2
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/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../utils/CoreUtility.sol";
import "../utils/SafeDecimalMath.sol";
import "../governance/VotingEscrowCheckpoint.sol";
import "../interfaces/IControllerBallotV2.sol";
import "../interfaces/IVotingEscrow.sol";
contract ControllerBallotV2 is
IControllerBallotV2,
IVotingEscrowCallback,
Ownable,
CoreUtility,
VotingEscrowCheckpoint
{
using SafeMath for uint256;
using SafeDecimalMath for uint256;
event PoolAdded(address pool);
event PoolToggled(address indexed pool, bool isDisabled);
event Voted(
address indexed account,
uint256 oldAmount,
uint256 oldUnlockTime,
uint256[] oldWeights,
uint256 amount,
uint256 unlockTime,
uint256[] weights
);
IVotingEscrow public immutable votingEscrow;
address[65535] private _pools;
uint256 public poolSize;
uint256 public disabledPoolSize;
/// @notice Locked balance of an account, which is synchronized with `VotingEscrow` when
/// `syncWithVotingEscrow()` is called
mapping(address => IVotingEscrow.LockedBalance) public userLockedBalances;
/// @notice Mapping of account => pool => fraction of the user's veCHESS voted to the pool
mapping(address => mapping(address => uint256)) public userWeights;
/// @notice Mapping of pool => unlockTime => CHESS amount voted to the pool that will be
/// unlocked at unlockTime
mapping(address => mapping(uint256 => uint256)) public poolScheduledUnlock;
mapping(address => mapping(uint256 => uint256)) public poolVeSupplyPerWeek;
mapping(address => uint256) public poolTotalLocked;
mapping(address => uint256) public poolNextWeekSupply;
uint256 public checkpointWeek;
/// @notice Mapping of pool => status of the pool
mapping(uint256 => bool) public disabledPools;
constructor(
address votingEscrow_
) public VotingEscrowCheckpoint(IVotingEscrow(votingEscrow_).maxTime()) {
votingEscrow = IVotingEscrow(votingEscrow_);
checkpointWeek = _endOfWeek(block.timestamp) - 1 weeks;
}
function getPools() external view returns (address[] memory) {
uint256 size = poolSize;
address[] memory pools = new address[](size);
for (uint256 i = 0; i < size; i++) {
pools[i] = _pools[i];
}
return pools;
}
function addPool(address newPool) external onlyOwner {
uint256 size = poolSize;
_pools[size] = newPool;
poolSize = size + 1;
emit PoolAdded(newPool);
}
function togglePool(uint256 index) external onlyOwner {
require(index < poolSize, "Invalid index");
if (disabledPools[index]) {
disabledPools[index] = false;
disabledPoolSize--;
} else {
disabledPools[index] = true;
disabledPoolSize++;
}
emit PoolToggled(_pools[index], disabledPools[index]);
}
function balanceOf(address account) external view returns (uint256) {
return balanceOfAtTimestamp(account, block.timestamp);
}
function balanceOfAtTimestamp(
address account,
uint256 timestamp
) public view returns (uint256) {
require(timestamp >= block.timestamp, "Must be current or future time");
IVotingEscrow.LockedBalance memory locked = userLockedBalances[account];
if (timestamp >= locked.unlockTime) {
return 0;
}
return locked.amount.mul(locked.unlockTime - timestamp) / _maxTime;
}
function totalSupplyAtWeek(uint256 week) public view override returns (uint256) {
uint256 size = poolSize;
uint256 total = 0;
for (uint256 i = 0; i < size; i++) {
if (!disabledPools[i]) {
total = total.add(sumAtWeek(_pools[i], week));
}
}
return total;
}
function sumAtWeek(address pool, uint256 week) public view override returns (uint256) {
return
week <= checkpointWeek
? poolVeSupplyPerWeek[pool][week]
: _veTotalSupplyAtWeek(
week,
poolScheduledUnlock[pool],
checkpointWeek,
poolNextWeekSupply[pool],
poolTotalLocked[pool]
);
}
function count(
uint256 week
) external view override returns (uint256[] memory sums, address[] memory pools) {
uint256 poolSize_ = poolSize;
uint256 size = poolSize_ - disabledPoolSize;
pools = new address[](size);
uint256 j = 0;
for (uint256 i = 0; i < poolSize_ && j < size; i++) {
address pool = _pools[i];
if (!disabledPools[i]) pools[j++] = pool;
}
sums = new uint256[](size);
for (uint256 i = 0; i < size; i++) {
uint256 sum = sumAtWeek(pools[i], week);
sums[i] = sum;
}
}
function cast(uint256[] memory weights) external override {
uint256 size = poolSize;
require(weights.length == size, "Invalid number of weights");
uint256 totalWeight;
for (uint256 i = 0; i < size; i++) {
totalWeight = totalWeight.add(weights[i]);
}
require(totalWeight == 1e18, "Invalid weights");
uint256[] memory oldWeights = new uint256[](size);
for (uint256 i = 0; i < size; i++) {
oldWeights[i] = userWeights[msg.sender][_pools[i]];
}
IVotingEscrow.LockedBalance memory oldLockedBalance = userLockedBalances[msg.sender];
IVotingEscrow.LockedBalance memory lockedBalance = votingEscrow.getLockedBalance(
msg.sender
);
require(
lockedBalance.amount > 0 && lockedBalance.unlockTime > block.timestamp,
"No veCHESS"
);
_updateVoteStatus(msg.sender, size, oldWeights, weights, oldLockedBalance, lockedBalance);
}
function syncWithVotingEscrow(address account) external override {
IVotingEscrow.LockedBalance memory oldLockedBalance = userLockedBalances[account];
if (oldLockedBalance.amount == 0) {
return; // The account did not vote before
}
IVotingEscrow.LockedBalance memory lockedBalance = votingEscrow.getLockedBalance(account);
if (lockedBalance.unlockTime <= block.timestamp) {
return;
}
uint256 size = poolSize;
uint256[] memory weights = new uint256[](size);
for (uint256 i = 0; i < size; i++) {
weights[i] = userWeights[account][_pools[i]];
}
_updateVoteStatus(account, size, weights, weights, oldLockedBalance, lockedBalance);
}
function _updateVoteStatus(
address account,
uint256 size,
uint256[] memory oldWeights,
uint256[] memory weights,
IVotingEscrow.LockedBalance memory oldLockedBalance,
IVotingEscrow.LockedBalance memory lockedBalance
) private {
uint256 oldCheckpointWeek = checkpointWeek;
uint256 newCheckpointWeek;
for (uint256 i = 0; i < size; i++) {
address pool = _pools[i];
uint256 newNextWeekSupply;
uint256 newTotalLocked;
(newCheckpointWeek, newNextWeekSupply, newTotalLocked) = _veCheckpoint(
poolScheduledUnlock[pool],
oldCheckpointWeek,
poolNextWeekSupply[pool],
poolTotalLocked[pool],
poolVeSupplyPerWeek[pool]
);
(poolNextWeekSupply[pool], poolTotalLocked[pool]) = _veUpdateLock(
newNextWeekSupply,
newTotalLocked,
oldLockedBalance.amount.multiplyDecimal(oldWeights[i]),
oldLockedBalance.unlockTime,
lockedBalance.amount.multiplyDecimal(weights[i]),
lockedBalance.unlockTime,
poolScheduledUnlock[pool]
);
userWeights[account][pool] = weights[i];
}
checkpointWeek = newCheckpointWeek;
userLockedBalances[account] = lockedBalance;
emit Voted(
account,
oldLockedBalance.amount,
oldLockedBalance.unlockTime,
oldWeights,
lockedBalance.amount,
lockedBalance.unlockTime,
weights
);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}// 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 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;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../utils/CoreUtility.sol";
/// @dev This abstract contract incrementally calculates the total amount of veCHESS in each week.
/// A derived contract should maintain the following state variables:
///
/// * `mapping(uint256 => uint256) scheduledUnlock`, amount of CHESS that will be
/// unlocked in each week in the future.
/// * `mapping(uint256 => uint256) veSupplyPerWeek`, total veCHESS in each week in the past.
/// * `uint256 checkpointWeek`, start timestamp of the week when the checkpoint was updated
/// the last time.
/// * `uint256 nextWeekSupply`, total veCHESS at the end of the last checkpoint's week.
/// * `uint256 totalLocked`, amount of CHESS locked now.
abstract contract VotingEscrowCheckpoint is CoreUtility {
using SafeMath for uint256;
uint256 internal immutable _maxTime;
constructor(uint256 maxTime_) internal {
_maxTime = maxTime_;
}
/// @dev Update checkpoint to the given week and record weekly supply in the past.
/// This function should be called before any update to `scheduledUnlock`.
/// It writes new values to the `veSupplyPerWeek` mapping. Caller is responsible for
/// setting `checkpointWeek`, `nextWeekSupply` and `totalLocked` to the return values.
/// @param scheduledUnlock amount of CHESS that will be unlocked in each week
/// @param checkpointWeek the old checkpoint timestamp
/// @param nextWeekSupply total veCHESS at the end of the last checkpoint's week
/// @param totalLocked amount of CHESS locked in the last checkpoint
/// @param veSupplyPerWeek total veCHESS in each week, written by this function
/// @return newCheckpointWeek the new checkpoint timestamp
/// @return newNextWeekSupply total veCHESS at the end of this trading week
/// @return newTotalLocked amount of CHESS locked now
function _veCheckpoint(
mapping(uint256 => uint256) storage scheduledUnlock,
uint256 checkpointWeek,
uint256 nextWeekSupply,
uint256 totalLocked,
mapping(uint256 => uint256) storage veSupplyPerWeek
)
internal
returns (uint256 newCheckpointWeek, uint256 newNextWeekSupply, uint256 newTotalLocked)
{
uint256 nextWeek = _endOfWeek(block.timestamp);
for (uint256 w = checkpointWeek + 1 weeks; w < nextWeek; w += 1 weeks) {
veSupplyPerWeek[w] = nextWeekSupply;
// Remove CHESS unlocked at the beginning of the next week from total locked amount.
totalLocked = totalLocked.sub(scheduledUnlock[w]);
// Calculate supply at the end of the next week.
nextWeekSupply = nextWeekSupply.sub(totalLocked.mul(1 weeks) / _maxTime);
}
newCheckpointWeek = nextWeek - 1 weeks;
newNextWeekSupply = nextWeekSupply;
newTotalLocked = totalLocked;
}
/// @dev Update `scheduledUnlock` and the checkpoint according to the change of a user's locked CHESS.
/// This function should be called after the checkpoint is updated by `veCheckpoint()`.
/// It updates the `scheduledUnlock` mapping. Caller is responsible for setting
/// `nextWeekSupply` and `totalLocked` to the return values.
/// @param nextWeekSupply total veCHESS at the end of this trading week before this change
/// @param totalLocked amount of CHESS locked before this change
/// @param oldAmount old amount of locked CHESS
/// @param oldUnlockTime old unlock timestamp
/// @param newAmount new amount of locked CHESS
/// @param newUnlockTime new unlock timestamp
/// @param scheduledUnlock amount of CHESS that will be unlocked in each week, updated by this function
/// @return newNextWeekSupply total veCHESS at at the end of this trading week after this change
/// @return newTotalLocked amount of CHESS locked after this change
function _veUpdateLock(
uint256 nextWeekSupply,
uint256 totalLocked,
uint256 oldAmount,
uint256 oldUnlockTime,
uint256 newAmount,
uint256 newUnlockTime,
mapping(uint256 => uint256) storage scheduledUnlock
) internal returns (uint256 newNextWeekSupply, uint256 newTotalLocked) {
uint256 nextWeek = _endOfWeek(block.timestamp);
newTotalLocked = totalLocked;
newNextWeekSupply = nextWeekSupply;
// Remove the old schedule if there is one
if (oldAmount > 0 && oldUnlockTime >= nextWeek) {
newTotalLocked = newTotalLocked.sub(oldAmount);
newNextWeekSupply = newNextWeekSupply.sub(
oldAmount.mul(oldUnlockTime - nextWeek) / _maxTime
);
}
newTotalLocked = newTotalLocked.add(newAmount);
// Round up on division when added to the total supply, so that the total supply is never
// smaller than the sum of all accounts' veCHESS balance.
newNextWeekSupply = newNextWeekSupply.add(
newAmount.mul(newUnlockTime - nextWeek).add(_maxTime - 1) / _maxTime
);
if (oldUnlockTime == newUnlockTime) {
scheduledUnlock[oldUnlockTime] = scheduledUnlock[oldUnlockTime].sub(oldAmount).add(
newAmount
);
} else {
if (oldUnlockTime >= nextWeek) {
scheduledUnlock[oldUnlockTime] = scheduledUnlock[oldUnlockTime].sub(oldAmount);
}
scheduledUnlock[newUnlockTime] = scheduledUnlock[newUnlockTime].add(newAmount);
}
}
/// @dev Calculate the current total veCHESS amount from the last checkpoint.
/// @param scheduledUnlock amount of CHESS that will be unlocked in each week
/// @param checkpointWeek the last checkpoint timestamp
/// @param nextWeekSupply total veCHESS at the end of the last checkpoint's week
/// @param totalLocked amount of CHESS locked in the last checkpoint
/// @return Current total veCHESS amount
function _veTotalSupply(
mapping(uint256 => uint256) storage scheduledUnlock,
uint256 checkpointWeek,
uint256 nextWeekSupply,
uint256 totalLocked
) internal view returns (uint256) {
uint256 nextWeek = _endOfWeek(block.timestamp);
uint256 thisWeek = nextWeek - 1 weeks;
if (checkpointWeek + 1 weeks < nextWeek) {
for (uint256 w = checkpointWeek + 1 weeks; w < thisWeek; w += 1 weeks) {
// Remove CHESS unlocked at the beginning of the next week from total locked amount.
totalLocked = totalLocked.sub(scheduledUnlock[w]);
// Calculate supply at the end of the next week.
nextWeekSupply = nextWeekSupply.sub(totalLocked.mul(1 weeks) / _maxTime);
}
totalLocked = totalLocked.sub(scheduledUnlock[thisWeek]);
return nextWeekSupply.sub(totalLocked.mul(block.timestamp - thisWeek) / _maxTime);
} else {
return nextWeekSupply.add(totalLocked.mul(nextWeek - block.timestamp) / _maxTime);
}
}
/// @dev Calculate the total veCHESS amount at a given trading week boundary. The given week
/// start timestamp must be later than the last checkpoint. For older weeks,
/// derived contract should read from the `veSupplyPerWeek` mapping instead.
/// @param week Start timestamp of a trading week, must be greater than `checkpointWeek`
/// @param scheduledUnlock amount of CHESS that will be unlocked in each week
/// @param checkpointWeek the last checkpoint timestamp
/// @param nextWeekSupply total veCHESS at the end of the last checkpoint's week
/// @param totalLocked amount of CHESS locked in the last checkpoint
/// @return Total veCHESS amount at `week`
function _veTotalSupplyAtWeek(
uint256 week,
mapping(uint256 => uint256) storage scheduledUnlock,
uint256 checkpointWeek,
uint256 nextWeekSupply,
uint256 totalLocked
) internal view returns (uint256) {
if (checkpointWeek + 1 weeks < week) {
for (uint256 w = checkpointWeek + 1 weeks; w < week; w += 1 weeks) {
// Remove CHESS unlocked at the beginning of the next week from total locked amount.
totalLocked = totalLocked.sub(scheduledUnlock[w]);
// Calculate supply at the end of the next week.
nextWeekSupply = nextWeekSupply.sub(totalLocked.mul(1 weeks) / _maxTime);
}
}
return nextWeekSupply;
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;
interface IControllerBallotV2 {
function totalSupplyAtWeek(uint256 week) external view returns (uint256);
function sumAtWeek(address pool, uint256 week) external view returns (uint256);
function count(
uint256 week
) external view returns (uint256[] memory sums, address[] memory funds);
function cast(uint256[] memory weights) external;
}// 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
Contract ABI
API[{"inputs":[{"internalType":"address","name":"votingEscrow_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"bool","name":"isDisabled","type":"bool"}],"name":"PoolToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldUnlockTime","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"oldWeights","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockTime","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"weights","type":"uint256[]"}],"name":"Voted","type":"event"},{"inputs":[{"internalType":"address","name":"newPool","type":"address"}],"name":"addPool","outputs":[],"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":"timestamp","type":"uint256"}],"name":"balanceOfAtTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"weights","type":"uint256[]"}],"name":"cast","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkpointWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"count","outputs":[{"internalType":"uint256[]","name":"sums","type":"uint256[]"},{"internalType":"address[]","name":"pools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disabledPoolSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"disabledPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPools","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolNextWeekSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolScheduledUnlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolTotalLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolVeSupplyPerWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"week","type":"uint256"}],"name":"sumAtWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"syncWithVotingEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"togglePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"week","type":"uint256"}],"name":"totalSupplyAtWeek","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userLockedBalances","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"unlockTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userWeights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c06040523480156200001157600080fd5b5060405162001d1d38038062001d1d8339810160408190526200003491620001ac565b806001600160a01b03166322e67e716040518163ffffffff1660e01b815260040160206040518083038186803b1580156200006e57600080fd5b505afa15801562000083573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000a99190620001d5565b6000620000b562000130565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506080526001600160601b0319606082901b1660a05262093a80620001234262000134565b0362010008555062000225565b3390565b600061c4e062093a8061c4e06200015d62093a80866200017460201b62000f7b1790919060201c565b03816200016657fe5b0462093a8002019050919050565b600082820183811015620001a55760405162461bcd60e51b81526004016200019c90620001ee565b60405180910390fd5b9392505050565b600060208284031215620001be578081fd5b81516001600160a01b0381168114620001a5578182fd5b600060208284031215620001e7578081fd5b5051919050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60805160a05160601c611ab36200026a600039806106da52806108b45280610bc0525080610699528061122252806112c1528061137752806113c65250611ab36000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063ac434e3c1161007c578063ac434e3c146102b4578063c1c98b62146102c7578063c617afea146102e7578063d914cd4b146102fa578063e973eae61461030d578063f2fde38b1461032057610158565b806370a0823114610263578063715018a6146102765780638043f7311461027e5780638da5cb5b146102915780639050fd4e14610299578063a37b9691146102ac57610158565b80634f2bfe5b116101155780634f2bfe5b146101df57806350a45f28146101f45780635949b7391461020757806359bbf12514610228578063673a2a1f1461023b5780636ce8e3911461025057610158565b80630bd402b41461015d57806315bbc6ce1461017b5780631cb197151461018e5780633b3546c8146101a35780634ec18db9146101c45780634f2ba10c146101cc575b600080fd5b610165610333565b60405161017291906119d5565b60405180910390f35b610165610189366004611582565b61033b565b6101a161019c3660046116a8565b61035a565b005b6101b66101b13660046116a8565b61049e565b604051610172929190611759565b610165610619565b6101656101da3660046115b6565b610621565b6101e76106d8565b6040516101729190611732565b610165610202366004611567565b6106fc565b61021a610215366004611567565b610710565b6040516101729291906119de565b6101a16102363660046115e0565b61072b565b610243610980565b6040516101729190611746565b61016561025e3660046115b6565b610a29565b610165610271366004611567565b610a48565b6101a1610a54565b61016561028c3660046116a8565b610add565b6101e7610b47565b6101a16102a7366004611567565b610b56565b610165610d2b565b6101656102c23660046115b6565b610d33565b6102da6102d53660046116a8565b610dba565b6040516101729190611787565b6101656102f5366004611567565b610dd1565b6101a1610308366004611567565b610de5565b61016561031b3660046115b6565b610e9c565b6101a161032e366004611567565b610ebb565b620100085481565b6201000360209081526000928352604080842090915290825290205481565b610362610fa0565b6001600160a01b0316610373610b47565b6001600160a01b0316146103a25760405162461bcd60e51b815260040161039990611932565b60405180910390fd5b620100005481106103c55760405162461bcd60e51b81526004016103999061180f565b600081815262010009602052604090205460ff16156104075760008181526201000960205260409020805460ff19169055620100018054600019019055610431565b60008181526201000960205260409020805460ff1916600190811790915562010001805490910190555b60018161ffff811061043f57fe5b01546000828152620100096020526040908190205490516001600160a01b03909216917f5ce37b4fb147b3a9177c0b6e90e44b3ae3f358909648be2580c7daa0a28941a5916104939160ff90911690611787565b60405180910390a250565b62010000546201000154606091829181038067ffffffffffffffff811180156104c657600080fd5b506040519080825280602002602001820160405280156104f0578160200160208202803683370190505b5092506000805b838110801561050557508282105b1561057e57600060018261ffff811061051a57fe5b015460008381526201000960205260409020546001600160a01b03909116915060ff16610575578086848060010195508151811061055457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b506001016104f7565b508167ffffffffffffffff8111801561059657600080fd5b506040519080825280602002602001820160405280156105c0578160200160208202803683370190505b50945060005b828110156106105760006105ed8683815181106105df57fe5b602002602001015189610d33565b9050808783815181106105fc57fe5b6020908102919091010152506001016105c6565b50505050915091565b620100005481565b6000428210156106435760405162461bcd60e51b815260040161039990611967565b61064b611536565b506001600160a01b03831660009081526201000260209081526040918290208251808401909352805483526001015490820181905283106106905760009150506106d2565b602081015181517f0000000000000000000000000000000000000000000000000000000000000000916106c69190869003610fa4565b816106cd57fe5b049150505b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b620100066020526000908152604090205481565b62010002602052600090815260409020805460019091015482565b6201000054815181146107505760405162461bcd60e51b81526004016103999061199e565b6000805b8281101561078c5761078284828151811061076b57fe5b602002602001015183610f7b90919063ffffffff16565b9150600101610754565b5080670de0b6b3a7640000146107b45760405162461bcd60e51b8152600401610399906118c8565b60608267ffffffffffffffff811180156107cd57600080fd5b506040519080825280602002602001820160405280156107f7578160200160208202803683370190505b50905060005b838110156108625733600090815262010003602052604081209060018361ffff811061082557fe5b01546001600160a01b03168152602081019190915260400160002054825183908390811061084f57fe5b60209081029190910101526001016107fd565b5061086b611536565b50336000908152620100026020908152604091829020825180840190935280548352600101549082015261089d611536565b60405163c408689360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c4086893906108e9903390600401611732565b604080518083038186803b15801561090057600080fd5b505afa158015610914573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109389190611675565b80519091501580159061094e5750428160200151115b61096a5760405162461bcd60e51b815260040161039990611836565b610978338685898686610fde565b505050505050565b6201000054606090818167ffffffffffffffff811180156109a057600080fd5b506040519080825280602002602001820160405280156109ca578160200160208202803683370190505b50905060005b82811015610a225760018161ffff81106109e657fe5b015482516001600160a01b0390911690839083908110610a0257fe5b6001600160a01b03909216602092830291909101909101526001016109d0565b5091505090565b6201000560209081526000928352604080842090915290825290205481565b60006106d28242610621565b610a5c610fa0565b6001600160a01b0316610a6d610b47565b6001600160a01b031614610a935760405162461bcd60e51b815260040161039990611932565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b620100005460009081805b82811015610b3f57600081815262010009602052604090205460ff16610b3757610b34610b2d60018361ffff8110610b1c57fe5b01546001600160a01b031687610d33565b8390610f7b565b91505b600101610ae8565b509392505050565b6000546001600160a01b031690565b610b5e611536565b506001600160a01b03811660009081526201000260209081526040918290208251808401909352805480845260019091015491830191909152610ba15750610d28565b610ba9611536565b60405163c408689360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c408689390610bf5908690600401611732565b604080518083038186803b158015610c0c57600080fd5b505afa158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c449190611675565b905042816020015111610c58575050610d28565b620100005460608167ffffffffffffffff81118015610c7657600080fd5b50604051908082528060200260200182016040528015610ca0578160200160208202803683370190505b50905060005b82811015610d14576001600160a01b038616600090815262010003602052604081209060018361ffff8110610cd757fe5b01546001600160a01b031681526020810191909152604001600020548251839083908110610d0157fe5b6020908102919091010152600101610ca6565b50610d23858383848888610fde565b505050505b50565b620100015481565b60006201000854821115610d8c576001600160a01b03831660009081526201000460209081526040808320620100085462010007845282852054620100069094529190932054610d879386939092916111e3565b610db3565b6001600160a01b038316600090815262010005602090815260408083208584529091529020545b9392505050565b620100096020526000908152604090205460ff1681565b620100076020526000908152604090205481565b610ded610fa0565b6001600160a01b0316610dfe610b47565b6001600160a01b031614610e245760405162461bcd60e51b815260040161039990611932565b62010000548160018261ffff8110610e3857fe5b0180546001600160a01b0319166001600160a01b03929092169190911790556001810162010000556040517f73cca62ab1b520c9715bf4e6c71e3e518c754e7148f65102f43289a7df0efea690610e90908490611732565b60405180910390a15050565b6201000460209081526000928352604080842090915290825290205481565b610ec3610fa0565b6001600160a01b0316610ed4610b47565b6001600160a01b031614610efa5760405162461bcd60e51b815260040161039990611932565b6001600160a01b038116610f205760405162461bcd60e51b815260040161039990611792565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015610db35760405162461bcd60e51b8152600401610399906117d8565b3390565b600082610fb3575060006106d2565b82820282848281610fc057fe5b0414610db35760405162461bcd60e51b8152600401610399906118f1565b62010008546000805b8781101561115d57600060018261ffff8110610fff57fe5b01546001600160a01b031660008181526201000460209081526040808320620100078352818420546201000684528285205462010005909452918420949550929384936110529390928a92909190611276565b8093508194508297505050506110e2828261108d8d888151811061107257fe5b60200260200101518c6000015161131d90919063ffffffff16565b8b602001516110bc8e8a815181106110a157fe5b60200260200101518d6000015161131d90919063ffffffff16565b6020808e01516001600160a01b038b16600090815262010004909252604090912061133b565b6001600160a01b03851660009081526201000760209081526040808320620100069092529091209190915555885189908590811061111c57fe5b6020908102919091018101516001600160a01b03808f1660009081526201000384526040808220979092168152959092529320929092555050600101610fe7565b50620100088190556001600160a01b0388166000818152620100026020908152604091829020865180825582880151600190920182905588519289015193517f5fbab493d4efb9b96ce2165e7532fa70b5941945cf8d87cb392b9ca9e2322d9f946111d1949390928d929091908d906119ec565b60405180910390a25050505050505050565b6000858462093a8001101561126c5762093a8084015b8681101561126a5760008181526020879052604090205461121b9084906114b2565b925061125e7f000000000000000000000000000000000000000000000000000000000000000061124e8562093a80610fa4565b8161125557fe5b869190046114b2565b935062093a80016111f9565b505b5090949350505050565b600080600080611285426114da565b905062093a8088015b81811015611309576000818152602087815260408083208b9055908c90529020546112ba9088906114b2565b96506112fd7f00000000000000000000000000000000000000000000000000000000000000006112ed8962093a80610fa4565b816112f457fe5b8a9190046114b2565b975062093a800161128e565b5062093a7f19019895975093955050505050565b6000610db3670de0b6b3a76400006113358585610fa4565b90611504565b6000806000611349426114da565b90508891508992506000881180156113615750808710155b156113b55761137082896114b2565b91506113b27f00000000000000000000000000000000000000000000000000000000000000006113a28a848b03610fa4565b816113a957fe5b859190046114b2565b92505b6113bf8287610f7b565b915061140f7f00000000000000000000000000000000000000000000000000000000000000006113ff60001982016113f98a868b03610fa4565b90610f7b565b8161140657fe5b85919004610f7b565b92508487141561144c576000878152602085905260409020546114389087906113f9908b6114b2565b6000888152602086905260409020556114a5565b80871061147c5760008781526020859052604090205461146c90896114b2565b6000888152602086905260409020555b6000858152602085905260409020546114959087610f7b565b6000868152602086905260409020555b5097509795505050505050565b6000828211156114d45760405162461bcd60e51b81526004016103999061185a565b50900390565b600061c4e062093a80816114ee8583610f7b565b03816114f657fe5b0462093a8002019050919050565b60008082116115255760405162461bcd60e51b815260040161039990611891565b81838161152e57fe5b049392505050565b604051806040016040528060008152602001600081525090565b80356001600160a01b03811681146106d257600080fd5b600060208284031215611578578081fd5b610db38383611550565b60008060408385031215611594578081fd5b61159e8484611550565b91506115ad8460208501611550565b90509250929050565b600080604083850312156115c8578182fd5b6115d28484611550565b946020939093013593505050565b600060208083850312156115f2578182fd5b823567ffffffffffffffff811115611608578283fd5b8301601f81018513611618578283fd5b803561162b61162682611a5d565b611a36565b8181528381019083850185840285018601891015611647578687fd5b8694505b8385101561166957803583526001949094019391850191850161164b565b50979650505050505050565b600060408284031215611686578081fd5b6116906040611a36565b82518152602083015160208201528091505092915050565b6000602082840312156116b9578081fd5b5035919050565b6000815180845260208085019450808401835b838110156116f85781516001600160a01b0316875295820195908201906001016116d3565b509495945050505050565b6000815180845260208085019450808401835b838110156116f857815187529582019590820190600101611716565b6001600160a01b0391909116815260200190565b600060208252610db360208301846116c0565b60006040825261176c6040830185611703565b828103602084015261177e81856116c0565b95945050505050565b901515815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600d908201526c092dcecc2d8d2c840d2dcc8caf609b1b604082015260600190565b6020808252600a90820152694e6f207665434845535360b01b604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252600f908201526e496e76616c6964207765696768747360881b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601e908201527f4d7573742062652063757272656e74206f72206675747572652074696d650000604082015260600190565b60208082526019908201527f496e76616c6964206e756d626572206f66207765696768747300000000000000604082015260600190565b90815260200190565b918252602082015260400190565b600087825286602083015260c06040830152611a0b60c0830187611703565b85606084015284608084015282810360a0840152611a298185611703565b9998505050505050505050565b60405181810167ffffffffffffffff81118282101715611a5557600080fd5b604052919050565b600067ffffffffffffffff821115611a73578081fd5b506020908102019056fea26469706673582212203752e2b2fe0fb2acb4720032df1a08befcba003a9d01dc1cd00606b48ba47fbe64736f6c634300060c0033000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063ac434e3c1161007c578063ac434e3c146102b4578063c1c98b62146102c7578063c617afea146102e7578063d914cd4b146102fa578063e973eae61461030d578063f2fde38b1461032057610158565b806370a0823114610263578063715018a6146102765780638043f7311461027e5780638da5cb5b146102915780639050fd4e14610299578063a37b9691146102ac57610158565b80634f2bfe5b116101155780634f2bfe5b146101df57806350a45f28146101f45780635949b7391461020757806359bbf12514610228578063673a2a1f1461023b5780636ce8e3911461025057610158565b80630bd402b41461015d57806315bbc6ce1461017b5780631cb197151461018e5780633b3546c8146101a35780634ec18db9146101c45780634f2ba10c146101cc575b600080fd5b610165610333565b60405161017291906119d5565b60405180910390f35b610165610189366004611582565b61033b565b6101a161019c3660046116a8565b61035a565b005b6101b66101b13660046116a8565b61049e565b604051610172929190611759565b610165610619565b6101656101da3660046115b6565b610621565b6101e76106d8565b6040516101729190611732565b610165610202366004611567565b6106fc565b61021a610215366004611567565b610710565b6040516101729291906119de565b6101a16102363660046115e0565b61072b565b610243610980565b6040516101729190611746565b61016561025e3660046115b6565b610a29565b610165610271366004611567565b610a48565b6101a1610a54565b61016561028c3660046116a8565b610add565b6101e7610b47565b6101a16102a7366004611567565b610b56565b610165610d2b565b6101656102c23660046115b6565b610d33565b6102da6102d53660046116a8565b610dba565b6040516101729190611787565b6101656102f5366004611567565b610dd1565b6101a1610308366004611567565b610de5565b61016561031b3660046115b6565b610e9c565b6101a161032e366004611567565b610ebb565b620100085481565b6201000360209081526000928352604080842090915290825290205481565b610362610fa0565b6001600160a01b0316610373610b47565b6001600160a01b0316146103a25760405162461bcd60e51b815260040161039990611932565b60405180910390fd5b620100005481106103c55760405162461bcd60e51b81526004016103999061180f565b600081815262010009602052604090205460ff16156104075760008181526201000960205260409020805460ff19169055620100018054600019019055610431565b60008181526201000960205260409020805460ff1916600190811790915562010001805490910190555b60018161ffff811061043f57fe5b01546000828152620100096020526040908190205490516001600160a01b03909216917f5ce37b4fb147b3a9177c0b6e90e44b3ae3f358909648be2580c7daa0a28941a5916104939160ff90911690611787565b60405180910390a250565b62010000546201000154606091829181038067ffffffffffffffff811180156104c657600080fd5b506040519080825280602002602001820160405280156104f0578160200160208202803683370190505b5092506000805b838110801561050557508282105b1561057e57600060018261ffff811061051a57fe5b015460008381526201000960205260409020546001600160a01b03909116915060ff16610575578086848060010195508151811061055457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b506001016104f7565b508167ffffffffffffffff8111801561059657600080fd5b506040519080825280602002602001820160405280156105c0578160200160208202803683370190505b50945060005b828110156106105760006105ed8683815181106105df57fe5b602002602001015189610d33565b9050808783815181106105fc57fe5b6020908102919091010152506001016105c6565b50505050915091565b620100005481565b6000428210156106435760405162461bcd60e51b815260040161039990611967565b61064b611536565b506001600160a01b03831660009081526201000260209081526040918290208251808401909352805483526001015490820181905283106106905760009150506106d2565b602081015181517f00000000000000000000000000000000000000000000000000000000077f8800916106c69190869003610fa4565b816106cd57fe5b049150505b92915050565b7f000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba81565b620100066020526000908152604090205481565b62010002602052600090815260409020805460019091015482565b6201000054815181146107505760405162461bcd60e51b81526004016103999061199e565b6000805b8281101561078c5761078284828151811061076b57fe5b602002602001015183610f7b90919063ffffffff16565b9150600101610754565b5080670de0b6b3a7640000146107b45760405162461bcd60e51b8152600401610399906118c8565b60608267ffffffffffffffff811180156107cd57600080fd5b506040519080825280602002602001820160405280156107f7578160200160208202803683370190505b50905060005b838110156108625733600090815262010003602052604081209060018361ffff811061082557fe5b01546001600160a01b03168152602081019190915260400160002054825183908390811061084f57fe5b60209081029190910101526001016107fd565b5061086b611536565b50336000908152620100026020908152604091829020825180840190935280548352600101549082015261089d611536565b60405163c408689360e01b81526001600160a01b037f000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba169063c4086893906108e9903390600401611732565b604080518083038186803b15801561090057600080fd5b505afa158015610914573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109389190611675565b80519091501580159061094e5750428160200151115b61096a5760405162461bcd60e51b815260040161039990611836565b610978338685898686610fde565b505050505050565b6201000054606090818167ffffffffffffffff811180156109a057600080fd5b506040519080825280602002602001820160405280156109ca578160200160208202803683370190505b50905060005b82811015610a225760018161ffff81106109e657fe5b015482516001600160a01b0390911690839083908110610a0257fe5b6001600160a01b03909216602092830291909101909101526001016109d0565b5091505090565b6201000560209081526000928352604080842090915290825290205481565b60006106d28242610621565b610a5c610fa0565b6001600160a01b0316610a6d610b47565b6001600160a01b031614610a935760405162461bcd60e51b815260040161039990611932565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b620100005460009081805b82811015610b3f57600081815262010009602052604090205460ff16610b3757610b34610b2d60018361ffff8110610b1c57fe5b01546001600160a01b031687610d33565b8390610f7b565b91505b600101610ae8565b509392505050565b6000546001600160a01b031690565b610b5e611536565b506001600160a01b03811660009081526201000260209081526040918290208251808401909352805480845260019091015491830191909152610ba15750610d28565b610ba9611536565b60405163c408689360e01b81526001600160a01b037f000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba169063c408689390610bf5908690600401611732565b604080518083038186803b158015610c0c57600080fd5b505afa158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c449190611675565b905042816020015111610c58575050610d28565b620100005460608167ffffffffffffffff81118015610c7657600080fd5b50604051908082528060200260200182016040528015610ca0578160200160208202803683370190505b50905060005b82811015610d14576001600160a01b038616600090815262010003602052604081209060018361ffff8110610cd757fe5b01546001600160a01b031681526020810191909152604001600020548251839083908110610d0157fe5b6020908102919091010152600101610ca6565b50610d23858383848888610fde565b505050505b50565b620100015481565b60006201000854821115610d8c576001600160a01b03831660009081526201000460209081526040808320620100085462010007845282852054620100069094529190932054610d879386939092916111e3565b610db3565b6001600160a01b038316600090815262010005602090815260408083208584529091529020545b9392505050565b620100096020526000908152604090205460ff1681565b620100076020526000908152604090205481565b610ded610fa0565b6001600160a01b0316610dfe610b47565b6001600160a01b031614610e245760405162461bcd60e51b815260040161039990611932565b62010000548160018261ffff8110610e3857fe5b0180546001600160a01b0319166001600160a01b03929092169190911790556001810162010000556040517f73cca62ab1b520c9715bf4e6c71e3e518c754e7148f65102f43289a7df0efea690610e90908490611732565b60405180910390a15050565b6201000460209081526000928352604080842090915290825290205481565b610ec3610fa0565b6001600160a01b0316610ed4610b47565b6001600160a01b031614610efa5760405162461bcd60e51b815260040161039990611932565b6001600160a01b038116610f205760405162461bcd60e51b815260040161039990611792565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082820183811015610db35760405162461bcd60e51b8152600401610399906117d8565b3390565b600082610fb3575060006106d2565b82820282848281610fc057fe5b0414610db35760405162461bcd60e51b8152600401610399906118f1565b62010008546000805b8781101561115d57600060018261ffff8110610fff57fe5b01546001600160a01b031660008181526201000460209081526040808320620100078352818420546201000684528285205462010005909452918420949550929384936110529390928a92909190611276565b8093508194508297505050506110e2828261108d8d888151811061107257fe5b60200260200101518c6000015161131d90919063ffffffff16565b8b602001516110bc8e8a815181106110a157fe5b60200260200101518d6000015161131d90919063ffffffff16565b6020808e01516001600160a01b038b16600090815262010004909252604090912061133b565b6001600160a01b03851660009081526201000760209081526040808320620100069092529091209190915555885189908590811061111c57fe5b6020908102919091018101516001600160a01b03808f1660009081526201000384526040808220979092168152959092529320929092555050600101610fe7565b50620100088190556001600160a01b0388166000818152620100026020908152604091829020865180825582880151600190920182905588519289015193517f5fbab493d4efb9b96ce2165e7532fa70b5941945cf8d87cb392b9ca9e2322d9f946111d1949390928d929091908d906119ec565b60405180910390a25050505050505050565b6000858462093a8001101561126c5762093a8084015b8681101561126a5760008181526020879052604090205461121b9084906114b2565b925061125e7f00000000000000000000000000000000000000000000000000000000077f880061124e8562093a80610fa4565b8161125557fe5b869190046114b2565b935062093a80016111f9565b505b5090949350505050565b600080600080611285426114da565b905062093a8088015b81811015611309576000818152602087815260408083208b9055908c90529020546112ba9088906114b2565b96506112fd7f00000000000000000000000000000000000000000000000000000000077f88006112ed8962093a80610fa4565b816112f457fe5b8a9190046114b2565b975062093a800161128e565b5062093a7f19019895975093955050505050565b6000610db3670de0b6b3a76400006113358585610fa4565b90611504565b6000806000611349426114da565b90508891508992506000881180156113615750808710155b156113b55761137082896114b2565b91506113b27f00000000000000000000000000000000000000000000000000000000077f88006113a28a848b03610fa4565b816113a957fe5b859190046114b2565b92505b6113bf8287610f7b565b915061140f7f00000000000000000000000000000000000000000000000000000000077f88006113ff60001982016113f98a868b03610fa4565b90610f7b565b8161140657fe5b85919004610f7b565b92508487141561144c576000878152602085905260409020546114389087906113f9908b6114b2565b6000888152602086905260409020556114a5565b80871061147c5760008781526020859052604090205461146c90896114b2565b6000888152602086905260409020555b6000858152602085905260409020546114959087610f7b565b6000868152602086905260409020555b5097509795505050505050565b6000828211156114d45760405162461bcd60e51b81526004016103999061185a565b50900390565b600061c4e062093a80816114ee8583610f7b565b03816114f657fe5b0462093a8002019050919050565b60008082116115255760405162461bcd60e51b815260040161039990611891565b81838161152e57fe5b049392505050565b604051806040016040528060008152602001600081525090565b80356001600160a01b03811681146106d257600080fd5b600060208284031215611578578081fd5b610db38383611550565b60008060408385031215611594578081fd5b61159e8484611550565b91506115ad8460208501611550565b90509250929050565b600080604083850312156115c8578182fd5b6115d28484611550565b946020939093013593505050565b600060208083850312156115f2578182fd5b823567ffffffffffffffff811115611608578283fd5b8301601f81018513611618578283fd5b803561162b61162682611a5d565b611a36565b8181528381019083850185840285018601891015611647578687fd5b8694505b8385101561166957803583526001949094019391850191850161164b565b50979650505050505050565b600060408284031215611686578081fd5b6116906040611a36565b82518152602083015160208201528091505092915050565b6000602082840312156116b9578081fd5b5035919050565b6000815180845260208085019450808401835b838110156116f85781516001600160a01b0316875295820195908201906001016116d3565b509495945050505050565b6000815180845260208085019450808401835b838110156116f857815187529582019590820190600101611716565b6001600160a01b0391909116815260200190565b600060208252610db360208301846116c0565b60006040825261176c6040830185611703565b828103602084015261177e81856116c0565b95945050505050565b901515815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252600d908201526c092dcecc2d8d2c840d2dcc8caf609b1b604082015260600190565b6020808252600a90820152694e6f207665434845535360b01b604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252600f908201526e496e76616c6964207765696768747360881b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601e908201527f4d7573742062652063757272656e74206f72206675747572652074696d650000604082015260600190565b60208082526019908201527f496e76616c6964206e756d626572206f66207765696768747300000000000000604082015260600190565b90815260200190565b918252602082015260400190565b600087825286602083015260c06040830152611a0b60c0830187611703565b85606084015284608084015282810360a0840152611a298185611703565b9998505050505050505050565b60405181810167ffffffffffffffff81118282101715611a5557600080fd5b604052919050565b600067ffffffffffffffff821115611a73578081fd5b506020908102019056fea26469706673582212203752e2b2fe0fb2acb4720032df1a08befcba003a9d01dc1cd00606b48ba47fbe64736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba
-----Decoded View---------------
Arg [0] : votingEscrow_ (address): 0xffD17794bF2e3BA798170f358225763F1aF8f5ba
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000ffd17794bf2e3ba798170f358225763f1af8f5ba
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.