Source Code
Overview
CELO Balance
CELO Value
$0.00Multichain Info
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
InvitesV2
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 0 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "../Interfaces.sol";
import "../utils/NameService.sol";
import "../utils/DAOUpgradeableContract.sol";
// import "hardhat/console.sol";
/**
* @title InvitesV1 contract that handles invites with pre allocated bounty pool
* 1.1 adds invitee bonus
* 2 uses uups upgradeable - not compatible upgrade for v1
*/
contract InvitesV2 is DAOUpgradeableContract {
struct Stats {
uint256 totalApprovedInvites;
uint256 totalBountiesPaid;
uint256 totalInvited;
uint256[5] __reserevedSpace;
}
struct User {
address invitedBy;
bytes32 inviteCode;
bool bountyPaid;
address[] invitees;
address[] pending;
uint256 level;
uint256 levelStarted;
uint256 totalApprovedInvites;
uint256 totalEarned;
uint256 joinedAt;
uint256[5] __reserevedSpace;
}
struct Level {
uint256 toNext;
uint256 bounty; //in G$ cents ie 2 decimals
uint256 daysToComplete;
uint256[5] __reserevedSpace;
}
mapping(bytes32 => address) public codeToUser;
mapping(address => User) public users;
mapping(uint256 => Level) public levels;
address public owner;
cERC20 public goodDollar;
bool public active;
Stats public stats;
bool public levelExpirationEnabled;
event InviteeJoined(address indexed inviter, address indexed invitee);
event InviterBounty(
address indexed inviter,
address indexed invitee,
uint256 bountyPaid,
uint256 inviterLevel,
bool earnedLevel
);
modifier ownerOrAvatar() {
require(
msg.sender == owner || msg.sender == avatar,
"Only owner or avatar can perform this action"
);
_;
}
modifier isActive() {
require(active, "not active");
_;
}
function initialize(
INameService _ns,
uint256 _level0Bounty,
address _owner
) public initializer {
__init_invites(_ns, _level0Bounty, _owner);
}
function __init_invites(
INameService _ns,
uint256 _level0Bounty,
address _owner
) internal virtual {
setDAO(_ns);
owner = _owner;
active = true;
Level storage lvl = levels[0];
lvl.bounty = _level0Bounty;
goodDollar = cERC20(nameService.getAddress("GOODDOLLAR"));
levelExpirationEnabled = false;
}
function _authorizeUpgrade(
address newImplementation
) internal override ownerOrAvatar {}
function getIdentity() public view returns (IIdentityV2) {
return IIdentityV2(nameService.getAddress("IDENTITY"));
}
function setLevelExpirationEnabled(bool _isEnabled) public ownerOrAvatar {
levelExpirationEnabled = _isEnabled;
}
function join(bytes32 _myCode, bytes32 _inviterCode) public isActive {
require(
codeToUser[_myCode] == address(0) ||
codeToUser[_myCode] == msg.sender ||
address(uint160(uint256(_myCode))) == msg.sender,
"invite code already in use"
);
require(_myCode != _inviterCode, "self invite");
User storage user = users[msg.sender]; // this is not expensive as user is new
address inviter = codeToUser[_inviterCode];
//allow user to set inviter if doesnt have one
require(
user.inviteCode == 0x0 ||
(user.invitedBy == address(0) && inviter != address(0)),
"user already joined"
);
if (user.inviteCode == 0x0) {
user.inviteCode = _myCode;
user.levelStarted = block.timestamp;
user.joinedAt = block.timestamp;
codeToUser[_myCode] = msg.sender;
}
if (inviter != address(0)) {
require(inviter != msg.sender, "self invite");
user.invitedBy = inviter;
users[inviter].invitees.push(msg.sender);
users[inviter].pending.push(msg.sender);
stats.totalInvited += 1;
}
if (canCollectBountyFor(msg.sender)) {
_bountyFor(msg.sender, true);
}
emit InviteeJoined(inviter, msg.sender);
}
function _whitelistedOnChainOrDefault(
address _invitee
) internal view returns (uint256 chainId) {
(bool success, bytes memory result) = address(getIdentity()).staticcall(
abi.encodeWithSignature("getWhitelistedOnChainId(address)", _invitee)
);
if (success == false) {
return _chainId();
}
return abi.decode(result, (uint256));
}
function canCollectBountyFor(address _invitee) public view returns (bool) {
address invitedBy = users[_invitee].invitedBy;
uint256 daysToComplete = levels[users[invitedBy].level].daysToComplete;
bool isLevelExpired = levelExpirationEnabled == true &&
daysToComplete > 0 &&
daysToComplete <
(users[_invitee].joinedAt - users[invitedBy].levelStarted) / 1 days;
return
invitedBy != address(0) &&
!users[_invitee].bountyPaid &&
getIdentity().isWhitelisted(_invitee) &&
getIdentity().isWhitelisted(invitedBy) &&
_whitelistedOnChainOrDefault(_invitee) == _chainId() &&
isLevelExpired == false;
}
function getInvitees(
address _inviter
) public view returns (address[] memory) {
return users[_inviter].invitees;
}
function getPendingInvitees(
address _inviter
) public view returns (address[] memory) {
address[] memory pending = users[_inviter].pending;
uint256 cur = 0;
uint256 total = 0;
for (uint256 i; i < pending.length; i++) {
if (!users[pending[i]].bountyPaid) {
total++;
}
}
address[] memory result = new address[](total);
for (uint256 i; i < pending.length; i++) {
if (!users[pending[i]].bountyPaid) {
result[cur] = pending[i];
cur++;
}
}
return result;
}
function getPendingBounties(address _inviter) public view returns (uint256) {
address[] memory pending = users[_inviter].pending;
uint256 total = 0;
for (uint256 i; i < pending.length; i++) {
if (canCollectBountyFor(pending[i])) {
total++;
}
}
return total;
}
/**
* @dev pay bounty for the inviter of _invitee
* invitee need to be whitelisted
*/
function bountyFor(
address _invitee
) public isActive returns (uint256 bounty) {
require(canCollectBountyFor(_invitee), "user not elligble for bounty yet");
return _bountyFor(_invitee, true);
}
function _bountyFor(
address _invitee,
bool isSingleBounty
) internal returns (uint256 bounty) {
address invitedBy = users[_invitee].invitedBy;
uint256 joinedAt = users[_invitee].joinedAt;
Level memory level = levels[users[invitedBy].level];
bool isLevelExpired = level.daysToComplete > 0 &&
joinedAt > users[invitedBy].levelStarted && //prevent overflow in subtraction
level.daysToComplete <
(joinedAt - users[invitedBy].levelStarted) / 1 days; //how long after level started did invitee join
users[_invitee].bountyPaid = true;
users[invitedBy].totalApprovedInvites += 1;
users[invitedBy].totalEarned += level.bounty;
stats.totalApprovedInvites += 1;
stats.totalBountiesPaid += level.bounty;
bool earnedLevel = false;
if (
level.toNext > 0 &&
users[invitedBy].totalApprovedInvites >= level.toNext &&
isLevelExpired == false
) {
users[invitedBy].level += 1;
users[invitedBy].levelStarted = block.timestamp;
earnedLevel = true;
}
if (isSingleBounty) goodDollar.transfer(invitedBy, level.bounty);
goodDollar.transfer(_invitee, level.bounty / 2); //pay invitee half the bounty
emit InviterBounty(
invitedBy,
_invitee,
level.bounty,
users[invitedBy].level,
earnedLevel
);
return level.bounty;
}
/**
@dev collect bounties for invitees by msg.sender that are now whitelisted
*/
function collectBounties() public isActive {
address[] storage pendings = users[msg.sender].pending;
uint256 totalBounties = 0;
for (int256 i = int256(pendings.length) - 1; i >= 0; i--) {
if (gasleft() < 185000) break; // leave enough gas for the token transfer around 150k if we are using supertoken
address pending = pendings[uint256(i)];
if (canCollectBountyFor(pending)) {
totalBounties += _bountyFor(pending, false);
pendings.pop();
}
}
if (totalBounties > 0) goodDollar.transfer(msg.sender, totalBounties);
}
function setLevel(
uint256 _lvl,
uint256 _toNext,
uint256 _bounty,
uint256 _daysToComplete
) public ownerOrAvatar {
Level storage lvl = levels[_lvl];
lvl.toNext = _toNext;
lvl.daysToComplete = _daysToComplete;
lvl.bounty = _bounty;
}
function setActive(bool _active) public ownerOrAvatar {
active = _active;
}
function end() public ownerOrAvatar isActive {
uint256 gdBalance = goodDollar.balanceOf(address(this));
goodDollar.transfer(msg.sender, gdBalance);
payable(msg.sender).transfer(address(this).balance);
active = false;
}
/// @notice helper function to get current chain id
/// @return chainId id
function _chainId() internal view returns (uint256 chainId) {
assembly {
chainId := chainid()
}
}
/**
* @dev
* 1.2.0 - final changes before release
* 1.3.0 - allow to set inviter later
* 1.4.0 - improve gas for bounty collection
* 1.5.0 - more gas improvements
* 2 uses uups upgradeable - not compatible upgrade for v1
* 2.1 prevent multichain claims
*/
function version() public pure returns (string memory) {
return "2.1";
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "../DAOStackInterfaces.sol";
/**
@title Simple name to address resolver
*/
contract NameService is Initializable, UUPSUpgradeable {
mapping(bytes32 => address) public addresses;
Controller public dao;
event AddressChanged(string name ,address addr);
function initialize(
Controller _dao,
bytes32[] memory _nameHashes,
address[] memory _addresses
) public virtual initializer {
dao = _dao;
for (uint256 i = 0; i < _nameHashes.length; i++) {
addresses[_nameHashes[i]] = _addresses[i];
}
addresses[keccak256(bytes("CONTROLLER"))] = address(_dao);
addresses[keccak256(bytes("AVATAR"))] = address(_dao.avatar());
}
function _authorizeUpgrade(address) internal override {
_onlyAvatar();
}
function _onlyAvatar() internal view {
require(
address(dao.avatar()) == msg.sender,
"only avatar can call this method"
);
}
function setAddress(string memory name, address addr) external {
_onlyAvatar();
addresses[keccak256(bytes(name))] = addr;
emit AddressChanged(name, addr);
}
function setAddresses(bytes32[] calldata hash, address[] calldata addrs)
external
{
_onlyAvatar();
for (uint256 i = 0; i < hash.length; i++) {
addresses[hash[i]] = addrs[i];
}
}
function getAddress(string memory name) external view returns (address) {
return addresses[keccak256(bytes(name))];
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
//the current stable borrow rate. Expressed in ray
uint128 currentStableBorrowRate;
uint40 lastUpdateTimestamp;
//tokens addresses
address aTokenAddress;
address stableDebtTokenAddress;
address variableDebtTokenAddress;
//address of the interest rate strategy
address interestRateStrategyAddress;
//the id of the reserve. Represents the position in the list of the active reserves
uint8 id;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: Reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: stable rate borrowing enabled
//bit 60-63: reserved
//bit 64-79: reserve factor
uint256 data;
}
enum InterestRateMode { NONE, STABLE, VARIABLE }
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./DAOContract.sol";
/**
@title Simple contract that adds upgradability to DAOContract
*/
contract DAOUpgradeableContract is Initializable, UUPSUpgradeable, DAOContract {
function _authorizeUpgrade(address) internal virtual override {
_onlyAvatar();
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "../DAOStackInterfaces.sol";
import "../Interfaces.sol";
/**
@title Simple contract that keeps DAO contracts registery
*/
contract DAOContract {
Controller public dao;
address public avatar;
INameService public nameService;
function _onlyAvatar() internal view {
require(
address(dao.avatar()) == msg.sender,
"only avatar can call this method"
);
}
function setDAO(INameService _ns) internal {
nameService = _ns;
updateAvatar();
}
function updateAvatar() public {
dao = Controller(nameService.getAddress("CONTROLLER"));
avatar = dao.avatar();
}
function nativeToken() public view returns (IGoodDollar) {
return IGoodDollar(nameService.getAddress("GOODDOLLAR"));
}
uint256[50] private gap;
}// SPDX-License-Identifier: MIT
import { DataTypes } from "./utils/DataTypes.sol";
pragma solidity >=0.8.0;
pragma experimental ABIEncoderV2;
interface ERC20 {
function balanceOf(address addr) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function decimals() external view returns (uint8);
function mint(address to, uint256 mintAmount) external returns (uint256);
function burn(uint256 amount) external;
function totalSupply() external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Transfer(
address indexed from,
address indexed to,
uint256 amount,
bytes data
);
}
interface cERC20 is ERC20 {
function mint(uint256 mintAmount) external returns (uint256);
function redeemUnderlying(uint256 mintAmount) external returns (uint256);
function redeem(uint256 mintAmount) external returns (uint256);
function exchangeRateCurrent() external returns (uint256);
function exchangeRateStored() external view returns (uint256);
function underlying() external returns (address);
}
interface IGoodDollar is ERC20 {
// view functions
function feeRecipient() external view returns (address);
function getFees(
uint256 value,
address sender,
address recipient
) external view returns (uint256 fee, bool senderPays);
function cap() external view returns (uint256);
function isPauser(address _pauser) external view returns (bool);
function getFees(uint256 value) external view returns (uint256, bool);
function isMinter(address minter) external view returns (bool);
function formula() external view returns (address);
function identity() external view returns (address);
function owner() external view returns (address);
// state changing functions
function setFeeRecipient(address _feeRecipient) external;
function setFormula(address _formula) external;
function transferOwnership(address _owner) external;
function addPauser(address _pauser) external;
function pause() external;
function unpause() external;
function burn(uint256 amount) external;
function burnFrom(address account, uint256 amount) external;
function renounceMinter() external;
function addMinter(address minter) external;
function transferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool);
function setIdentity(address identity) external;
}
interface IERC2917 is ERC20 {
/// @dev This emit when interests amount per block is changed by the owner of the contract.
/// It emits with the old interests amount and the new interests amount.
event InterestRatePerBlockChanged(uint256 oldValue, uint256 newValue);
/// @dev This emit when a users' productivity has changed
/// It emits with the user's address and the the value after the change.
event ProductivityIncreased(address indexed user, uint256 value);
/// @dev This emit when a users' productivity has changed
/// It emits with the user's address and the the value after the change.
event ProductivityDecreased(address indexed user, uint256 value);
/// @dev Return the current contract's interests rate per block.
/// @return The amount of interests currently producing per each block.
function interestsPerBlock() external view returns (uint256);
/// @notice Change the current contract's interests rate.
/// @dev Note the best practice will be restrict the gross product provider's contract address to call this.
/// @return The true/fase to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.
function changeInterestRatePerBlock(uint256 value) external returns (bool);
/// @notice It will get the productivity of given user.
/// @dev it will return 0 if user has no productivity proved in the contract.
/// @return user's productivity and overall productivity.
function getProductivity(address user)
external
view
returns (uint256, uint256);
/// @notice increase a user's productivity.
/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
/// @return true to confirm that the productivity added success.
function increaseProductivity(address user, uint256 value)
external
returns (bool);
/// @notice decrease a user's productivity.
/// @dev Note the best practice will be restrict the callee to prove of productivity's contract address.
/// @return true to confirm that the productivity removed success.
function decreaseProductivity(address user, uint256 value)
external
returns (bool);
/// @notice take() will return the interests that callee will get at current block height.
/// @dev it will always calculated by block.number, so it will change when block height changes.
/// @return amount of the interests that user are able to mint() at current block height.
function take() external view returns (uint256);
/// @notice similar to take(), but with the block height joined to calculate return.
/// @dev for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.
/// @return amount of interests and the block height.
function takeWithBlock() external view returns (uint256, uint256);
/// @notice mint the avaiable interests to callee.
/// @dev once it mint, the amount of interests will transfer to callee's address.
/// @return the amount of interests minted.
function mint() external returns (uint256);
}
interface Staking {
struct Staker {
// The staked DAI amount
uint256 stakedDAI;
// The latest block number which the
// staker has staked tokens
uint256 lastStake;
}
function stakeDAI(uint256 amount) external;
function withdrawStake() external;
function stakers(address staker) external view returns (Staker memory);
}
interface Uniswap {
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function WETH() external pure returns (address);
function factory() external pure returns (address);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountOut(
uint256 amountI,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountsOut(uint256 amountIn, address[] memory path)
external
pure
returns (uint256[] memory amounts);
}
interface UniswapFactory {
function getPair(address tokenA, address tokenB)
external
view
returns (address);
}
interface UniswapPair {
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function kLast() external view returns (uint256);
function token0() external view returns (address);
function token1() external view returns (address);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
}
interface Reserve {
function buy(
address _buyWith,
uint256 _tokenAmount,
uint256 _minReturn
) external returns (uint256);
}
interface IIdentity {
function isWhitelisted(address user) external view returns (bool);
function addWhitelistedWithDID(address account, string memory did) external;
function removeWhitelisted(address account) external;
function addBlacklisted(address account) external;
function removeBlacklisted(address account) external;
function isBlacklisted(address user) external view returns (bool);
function addIdentityAdmin(address account) external returns (bool);
function setAvatar(address _avatar) external;
function isIdentityAdmin(address account) external view returns (bool);
function owner() external view returns (address);
function removeContract(address account) external;
function isDAOContract(address account) external view returns (bool);
function addrToDID(address account) external view returns (string memory);
function didHashToAddress(bytes32 hash) external view returns (address);
function lastAuthenticated(address account) external view returns (uint256);
event WhitelistedAdded(address user);
}
interface IIdentityV2 is IIdentity {
function addWhitelistedWithDIDAndChain(
address account,
string memory did,
uint256 orgChainId,
uint256 dateAuthenticated
) external;
function getWhitelistedRoot(address account)
external
view
returns (address root);
}
interface IUBIScheme {
function currentDay() external view returns (uint256);
function periodStart() external view returns (uint256);
function hasClaimed(address claimer) external view returns (bool);
}
interface IFirstClaimPool {
function awardUser(address user) external returns (uint256);
function claimAmount() external view returns (uint256);
}
interface ProxyAdmin {
function getProxyImplementation(address proxy)
external
view
returns (address);
function getProxyAdmin(address proxy) external view returns (address);
function upgrade(address proxy, address implementation) external;
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function upgradeAndCall(
address proxy,
address implementation,
bytes memory data
) external;
}
/**
* @dev Interface for chainlink oracles to obtain price datas
*/
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestAnswer() external view returns (int256);
}
/**
@dev interface for AAVE lending Pool
*/
interface ILendingPool {
/**
* @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User deposits 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to deposit
* @param amount The amount to be deposited
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
**/
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
/**
* @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to Address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
**/
function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256);
/**
* @dev Returns the state and configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The state of the reserve
**/
function getReserveData(address asset)
external
view
returns (DataTypes.ReserveData memory);
}
interface IDonationStaking {
function stakeDonations() external payable;
}
interface INameService {
function getAddress(string memory _name) external view returns (address);
}
interface IAaveIncentivesController {
/**
* @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
* @param amount Amount of rewards to claim
* @param to Address that will be receiving the rewards
* @return Rewards claimed
**/
function claimRewards(
address[] calldata assets,
uint256 amount,
address to
) external returns (uint256);
/**
* @dev Returns the total of rewards of an user, already accrued + not yet accrued
* @param user The address of the user
* @return The rewards
**/
function getRewardsBalance(address[] calldata assets, address user)
external
view
returns (uint256);
}
interface IGoodStaking {
function collectUBIInterest(address recipient)
external
returns (
uint256,
uint256,
uint256
);
function iToken() external view returns (address);
function currentGains(
bool _returnTokenBalanceInUSD,
bool _returnTokenGainsInUSD
)
external
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256
);
function getRewardEarned(address user) external view returns (uint256);
function getGasCostForInterestTransfer() external view returns (uint256);
function rewardsMinted(
address user,
uint256 rewardsPerBlock,
uint256 blockStart,
uint256 blockEnd
) external returns (uint256);
}
interface IHasRouter {
function getRouter() external view returns (Uniswap);
}
interface IAdminWallet {
function addAdmins(address payable[] memory _admins) external;
function removeAdmins(address[] memory _admins) external;
function owner() external view returns (address);
function transferOwnership(address _owner) external;
}
interface IMultichainRouter {
// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
function anySwapOut(
address token,
address to,
uint256 amount,
uint256 toChainID
) external;
// Swaps `amount` `token` from this chain to `toChainID` chain with recipient `to`
function anySwapOutUnderlying(
address token,
address to,
uint256 amount,
uint256 toChainID
) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface Avatar {
function nativeToken() external view returns (address);
function nativeReputation() external view returns (address);
function owner() external view returns (address);
}
interface Controller {
event RegisterScheme(address indexed _sender, address indexed _scheme);
event UnregisterScheme(address indexed _sender, address indexed _scheme);
function genericCall(
address _contract,
bytes calldata _data,
address _avatar,
uint256 _value
) external returns (bool, bytes memory);
function avatar() external view returns (address);
function unregisterScheme(address _scheme, address _avatar)
external
returns (bool);
function unregisterSelf(address _avatar) external returns (bool);
function registerScheme(
address _scheme,
bytes32 _paramsHash,
bytes4 _permissions,
address _avatar
) external returns (bool);
function isSchemeRegistered(address _scheme, address _avatar)
external
view
returns (bool);
function getSchemePermissions(address _scheme, address _avatar)
external
view
returns (bytes4);
function addGlobalConstraint(
address _constraint,
bytes32 _paramHash,
address _avatar
) external returns (bool);
function mintTokens(
uint256 _amount,
address _beneficiary,
address _avatar
) external returns (bool);
function externalTokenTransfer(
address _token,
address _recipient,
uint256 _amount,
address _avatar
) external returns (bool);
function sendEther(
uint256 _amountInWei,
address payable _to,
address _avatar
) external returns (bool);
}
interface GlobalConstraintInterface {
enum CallPhase {
Pre,
Post,
PreAndPost
}
function pre(
address _scheme,
bytes32 _params,
bytes32 _method
) external returns (bool);
/**
* @dev when return if this globalConstraints is pre, post or both.
* @return CallPhase enum indication Pre, Post or PreAndPost.
*/
function when() external returns (CallPhase);
}
interface ReputationInterface {
function balanceOf(address _user) external view returns (uint256);
function balanceOfAt(address _user, uint256 _blockNumber)
external
view
returns (uint256);
function getVotes(address _user) external view returns (uint256);
function getVotesAt(
address _user,
bool _global,
uint256 _blockNumber
) external view returns (uint256);
function totalSupply() external view returns (uint256);
function totalSupplyAt(uint256 _blockNumber)
external
view
returns (uint256);
function delegateOf(address _user) external returns (address);
}
interface SchemeRegistrar {
function proposeScheme(
Avatar _avatar,
address _scheme,
bytes32 _parametersHash,
bytes4 _permissions,
string memory _descriptionHash
) external returns (bytes32);
event NewSchemeProposal(
address indexed _avatar,
bytes32 indexed _proposalId,
address indexed _intVoteInterface,
address _scheme,
bytes32 _parametersHash,
bytes4 _permissions,
string _descriptionHash
);
}
interface IntVoteInterface {
event NewProposal(
bytes32 indexed _proposalId,
address indexed _organization,
uint256 _numOfChoices,
address _proposer,
bytes32 _paramsHash
);
event ExecuteProposal(
bytes32 indexed _proposalId,
address indexed _organization,
uint256 _decision,
uint256 _totalReputation
);
event VoteProposal(
bytes32 indexed _proposalId,
address indexed _organization,
address indexed _voter,
uint256 _vote,
uint256 _reputation
);
event CancelProposal(
bytes32 indexed _proposalId,
address indexed _organization
);
event CancelVoting(
bytes32 indexed _proposalId,
address indexed _organization,
address indexed _voter
);
/**
* @dev register a new proposal with the given parameters. Every proposal has a unique ID which is being
* generated by calculating keccak256 of a incremented counter.
* @param _numOfChoices number of voting choices
* @param _proposalParameters defines the parameters of the voting machine used for this proposal
* @param _proposer address
* @param _organization address - if this address is zero the msg.sender will be used as the organization address.
* @return proposal's id.
*/
function propose(
uint256 _numOfChoices,
bytes32 _proposalParameters,
address _proposer,
address _organization
) external returns (bytes32);
function vote(
bytes32 _proposalId,
uint256 _vote,
uint256 _rep,
address _voter
) external returns (bool);
function cancelVote(bytes32 _proposalId) external;
function getNumberOfChoices(bytes32 _proposalId)
external
view
returns (uint256);
function isVotable(bytes32 _proposalId) external view returns (bool);
/**
* @dev voteStatus returns the reputation voted for a proposal for a specific voting choice.
* @param _proposalId the ID of the proposal
* @param _choice the index in the
* @return voted reputation for the given choice
*/
function voteStatus(bytes32 _proposalId, uint256 _choice)
external
view
returns (uint256);
/**
* @dev isAbstainAllow returns if the voting machine allow abstain (0)
* @return bool true or false
*/
function isAbstainAllow() external pure returns (bool);
/**
* @dev getAllowedRangeOfChoices returns the allowed range of choices for a voting machine.
* @return min - minimum number of choices
max - maximum number of choices
*/
function getAllowedRangeOfChoices()
external
pure
returns (uint256 min, uint256 max);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
*/
library StorageSlotUpgradeable {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeTo(address newImplementation) external virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*/
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Internal function that returns the initialized version. Returns `_initialized`
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Internal function that returns the initialized version. Returns `_initializing`
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeaconUpgradeable {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*
* @custom:oz-upgrades-unsafe-allow delegatecall
*/
abstract contract ERC1967UpgradeUpgradeable is Initializable {
function __ERC1967Upgrade_init() internal onlyInitializing {
}
function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
}
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(
address newImplementation,
bytes memory data,
bool forceCall
) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
_functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(
address newImplementation,
bytes memory data,
bool forceCall
) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Emitted when the beacon is upgraded.
*/
event BeaconUpgraded(address indexed beacon);
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(
address newBeacon,
bytes memory data,
bool forceCall
) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
_functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
}
/**
* @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) private returns (bytes memory) {
require(AddressUpgradeable.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 AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}{
"remappings": [],
"optimizer": {
"enabled": true,
"runs": 0
},
"evmVersion": "london",
"libraries": {},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"inviter","type":"address"},{"indexed":true,"internalType":"address","name":"invitee","type":"address"}],"name":"InviteeJoined","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"inviter","type":"address"},{"indexed":true,"internalType":"address","name":"invitee","type":"address"},{"indexed":false,"internalType":"uint256","name":"bountyPaid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inviterLevel","type":"uint256"},{"indexed":false,"internalType":"bool","name":"earnedLevel","type":"bool"}],"name":"InviterBounty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"active","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"avatar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_invitee","type":"address"}],"name":"bountyFor","outputs":[{"internalType":"uint256","name":"bounty","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_invitee","type":"address"}],"name":"canCollectBountyFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"codeToUser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectBounties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract Controller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"end","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getIdentity","outputs":[{"internalType":"contract IIdentityV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_inviter","type":"address"}],"name":"getInvitees","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_inviter","type":"address"}],"name":"getPendingBounties","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_inviter","type":"address"}],"name":"getPendingInvitees","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"goodDollar","outputs":[{"internalType":"contract cERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INameService","name":"_ns","type":"address"},{"internalType":"uint256","name":"_level0Bounty","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_myCode","type":"bytes32"},{"internalType":"bytes32","name":"_inviterCode","type":"bytes32"}],"name":"join","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"levelExpirationEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levels","outputs":[{"internalType":"uint256","name":"toNext","type":"uint256"},{"internalType":"uint256","name":"bounty","type":"uint256"},{"internalType":"uint256","name":"daysToComplete","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nameService","outputs":[{"internalType":"contract INameService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeToken","outputs":[{"internalType":"contract IGoodDollar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lvl","type":"uint256"},{"internalType":"uint256","name":"_toNext","type":"uint256"},{"internalType":"uint256","name":"_bounty","type":"uint256"},{"internalType":"uint256","name":"_daysToComplete","type":"uint256"}],"name":"setLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setLevelExpirationEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stats","outputs":[{"internalType":"uint256","name":"totalApprovedInvites","type":"uint256"},{"internalType":"uint256","name":"totalBountiesPaid","type":"uint256"},{"internalType":"uint256","name":"totalInvited","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"address","name":"invitedBy","type":"address"},{"internalType":"bytes32","name":"inviteCode","type":"bytes32"},{"internalType":"bool","name":"bountyPaid","type":"bool"},{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"levelStarted","type":"uint256"},{"internalType":"uint256","name":"totalApprovedInvites","type":"uint256"},{"internalType":"uint256","name":"totalEarned","type":"uint256"},{"internalType":"uint256","name":"joinedAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
60a06040523060805234801561001457600080fd5b5060805161279161004c6000396000818161078e015281816107ce015281816109af015281816109ef0152610a6b01526127916000f3fe60806040526004361061015d5760003560e01c806302fb0c5e14610162578063119e5bf3146101985780631b3c90a8146101c557806321132aad146101dc5780633659cfe6146101fc57806336afc6fa1461021c5780633e6326fc1461023157806341155d5e146102515780634162169f1461027f5780634f1ef2861461029f57806352d1902d146102b257806354fd4d50146102c75780635aef7de6146102f95780635b419a65146103195780636d619ef8146103395780638da5cb5b14610359578063a1df6fd314610379578063a87430ba14610393578063acec338a1461044a578063af6346b01461046a578063b2596a671461047f578063b6567cd5146104d6578063b9fb2d18146104f6578063ba6f568014610516578063c350a1b51461054c578063d80528ae1461056c578063e1758bd81461058b578063e951a3aa146105a0578063e9881a5e146105cd578063efbe1c1c146105ed575b600080fd5b34801561016e57600080fd5b50609e5461018390600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b3480156101a457600080fd5b50609e546101b8906001600160a01b031681565b60405161018f91906121bb565b3480156101d157600080fd5b506101da610602565b005b3480156101e857600080fd5b506101da6101f73660046121dd565b610729565b34801561020857600080fd5b506101da61021736600461220f565b610784565b34801561022857600080fd5b506101b861084c565b34801561023d57600080fd5b506067546101b8906001600160a01b031681565b34801561025d57600080fd5b5061027161026c36600461220f565b6108d8565b60405190815260200161018f565b34801561028b57600080fd5b506065546101b8906001600160a01b031681565b6101da6102ad366004612242565b6109a5565b3480156102be57600080fd5b50610271610a5e565b3480156102d357600080fd5b506040805180820182526003815262322e3160e81b6020820152905161018f9190612329565b34801561030557600080fd5b506066546101b8906001600160a01b031681565b34801561032557600080fd5b506101da61033436600461235c565b610b0c565b34801561034557600080fd5b5061018361035436600461220f565b610dd0565b34801561036557600080fd5b50609d546101b8906001600160a01b031681565b34801561038557600080fd5b5060a7546101839060ff1681565b34801561039f57600080fd5b506103ff6103ae36600461220f565b609b60205260009081526040902080546001820154600283015460058401546006850154600786015460088701546009909701546001600160a01b0390961696949560ff9094169492939192909188565b604080516001600160a01b0390991689526020890197909752941515958701959095526060860192909252608085015260a084015260c083019190915260e08201526101000161018f565b34801561045657600080fd5b506101da6104653660046121dd565b610fc1565b34801561047657600080fd5b506101da61101e565b34801561048b57600080fd5b506104bb61049a36600461237e565b609c6020526000908152604090208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161018f565b3480156104e257600080fd5b506102716104f136600461220f565b611198565b34801561050257600080fd5b506101da610511366004612397565b61122a565b34801561052257600080fd5b506101b861053136600461237e565b609a602052600090815260409020546001600160a01b031681565b34801561055857600080fd5b506101da6105673660046123c9565b611289565b34801561057857600080fd5b50609f5460a05460a1546104bb92919083565b34801561059757600080fd5b506101b86113a7565b3480156105ac57600080fd5b506105c06105bb36600461220f565b6113d6565b60405161018f919061240b565b3480156105d957600080fd5b506105c06105e836600461220f565b6115c1565b3480156105f957600080fd5b506101da61163a565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190612458565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa1580156106e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107079190612458565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b609d546001600160a01b031633148061074c57506066546001600160a01b031633145b6107715760405162461bcd60e51b815260040161076890612475565b60405180910390fd5b60a7805460ff1916911515919091179055565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107cc5760405162461bcd60e51b8152600401610768906124c1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166107fe6117c8565b6001600160a01b0316146108245760405162461bcd60e51b8152600401610768906124fb565b61082d816117e4565b6040805160008082526020820190925261084991839190611823565b50565b60675460405163bf40fac160e01b81526020600482015260086024820152674944454e5449545960c01b60448201526000916001600160a01b03169063bf40fac1906064015b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d39190612458565b905090565b6001600160a01b0381166000908152609b602090815260408083206004018054825181850281018501909352808352849383018282801561094257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610924575b505050505090506000805b825181101561099d5761097883828151811061096b5761096b612535565b6020026020010151610dd0565b1561098b578161098781612561565b9250505b8061099581612561565b91505061094d565b509392505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036109ed5760405162461bcd60e51b8152600401610768906124c1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610a1f6117c8565b6001600160a01b031614610a455760405162461bcd60e51b8152600401610768906124fb565b610a4e826117e4565b610a5a82826001611823565b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610af95760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610768565b5060008051602061271583398151915290565b609e54600160a01b900460ff16610b355760405162461bcd60e51b81526004016107689061257a565b6000828152609a60205260409020546001600160a01b03161580610b6f57506000828152609a60205260409020546001600160a01b031633145b80610b8257506001600160a01b03821633145b610bcb5760405162461bcd60e51b815260206004820152601a602482015279696e7669746520636f646520616c726561647920696e2075736560301b6044820152606401610768565b808203610bea5760405162461bcd60e51b81526004016107689061259e565b336000908152609b60209081526040808320848452609a9092529091205460018201546001600160a01b03909116901580610c40575081546001600160a01b0316158015610c4057506001600160a01b03811615155b610c825760405162461bcd60e51b81526020600482015260136024820152721d5cd95c88185b1c9958591e481a9bda5b9959606a1b6044820152606401610768565b6001820154600003610cc15760018201849055426006830181905560098301556000848152609a6020526040902080546001600160a01b031916331790555b6001600160a01b03811615610d7957336001600160a01b03821603610cf85760405162461bcd60e51b81526004016107689061259e565b81546001600160a01b0382166001600160a01b0319918216811784556000908152609b6020908152604082206003810180546001818101835591855283852001805486163390811790915560049092018054808301825590855292842090920180549094161790925560a18054909190610d739084906125c3565b90915550505b610d8233610dd0565b15610d9457610d9233600161198e565b505b60405133906001600160a01b038316907fd8c638d8979e2ba5dba1f0d66246ee4b1c54b838f0e0a2b601365345eb23b05190600090a350505050565b6001600160a01b038082166000908152609b6020908152604080832054909316808352838320600501548352609c9091529181206002015460a754919291839060ff1615156001148015610e245750600082115b8015610e6f57506001600160a01b038084166000908152609b60205260408082206006015492881682529020600901546201518091610e62916125d6565b610e6c91906125e9565b82105b90506001600160a01b03831615801590610ea557506001600160a01b0385166000908152609b602052604090206002015460ff16155b8015610f205750610eb461084c565b6001600160a01b0316633af32abf866040518263ffffffff1660e01b8152600401610edf91906121bb565b602060405180830381865afa158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f20919061260b565b8015610f9b5750610f2f61084c565b6001600160a01b0316633af32abf846040518263ffffffff1660e01b8152600401610f5a91906121bb565b602060405180830381865afa158015610f77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9b919061260b565b8015610fae575046610fac86611d6d565b145b8015610fb8575080155b95945050505050565b609d546001600160a01b0316331480610fe457506066546001600160a01b031633145b6110005760405162461bcd60e51b815260040161076890612475565b609e8054911515600160a01b0260ff60a01b19909216919091179055565b609e54600160a01b900460ff166110475760405162461bcd60e51b81526004016107689061257a565b336000908152609b602052604081206004018054909190819061106c90600190612628565b90505b60008112611117576202d2a85a1061111757600083828154811061109557611095612535565b6000918252602090912001546001600160a01b031690506110b581610dd0565b15611104576110c581600061198e565b6110cf90846125c3565b9250838054806110e1576110e161264f565b600082815260209020810160001990810180546001600160a01b03191690550190555b508061110f81612665565b91505061106f565b508015610a5a57609e5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906111509033908590600401612682565b6020604051808303816000875af115801561116f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611193919061260b565b505050565b609e54600090600160a01b900460ff166111c45760405162461bcd60e51b81526004016107689061257a565b6111cd82610dd0565b6112195760405162461bcd60e51b815260206004820181905260248201527f75736572206e6f7420656c6c6967626c6520666f7220626f756e7479207965746044820152606401610768565b61122482600161198e565b92915050565b609d546001600160a01b031633148061124d57506066546001600160a01b031633145b6112695760405162461bcd60e51b815260040161076890612475565b6000938452609c6020526040909320918255600282019290925560010155565b600054610100900460ff16158080156112a95750600054600160ff909116105b806112ca57506112b830611e37565b1580156112ca575060005460ff166001145b61132d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610768565b6000805460ff191660011790558015611350576000805461ff0019166101001790555b61135b848484611e46565b80156113a1576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60675460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906108929060040161269b565b6001600160a01b0381166000908152609b6020908152604080832060040180548251818502810185019093528083526060949383018282801561144257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611424575b5050505050905060008060005b83518110156114bc57609b600085838151811061146e5761146e612535565b6020908102919091018101516001600160a01b031682528101919091526040016000206002015460ff166114aa57816114a681612561565b9250505b806114b481612561565b91505061144f565b506000816001600160401b038111156114d7576114d761222c565b604051908082528060200260200182016040528015611500578160200160208202803683370190505b50905060005b84518110156115b757609b600086838151811061152557611525612535565b6020908102919091018101516001600160a01b031682528101919091526040016000206002015460ff166115a55784818151811061156557611565612535565b602002602001015182858151811061157f5761157f612535565b6001600160a01b0390921660209283029190910190910152836115a181612561565b9450505b806115af81612561565b915050611506565b5095945050505050565b6001600160a01b0381166000908152609b602090815260409182902060030180548351818402810184019094528084526060939283018282801561162e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611610575b50505050509050919050565b609d546001600160a01b031633148061165d57506066546001600160a01b031633145b6116795760405162461bcd60e51b815260040161076890612475565b609e54600160a01b900460ff166116a25760405162461bcd60e51b81526004016107689061257a565b609e546040516370a0823160e01b81526000916001600160a01b0316906370a08231906116d39030906004016121bb565b602060405180830381865afa1580156116f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171491906126bf565b609e5460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb906117479033908590600401612682565b6020604051808303816000875af1158015611766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061178a919061260b565b5060405133904780156108fc02916000818181858888f193505050501580156117b7573d6000803e3d6000fd5b5050609e805460ff60a01b19169055565b600080516020612715833981519152546001600160a01b031690565b609d546001600160a01b031633148061180757506066546001600160a01b031633145b6108495760405162461bcd60e51b815260040161076890612475565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156118565761119383611f6b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156118b0575060408051601f3d908101601f191682019092526118ad918101906126bf565b60015b6119135760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610768565b60008051602061271583398151915281146119825760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610768565b50611193838383612005565b6001600160a01b038281166000908152609b60209081526040808320805460099091015494168084528184206005908101548552609c8452828520835160808101855281548152600182015495810195909552600281015485850152835160a081019485905295969295929487949093919260608501929160038501919082845b815481526020019060010190808311611a0f5750505050508152505090506000808260400151118015611a5c57506001600160a01b0384166000908152609b602052604090206006015483115b8015611a9f57506001600160a01b0384166000908152609b60205260409020600601546201518090611a8e90856125d6565b611a9891906125e9565b8260400151105b6001600160a01b038089166000908152609b6020526040808220600201805460ff191660019081179091559288168252812060070180549394509192611ae69084906125c3565b90915550506020808301516001600160a01b0386166000908152609b90925260408220600801805491929091611b1d9084906125c3565b9091555050609f805460019190600090611b389084906125c3565b9091555050602082015160a08054600090611b549084906125c3565b9091555050815160009015801590611b88575082516001600160a01b0386166000908152609b602052604090206007015410155b8015611b92575081155b15611beb576001600160a01b0385166000908152609b60205260408120600501805460019290611bc39084906125c3565b9091555050506001600160a01b0384166000908152609b602052604090204260069091015560015b8615611c6c57609e54602084015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91611c2791899190600401612682565b6020604051808303816000875af1158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6a919061260b565b505b609e5460208401516001600160a01b039091169063a9059cbb908a90611c94906002906125e9565b6040518363ffffffff1660e01b8152600401611cb1929190612682565b6020604051808303816000875af1158015611cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf4919061260b565b506020838101516001600160a01b038781166000818152609b855260409081902060050154815194855294840194909452841515838501529251908b1692917f6081787cd1bd02ab1576c52f03e8710d792d460e7881c3155d77d23893f3768b919081900360600190a350506020015195945050505050565b6000806000611d7a61084c565b6001600160a01b031684604051602401611d9491906121bb565b60408051601f198184030181529181526020820180516001600160e01b031663a061922d60e01b17905251611dc991906126d8565b600060405180830381855afa9150503d8060008114611e04576040519150601f19603f3d011682016040523d82523d6000602084013e611e09565b606091505b509092509050811515600003611e2357465b949350505050565b80806020019051810190611e1b91906126bf565b6001600160a01b03163b151590565b611e4f8361202a565b609d80546001600160a01b038084166001600160a01b031990921691909117909155609e805460ff60a01b1916600160a01b17905560008052609c6020527f21d5695aeb71770b4b420e85352fe1a012fa06ae92de02f7ee513765e0afa02483905560675460405163bf40fac160e01b81527f21d5695aeb71770b4b420e85352fe1a012fa06ae92de02f7ee513765e0afa02392919091169063bf40fac190611efa9060040161269b565b602060405180830381865afa158015611f17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3b9190612458565b609e80546001600160a01b0319166001600160a01b0392909216919091179055505060a7805460ff191690555050565b611f7481611e37565b611fd65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610768565b60008051602061271583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61200e8361204d565b60008251118061201b5750805b15611193576113a1838361208d565b606780546001600160a01b0319166001600160a01b038316179055610849610602565b61205681611f6b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061209883611e37565b6120f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610768565b600080846001600160a01b03168460405161210e91906126d8565b600060405180830381855af49150503d8060008114612149576040519150601f19603f3d011682016040523d82523d6000602084013e61214e565b606091505b5091509150610fb88282604051806060016040528060278152602001612735602791396060831561218057508161218a565b61218a8383612191565b9392505050565b8151156121a15781518083602001fd5b8060405162461bcd60e51b81526004016107689190612329565b6001600160a01b0391909116815260200190565b801515811461084957600080fd5b6000602082840312156121ef57600080fd5b813561218a816121cf565b6001600160a01b038116811461084957600080fd5b60006020828403121561222157600080fd5b813561218a816121fa565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561225557600080fd5b8235612260816121fa565b915060208301356001600160401b038082111561227c57600080fd5b818501915085601f83011261229057600080fd5b8135818111156122a2576122a261222c565b604051601f8201601f19908116603f011681019083821181831017156122ca576122ca61222c565b816040528281528860208487010111156122e357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015612320578181015183820152602001612308565b50506000910152565b6020815260008251806020840152612348816040850160208701612305565b601f01601f19169190910160400192915050565b6000806040838503121561236f57600080fd5b50508035926020909101359150565b60006020828403121561239057600080fd5b5035919050565b600080600080608085870312156123ad57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000606084860312156123de57600080fd5b83356123e9816121fa565b9250602084013591506040840135612400816121fa565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561244c5783516001600160a01b031683529284019291840191600101612427565b50909695505050505050565b60006020828403121561246a57600080fd5b815161218a816121fa565b6020808252602c908201527f4f6e6c79206f776e6572206f72206176617461722063616e20706572666f726d60408201526b103a3434b99030b1ba34b7b760a11b606082015260800190565b6020808252602c908201526000805160206126f583398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206126f583398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125735761257361254b565b5060010190565b6020808252600a90820152696e6f742061637469766560b01b604082015260600190565b6020808252600b908201526a73656c6620696e7669746560a81b604082015260600190565b808201808211156112245761122461254b565b818103818111156112245761122461254b565b60008261260657634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561261d57600080fd5b815161218a816121cf565b81810360008312801583831316838312821617156126485761264861254b565b5092915050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b820161267a5761267a61254b565b506000190190565b6001600160a01b03929092168252602082015260400190565b6020808252600a908201526923a7a7a22227a62620a960b11b604082015260600190565b6000602082840312156126d157600080fd5b5051919050565b600082516126ea818460208701612305565b919091019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208e70bb87fd6034b1d11bbde1033edc1c85105dfb2a201aa4762383954425d30164736f6c63430008100033
Deployed Bytecode
0x60806040526004361061015d5760003560e01c806302fb0c5e14610162578063119e5bf3146101985780631b3c90a8146101c557806321132aad146101dc5780633659cfe6146101fc57806336afc6fa1461021c5780633e6326fc1461023157806341155d5e146102515780634162169f1461027f5780634f1ef2861461029f57806352d1902d146102b257806354fd4d50146102c75780635aef7de6146102f95780635b419a65146103195780636d619ef8146103395780638da5cb5b14610359578063a1df6fd314610379578063a87430ba14610393578063acec338a1461044a578063af6346b01461046a578063b2596a671461047f578063b6567cd5146104d6578063b9fb2d18146104f6578063ba6f568014610516578063c350a1b51461054c578063d80528ae1461056c578063e1758bd81461058b578063e951a3aa146105a0578063e9881a5e146105cd578063efbe1c1c146105ed575b600080fd5b34801561016e57600080fd5b50609e5461018390600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b3480156101a457600080fd5b50609e546101b8906001600160a01b031681565b60405161018f91906121bb565b3480156101d157600080fd5b506101da610602565b005b3480156101e857600080fd5b506101da6101f73660046121dd565b610729565b34801561020857600080fd5b506101da61021736600461220f565b610784565b34801561022857600080fd5b506101b861084c565b34801561023d57600080fd5b506067546101b8906001600160a01b031681565b34801561025d57600080fd5b5061027161026c36600461220f565b6108d8565b60405190815260200161018f565b34801561028b57600080fd5b506065546101b8906001600160a01b031681565b6101da6102ad366004612242565b6109a5565b3480156102be57600080fd5b50610271610a5e565b3480156102d357600080fd5b506040805180820182526003815262322e3160e81b6020820152905161018f9190612329565b34801561030557600080fd5b506066546101b8906001600160a01b031681565b34801561032557600080fd5b506101da61033436600461235c565b610b0c565b34801561034557600080fd5b5061018361035436600461220f565b610dd0565b34801561036557600080fd5b50609d546101b8906001600160a01b031681565b34801561038557600080fd5b5060a7546101839060ff1681565b34801561039f57600080fd5b506103ff6103ae36600461220f565b609b60205260009081526040902080546001820154600283015460058401546006850154600786015460088701546009909701546001600160a01b0390961696949560ff9094169492939192909188565b604080516001600160a01b0390991689526020890197909752941515958701959095526060860192909252608085015260a084015260c083019190915260e08201526101000161018f565b34801561045657600080fd5b506101da6104653660046121dd565b610fc1565b34801561047657600080fd5b506101da61101e565b34801561048b57600080fd5b506104bb61049a36600461237e565b609c6020526000908152604090208054600182015460029092015490919083565b6040805193845260208401929092529082015260600161018f565b3480156104e257600080fd5b506102716104f136600461220f565b611198565b34801561050257600080fd5b506101da610511366004612397565b61122a565b34801561052257600080fd5b506101b861053136600461237e565b609a602052600090815260409020546001600160a01b031681565b34801561055857600080fd5b506101da6105673660046123c9565b611289565b34801561057857600080fd5b50609f5460a05460a1546104bb92919083565b34801561059757600080fd5b506101b86113a7565b3480156105ac57600080fd5b506105c06105bb36600461220f565b6113d6565b60405161018f919061240b565b3480156105d957600080fd5b506105c06105e836600461220f565b6115c1565b3480156105f957600080fd5b506101da61163a565b60675460405163bf40fac160e01b815260206004820152600a60248201526921a7a72a2927a62622a960b11b60448201526001600160a01b039091169063bf40fac190606401602060405180830381865afa158015610665573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106899190612458565b606580546001600160a01b0319166001600160a01b0392909216918217905560408051632d77bef360e11b81529051635aef7de6916004808201926020929091908290030181865afa1580156106e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107079190612458565b606680546001600160a01b0319166001600160a01b0392909216919091179055565b609d546001600160a01b031633148061074c57506066546001600160a01b031633145b6107715760405162461bcd60e51b815260040161076890612475565b60405180910390fd5b60a7805460ff1916911515919091179055565b6001600160a01b037f00000000000000000000000061760d949357066ae29c469b70a91934273e4ef31630036107cc5760405162461bcd60e51b8152600401610768906124c1565b7f00000000000000000000000061760d949357066ae29c469b70a91934273e4ef36001600160a01b03166107fe6117c8565b6001600160a01b0316146108245760405162461bcd60e51b8152600401610768906124fb565b61082d816117e4565b6040805160008082526020820190925261084991839190611823565b50565b60675460405163bf40fac160e01b81526020600482015260086024820152674944454e5449545960c01b60448201526000916001600160a01b03169063bf40fac1906064015b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d39190612458565b905090565b6001600160a01b0381166000908152609b602090815260408083206004018054825181850281018501909352808352849383018282801561094257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610924575b505050505090506000805b825181101561099d5761097883828151811061096b5761096b612535565b6020026020010151610dd0565b1561098b578161098781612561565b9250505b8061099581612561565b91505061094d565b509392505050565b6001600160a01b037f00000000000000000000000061760d949357066ae29c469b70a91934273e4ef31630036109ed5760405162461bcd60e51b8152600401610768906124c1565b7f00000000000000000000000061760d949357066ae29c469b70a91934273e4ef36001600160a01b0316610a1f6117c8565b6001600160a01b031614610a455760405162461bcd60e51b8152600401610768906124fb565b610a4e826117e4565b610a5a82826001611823565b5050565b6000306001600160a01b037f00000000000000000000000061760d949357066ae29c469b70a91934273e4ef31614610af95760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610768565b5060008051602061271583398151915290565b609e54600160a01b900460ff16610b355760405162461bcd60e51b81526004016107689061257a565b6000828152609a60205260409020546001600160a01b03161580610b6f57506000828152609a60205260409020546001600160a01b031633145b80610b8257506001600160a01b03821633145b610bcb5760405162461bcd60e51b815260206004820152601a602482015279696e7669746520636f646520616c726561647920696e2075736560301b6044820152606401610768565b808203610bea5760405162461bcd60e51b81526004016107689061259e565b336000908152609b60209081526040808320848452609a9092529091205460018201546001600160a01b03909116901580610c40575081546001600160a01b0316158015610c4057506001600160a01b03811615155b610c825760405162461bcd60e51b81526020600482015260136024820152721d5cd95c88185b1c9958591e481a9bda5b9959606a1b6044820152606401610768565b6001820154600003610cc15760018201849055426006830181905560098301556000848152609a6020526040902080546001600160a01b031916331790555b6001600160a01b03811615610d7957336001600160a01b03821603610cf85760405162461bcd60e51b81526004016107689061259e565b81546001600160a01b0382166001600160a01b0319918216811784556000908152609b6020908152604082206003810180546001818101835591855283852001805486163390811790915560049092018054808301825590855292842090920180549094161790925560a18054909190610d739084906125c3565b90915550505b610d8233610dd0565b15610d9457610d9233600161198e565b505b60405133906001600160a01b038316907fd8c638d8979e2ba5dba1f0d66246ee4b1c54b838f0e0a2b601365345eb23b05190600090a350505050565b6001600160a01b038082166000908152609b6020908152604080832054909316808352838320600501548352609c9091529181206002015460a754919291839060ff1615156001148015610e245750600082115b8015610e6f57506001600160a01b038084166000908152609b60205260408082206006015492881682529020600901546201518091610e62916125d6565b610e6c91906125e9565b82105b90506001600160a01b03831615801590610ea557506001600160a01b0385166000908152609b602052604090206002015460ff16155b8015610f205750610eb461084c565b6001600160a01b0316633af32abf866040518263ffffffff1660e01b8152600401610edf91906121bb565b602060405180830381865afa158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f20919061260b565b8015610f9b5750610f2f61084c565b6001600160a01b0316633af32abf846040518263ffffffff1660e01b8152600401610f5a91906121bb565b602060405180830381865afa158015610f77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9b919061260b565b8015610fae575046610fac86611d6d565b145b8015610fb8575080155b95945050505050565b609d546001600160a01b0316331480610fe457506066546001600160a01b031633145b6110005760405162461bcd60e51b815260040161076890612475565b609e8054911515600160a01b0260ff60a01b19909216919091179055565b609e54600160a01b900460ff166110475760405162461bcd60e51b81526004016107689061257a565b336000908152609b602052604081206004018054909190819061106c90600190612628565b90505b60008112611117576202d2a85a1061111757600083828154811061109557611095612535565b6000918252602090912001546001600160a01b031690506110b581610dd0565b15611104576110c581600061198e565b6110cf90846125c3565b9250838054806110e1576110e161264f565b600082815260209020810160001990810180546001600160a01b03191690550190555b508061110f81612665565b91505061106f565b508015610a5a57609e5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906111509033908590600401612682565b6020604051808303816000875af115801561116f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611193919061260b565b505050565b609e54600090600160a01b900460ff166111c45760405162461bcd60e51b81526004016107689061257a565b6111cd82610dd0565b6112195760405162461bcd60e51b815260206004820181905260248201527f75736572206e6f7420656c6c6967626c6520666f7220626f756e7479207965746044820152606401610768565b61122482600161198e565b92915050565b609d546001600160a01b031633148061124d57506066546001600160a01b031633145b6112695760405162461bcd60e51b815260040161076890612475565b6000938452609c6020526040909320918255600282019290925560010155565b600054610100900460ff16158080156112a95750600054600160ff909116105b806112ca57506112b830611e37565b1580156112ca575060005460ff166001145b61132d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610768565b6000805460ff191660011790558015611350576000805461ff0019166101001790555b61135b848484611e46565b80156113a1576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60675460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906108929060040161269b565b6001600160a01b0381166000908152609b6020908152604080832060040180548251818502810185019093528083526060949383018282801561144257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611424575b5050505050905060008060005b83518110156114bc57609b600085838151811061146e5761146e612535565b6020908102919091018101516001600160a01b031682528101919091526040016000206002015460ff166114aa57816114a681612561565b9250505b806114b481612561565b91505061144f565b506000816001600160401b038111156114d7576114d761222c565b604051908082528060200260200182016040528015611500578160200160208202803683370190505b50905060005b84518110156115b757609b600086838151811061152557611525612535565b6020908102919091018101516001600160a01b031682528101919091526040016000206002015460ff166115a55784818151811061156557611565612535565b602002602001015182858151811061157f5761157f612535565b6001600160a01b0390921660209283029190910190910152836115a181612561565b9450505b806115af81612561565b915050611506565b5095945050505050565b6001600160a01b0381166000908152609b602090815260409182902060030180548351818402810184019094528084526060939283018282801561162e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611610575b50505050509050919050565b609d546001600160a01b031633148061165d57506066546001600160a01b031633145b6116795760405162461bcd60e51b815260040161076890612475565b609e54600160a01b900460ff166116a25760405162461bcd60e51b81526004016107689061257a565b609e546040516370a0823160e01b81526000916001600160a01b0316906370a08231906116d39030906004016121bb565b602060405180830381865afa1580156116f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171491906126bf565b609e5460405163a9059cbb60e01b81529192506001600160a01b03169063a9059cbb906117479033908590600401612682565b6020604051808303816000875af1158015611766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061178a919061260b565b5060405133904780156108fc02916000818181858888f193505050501580156117b7573d6000803e3d6000fd5b5050609e805460ff60a01b19169055565b600080516020612715833981519152546001600160a01b031690565b609d546001600160a01b031633148061180757506066546001600160a01b031633145b6108495760405162461bcd60e51b815260040161076890612475565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156118565761119383611f6b565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156118b0575060408051601f3d908101601f191682019092526118ad918101906126bf565b60015b6119135760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610768565b60008051602061271583398151915281146119825760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610768565b50611193838383612005565b6001600160a01b038281166000908152609b60209081526040808320805460099091015494168084528184206005908101548552609c8452828520835160808101855281548152600182015495810195909552600281015485850152835160a081019485905295969295929487949093919260608501929160038501919082845b815481526020019060010190808311611a0f5750505050508152505090506000808260400151118015611a5c57506001600160a01b0384166000908152609b602052604090206006015483115b8015611a9f57506001600160a01b0384166000908152609b60205260409020600601546201518090611a8e90856125d6565b611a9891906125e9565b8260400151105b6001600160a01b038089166000908152609b6020526040808220600201805460ff191660019081179091559288168252812060070180549394509192611ae69084906125c3565b90915550506020808301516001600160a01b0386166000908152609b90925260408220600801805491929091611b1d9084906125c3565b9091555050609f805460019190600090611b389084906125c3565b9091555050602082015160a08054600090611b549084906125c3565b9091555050815160009015801590611b88575082516001600160a01b0386166000908152609b602052604090206007015410155b8015611b92575081155b15611beb576001600160a01b0385166000908152609b60205260408120600501805460019290611bc39084906125c3565b9091555050506001600160a01b0384166000908152609b602052604090204260069091015560015b8615611c6c57609e54602084015160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb91611c2791899190600401612682565b6020604051808303816000875af1158015611c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6a919061260b565b505b609e5460208401516001600160a01b039091169063a9059cbb908a90611c94906002906125e9565b6040518363ffffffff1660e01b8152600401611cb1929190612682565b6020604051808303816000875af1158015611cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf4919061260b565b506020838101516001600160a01b038781166000818152609b855260409081902060050154815194855294840194909452841515838501529251908b1692917f6081787cd1bd02ab1576c52f03e8710d792d460e7881c3155d77d23893f3768b919081900360600190a350506020015195945050505050565b6000806000611d7a61084c565b6001600160a01b031684604051602401611d9491906121bb565b60408051601f198184030181529181526020820180516001600160e01b031663a061922d60e01b17905251611dc991906126d8565b600060405180830381855afa9150503d8060008114611e04576040519150601f19603f3d011682016040523d82523d6000602084013e611e09565b606091505b509092509050811515600003611e2357465b949350505050565b80806020019051810190611e1b91906126bf565b6001600160a01b03163b151590565b611e4f8361202a565b609d80546001600160a01b038084166001600160a01b031990921691909117909155609e805460ff60a01b1916600160a01b17905560008052609c6020527f21d5695aeb71770b4b420e85352fe1a012fa06ae92de02f7ee513765e0afa02483905560675460405163bf40fac160e01b81527f21d5695aeb71770b4b420e85352fe1a012fa06ae92de02f7ee513765e0afa02392919091169063bf40fac190611efa9060040161269b565b602060405180830381865afa158015611f17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3b9190612458565b609e80546001600160a01b0319166001600160a01b0392909216919091179055505060a7805460ff191690555050565b611f7481611e37565b611fd65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610768565b60008051602061271583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61200e8361204d565b60008251118061201b5750805b15611193576113a1838361208d565b606780546001600160a01b0319166001600160a01b038316179055610849610602565b61205681611f6b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061209883611e37565b6120f35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610768565b600080846001600160a01b03168460405161210e91906126d8565b600060405180830381855af49150503d8060008114612149576040519150601f19603f3d011682016040523d82523d6000602084013e61214e565b606091505b5091509150610fb88282604051806060016040528060278152602001612735602791396060831561218057508161218a565b61218a8383612191565b9392505050565b8151156121a15781518083602001fd5b8060405162461bcd60e51b81526004016107689190612329565b6001600160a01b0391909116815260200190565b801515811461084957600080fd5b6000602082840312156121ef57600080fd5b813561218a816121cf565b6001600160a01b038116811461084957600080fd5b60006020828403121561222157600080fd5b813561218a816121fa565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561225557600080fd5b8235612260816121fa565b915060208301356001600160401b038082111561227c57600080fd5b818501915085601f83011261229057600080fd5b8135818111156122a2576122a261222c565b604051601f8201601f19908116603f011681019083821181831017156122ca576122ca61222c565b816040528281528860208487010111156122e357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b83811015612320578181015183820152602001612308565b50506000910152565b6020815260008251806020840152612348816040850160208701612305565b601f01601f19169190910160400192915050565b6000806040838503121561236f57600080fd5b50508035926020909101359150565b60006020828403121561239057600080fd5b5035919050565b600080600080608085870312156123ad57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000606084860312156123de57600080fd5b83356123e9816121fa565b9250602084013591506040840135612400816121fa565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561244c5783516001600160a01b031683529284019291840191600101612427565b50909695505050505050565b60006020828403121561246a57600080fd5b815161218a816121fa565b6020808252602c908201527f4f6e6c79206f776e6572206f72206176617461722063616e20706572666f726d60408201526b103a3434b99030b1ba34b7b760a11b606082015260800190565b6020808252602c908201526000805160206126f583398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201526000805160206126f583398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125735761257361254b565b5060010190565b6020808252600a90820152696e6f742061637469766560b01b604082015260600190565b6020808252600b908201526a73656c6620696e7669746560a81b604082015260600190565b808201808211156112245761122461254b565b818103818111156112245761122461254b565b60008261260657634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561261d57600080fd5b815161218a816121cf565b81810360008312801583831316838312821617156126485761264861254b565b5092915050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b820161267a5761267a61254b565b506000190190565b6001600160a01b03929092168252602082015260400190565b6020808252600a908201526923a7a7a22227a62620a960b11b604082015260600190565b6000602082840312156126d157600080fd5b5051919050565b600082516126ea818460208701612305565b919091019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208e70bb87fd6034b1d11bbde1033edc1c85105dfb2a201aa4762383954425d30164736f6c63430008100033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.