Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 1,388 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Redeem | 18742903 | 351 days ago | IN | 0 ETH | 0.0024857 | ||||
Withdraw | 14661727 | 942 days ago | IN | 0 ETH | 0.00260133 | ||||
Withdraw | 13753870 | 1083 days ago | IN | 0 ETH | 0.00455691 | ||||
Redeem | 13744412 | 1084 days ago | IN | 0 ETH | 0.00404791 | ||||
Withdraw | 13557554 | 1114 days ago | IN | 0 ETH | 0.00847793 | ||||
Redeem | 13459276 | 1129 days ago | IN | 0 ETH | 0.00275819 | ||||
Redeem | 13459276 | 1129 days ago | IN | 0 ETH | 0.00275819 | ||||
Redeem | 13459276 | 1129 days ago | IN | 0 ETH | 0.00196564 | ||||
Redeem | 13284989 | 1156 days ago | IN | 0 ETH | 0.0026397 | ||||
Withdraw | 13277851 | 1157 days ago | IN | 0 ETH | 0.00210105 | ||||
Withdraw | 13268098 | 1159 days ago | IN | 0 ETH | 0.00217273 | ||||
Redeem | 13226053 | 1165 days ago | IN | 0 ETH | 0.0054435 | ||||
Setup | 13222124 | 1166 days ago | IN | 0 ETH | 0.01171021 | ||||
Withdraw | 13214995 | 1167 days ago | IN | 0 ETH | 0.00374245 | ||||
Redeem | 13209647 | 1168 days ago | IN | 0 ETH | 0.00266577 | ||||
Withdraw | 13180248 | 1173 days ago | IN | 0 ETH | 0.00822554 | ||||
Buy | 13170133 | 1174 days ago | IN | 0.02 ETH | 0.00581591 | ||||
Buy | 13167365 | 1175 days ago | IN | 0.02 ETH | 0.0066087 | ||||
Withdraw | 13165941 | 1175 days ago | IN | 0 ETH | 0.00300754 | ||||
Setup | 13158587 | 1176 days ago | IN | 0 ETH | 0.01828799 | ||||
Redeem | 13153336 | 1177 days ago | IN | 0 ETH | 0.00792578 | ||||
Setup | 13124335 | 1181 days ago | IN | 0 ETH | 0.01953237 | ||||
Redeem | 13121651 | 1182 days ago | IN | 0 ETH | 0.00445248 | ||||
Buy | 13120502 | 1182 days ago | IN | 0.1 ETH | 0.00379414 | ||||
Setup | 13113844 | 1183 days ago | IN | 0 ETH | 0.01173666 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19134160 | 296 days ago | 3.1152632 ETH | ||||
19134160 | 296 days ago | Contract Creation | 0 ETH | |||
19134160 | 296 days ago | 3.1152632 ETH | ||||
19134160 | 296 days ago | Contract Creation | 0 ETH | |||
19134160 | 296 days ago | 3.1152632 ETH | ||||
13459276 | 1129 days ago | 0.25 ETH | ||||
13284989 | 1156 days ago | 0.02 ETH | ||||
13209647 | 1168 days ago | 0.02 ETH | ||||
13153336 | 1177 days ago | 0.1 ETH | ||||
13121651 | 1182 days ago | 0.01 ETH | ||||
13105757 | 1184 days ago | 0.05 ETH | ||||
13082954 | 1188 days ago | 0.1 ETH | ||||
13065503 | 1190 days ago | 0.07 ETH | ||||
13027694 | 1196 days ago | 0.0028 ETH | ||||
12963056 | 1206 days ago | 0.28 ETH | ||||
12963056 | 1206 days ago | 0.07 ETH | ||||
12963056 | 1206 days ago | Contract Creation | 0 ETH | |||
12943454 | 1209 days ago | 0.56 ETH | ||||
12908732 | 1215 days ago | 0.10079999 ETH | ||||
12908732 | 1215 days ago | 0.02519999 ETH | ||||
12908732 | 1215 days ago | Contract Creation | 0 ETH | |||
12907791 | 1215 days ago | 0 ETH | ||||
12874813 | 1220 days ago | 0.042 ETH | ||||
12869822 | 1221 days ago | 0.014 ETH | ||||
12856199 | 1223 days ago | 0.0025 ETH |
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:
FixedPriceSaleModule
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/proxy/Clones.sol"; import "../../initializable/BondingCurve3.sol"; import "../../governance/IGovernance.sol"; import "../../utils/Timers.sol"; import "../ModuleBase.sol"; struct Allocation { address receiver; uint256 amount; } contract FixedPriceSaleModule is IModule, ModuleBase, Timers { string public constant override name = type(FixedPriceSaleModule).name; // address public constant CURVE_PREMINT_RESERVE = address(uint160(uint256(keccak256("CURVE_PREMINT_RESERVE")) - 1)); address public constant CURVE_PREMINT_RESERVE = 0x3cc5B802b34A42Db4cBe41ae3aD5c06e1A4481c9; // bytes32 public constant PCT_ETH_TO_CURVE = bytes32(uint256(keccak256("PCT_ETH_TO_CURVE")) - 1); bytes32 public constant PCT_ETH_TO_CURVE = 0xd6b8be26fe56c2461902fe9d3f529cdf9f02521932f09d2107fe448477d59e9f; // bytes32 public constant CURVE_TEMPLATE = bytes32(uint256(keccak256("CURVE_TEMPLATE")) - 1); bytes32 public constant CURVE_TEMPLATE = 0x3cec7c13345ae32e688f81840d184c63978bb776762e026e7e61d891bb2dd84b; mapping(ShardedWallet => address) public recipients; mapping(ShardedWallet => uint256) public prices; mapping(ShardedWallet => uint256) public balance; mapping(ShardedWallet => uint256) public remainingShards; mapping(ShardedWallet => mapping(address => uint256)) public premintShards; mapping(ShardedWallet => mapping(address => uint256)) public boughtShards; event ShardsPrebuy(ShardedWallet indexed wallet, address indexed receiver, uint256 count); event ShardsBought(ShardedWallet indexed wallet, address indexed from, address to, uint256 count); event ShardsRedeemedSuccess(ShardedWallet indexed wallet, address indexed from, address to, uint256 count); event ShardsRedeemedFailure(ShardedWallet indexed wallet, address indexed from, address to, uint256 count); event OwnershipReclaimed(ShardedWallet indexed wallet, address indexed from, address to); event Withdraw(ShardedWallet indexed wallet, address indexed from, address to, uint256 value); event NewBondingCurve(ShardedWallet indexed wallet, address indexed curve); modifier onlyCrowdsaleActive(ShardedWallet wallet) { require(_duringTimer(bytes32(uint256(uint160(address(wallet))))) && remainingShards[wallet] > 0); _; } modifier onlyCrowdsaleFinished(ShardedWallet wallet) { require(_afterTimer(bytes32(uint256(uint160(address(wallet))))) || remainingShards[wallet] == 0); _; } modifier onlyCrowdsaleSuccess(ShardedWallet wallet) { require(remainingShards[wallet] == 0); _; } modifier onlyRecipient(ShardedWallet wallet) { require(recipients[wallet] == msg.sender); _; } constructor(address walletTemplate) ModuleBase(walletTemplate) {} function setup( ShardedWallet wallet, address recipient, uint256 price, uint256 duration, // !TODO controlled by Governance.sol possibly? uint256 totalSupply, Allocation[] calldata premints) external onlyShardedWallet(wallet) onlyBeforeTimer(bytes32(uint256(uint160(address(wallet))))) onlyOwner(wallet, msg.sender) { require(wallet.totalSupply() == 0); wallet.moduleMint(address(this), totalSupply); wallet.moduleTransferOwnership(address(this)); Timers._startTimer(bytes32(uint256(uint160(address(wallet)))), duration); // Allocate the premints for (uint256 i = 0; i < premints.length; ++i) { premintShards[wallet][premints[i].receiver] += premints[i].amount; totalSupply -= premints[i].amount; emit ShardsPrebuy(wallet, premints[i].receiver, premints[i].amount); } recipients[wallet] = recipient; prices[wallet] = price; remainingShards[wallet] = totalSupply; } function buy(ShardedWallet wallet, address to) external payable onlyCrowdsaleActive(wallet) { require(to != CURVE_PREMINT_RESERVE); uint256 price = prices[wallet]; uint256 count = Math.min(msg.value * 10**18 / price, remainingShards[wallet]); uint256 value = count * price / 10**18; balance[wallet] += value; boughtShards[wallet][to] += count; remainingShards[wallet] -= count; if (remainingShards[wallet] == 0) { // crowdsaleSuccess wallet.renounceOwnership(); // make address(0) owner for actions } Address.sendValue(payable(msg.sender), msg.value - value); emit ShardsBought(wallet, msg.sender, to, count); } function redeem(ShardedWallet wallet, address to) external onlyCrowdsaleFinished(wallet) { require(to != CURVE_PREMINT_RESERVE); uint256 premint = premintShards[wallet][to]; uint256 bought = boughtShards[wallet][to]; delete premintShards[wallet][to]; delete boughtShards[wallet][to]; if (remainingShards[wallet] == 0) { // crowdsaleSuccess uint256 shards = premint + bought; wallet.transfer(to, shards); emit ShardsRedeemedSuccess(wallet, msg.sender, to, shards); } else { uint256 value = bought * prices[wallet] / 10**18; balance[wallet] -= value; remainingShards[wallet] += premint + bought; Address.sendValue(payable(to), value); emit ShardsRedeemedFailure(wallet, msg.sender, to, bought); } } function _makeCurve(ShardedWallet wallet, uint256 valueToCurve, uint256 shardsToCurve) internal returns (address) { IGovernance governance = wallet.governance(); address template = address(uint160(governance.getConfig(address(wallet), CURVE_TEMPLATE))); if (template != address(0)) { address curve = Clones.cloneDeterministic(template, bytes32(uint256(uint160(address(wallet))))); wallet.approve(curve, shardsToCurve); BondingCurve3(curve).initialize{value: valueToCurve}( shardsToCurve, address(wallet), recipients[wallet], prices[wallet] ); emit NewBondingCurve(wallet, curve); return curve; } else { return address(0); } } function withdraw(ShardedWallet wallet) public onlyCrowdsaleFinished(wallet) { address to = recipients[wallet]; if (remainingShards[wallet] == 0) { // crowdsaleSuccess uint256 shardsToCurve = premintShards[wallet][CURVE_PREMINT_RESERVE]; uint256 valueToCurve = balance[wallet] * wallet.governance().getConfig(address(wallet), PCT_ETH_TO_CURVE) / 10**18; uint256 value = balance[wallet] - valueToCurve; address curve = _makeCurve(wallet, valueToCurve, shardsToCurve); delete balance[wallet]; delete premintShards[wallet][CURVE_PREMINT_RESERVE]; if (curve == address(0)) { wallet.transfer(payable(to), shardsToCurve); value += valueToCurve; } Address.sendValue(payable(to), value); emit Withdraw(wallet, msg.sender, to, value); } else { wallet.transferOwnership(to); emit OwnershipReclaimed(wallet, msg.sender, to); } } function cleanup(ShardedWallet wallet) external onlyCrowdsaleFinished(wallet) { uint256 totalSupply = wallet.totalSupply(); require(remainingShards[wallet] + premintShards[wallet][CURVE_PREMINT_RESERVE] == totalSupply, "Crowdsale dirty, not all allocation have been claimed"); // failure + redeems wallet.moduleBurn(address(this), totalSupply); Timers._resetTimer(bytes32(uint256(uint160(address(wallet))))); } function deadline(ShardedWallet wallet) external view returns (uint256) { return _getDeadline(bytes32(uint256(uint160(address(wallet))))); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt, address deployer) internal pure returns (address predicted) { // solhint-disable-next-line no-inline-assembly assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./ERC20.sol"; import "../wallet/ShardedWallet.sol"; import "../governance/IGovernance.sol"; import "../interface/IERC1363Receiver.sol"; import "../interface/IERC1363Spender.sol"; contract LiquidityToken is ERC20 { address public controler; modifier onlyControler() { require(msg.sender == controler); _; } constructor() { controler = address(0xdead); } function initialize(address controler_, string memory name_, string memory symbol_) public { require(controler == address(0)); controler = controler_; _initialize(name_, symbol_); } function controllerTransfer(address sender, address recipient, uint256 amount) public onlyControler { _transfer(sender, recipient, amount); } function controllerMint(address account, uint256 amount) public onlyControler { _mint(account, amount); } function controllerBurn(address account, uint256 amount) public onlyControler { _burn(account, amount); } } contract BondingCurve3 is IERC1363Spender { struct CurveCoordinates { uint256 x; uint256 k; } struct Asset { uint256 underlyingSupply; uint256 feeToNiftex; uint256 feeToArtist; } LiquidityToken immutable internal _template; // bytes32 public constant PCT_FEE_SUPPLIERS = bytes32(uint256(keccak256("PCT_FEE_SUPPLIERS")) - 1); bytes32 public constant PCT_FEE_SUPPLIERS = 0xe4f5729eb40e38b5a39dfb36d76ead9f9bc286f06852595980c5078f1af7e8c9; // bytes32 public constant PCT_FEE_ARTIST = bytes32(uint256(keccak256("PCT_FEE_ARTIST")) - 1); bytes32 public constant PCT_FEE_ARTIST = 0xdd0618e2e2a17ff193a933618181c8f8909dc169e9707cce1921893a88739ca0; // bytes32 public constant PCT_FEE_NIFTEX = bytes32(uint256(keccak256("PCT_FEE_NIFTEX")) - 1); bytes32 public constant PCT_FEE_NIFTEX = 0xcfb1dd89e6f4506eca597e7558fbcfe22dbc7e0b9f2b3956e121d0e344d6f7aa; // bytes32 public constant LIQUIDITY_TIMELOCK = bytes32(uint256(keccak256("LIQUIDITY_TIMELOCK")) - 1); bytes32 public constant LIQUIDITY_TIMELOCK = 0x4babff57ebd34f251a515a845400ed950a51f0a64c92e803a3e144fc40623fa8; LiquidityToken public etherLPToken; LiquidityToken public shardLPToken; CurveCoordinates public curve; Asset internal _etherLPExtra; Asset internal _shardLPExtra; address public wallet; address public recipient; uint256 public deadline; uint256 public recordedTotalSupply; event Initialized(address wallet); event ShardsBought(address indexed account, uint256 amount, uint256 cost); event ShardsSold(address indexed account, uint256 amount, uint256 payout); event ShardsSupplied(address indexed provider, uint256 amount); event EtherSupplied(address indexed provider, uint256 amount); event ShardsWithdrawn(address indexed provider, uint256 payout, uint256 shards, uint256 amountLPToken); event EtherWithdrawn(address indexed provider, uint256 value, uint256 payout, uint256 amountLPToken); constructor() { _template = new LiquidityToken(); wallet = address(0xdead); } function initialize( uint256 supply, address wallet_, address recipient_, uint256 price ) public payable { require(wallet == address(0)); recordedTotalSupply = ShardedWallet(payable(wallet_)).totalSupply(); string memory name_ = ShardedWallet(payable(wallet_)).name(); string memory symbol_ = ShardedWallet(payable(wallet_)).symbol(); etherLPToken = LiquidityToken(Clones.clone(address(_template))); shardLPToken = LiquidityToken(Clones.clone(address(_template))); etherLPToken.initialize(address(this), string(abi.encodePacked(name_, "-EtherLP")), string(abi.encodePacked(symbol_, "-ELP"))); shardLPToken.initialize(address(this), string(abi.encodePacked(name_, "-ShardLP")), string(abi.encodePacked(symbol_, "-SLP"))); wallet = wallet_; recipient = recipient_; deadline = block.timestamp + ShardedWallet(payable(wallet_)).governance().getConfig(wallet_, LIQUIDITY_TIMELOCK); emit Initialized(wallet_); // transfer assets if (supply > 0) { require(ShardedWallet(payable(wallet_)).transferFrom(msg.sender, address(this), supply)); } { // setup curve uint256 decimals_ = ShardedWallet(payable(wallet_)).decimals(); curve.x = recordedTotalSupply; curve.k = recordedTotalSupply * recordedTotalSupply * price / 10**decimals_; } // mint liquidity etherLPToken.controllerMint(address(this), msg.value); shardLPToken.controllerMint(address(this), supply); _etherLPExtra.underlyingSupply = msg.value; _shardLPExtra.underlyingSupply = supply; emit EtherSupplied(address(this), msg.value); emit ShardsSupplied(address(this), supply); } function buyShards(uint256 amount, uint256 maxCost) public payable { uint256 cost = _buyShards(msg.sender, amount, maxCost); require(cost <= msg.value); if (msg.value > cost) { Address.sendValue(payable(msg.sender), msg.value - cost); } } function sellShards(uint256 amount, uint256 minPayout) public { require(ShardedWallet(payable(wallet)).transferFrom(msg.sender, address(this), amount)); _sellShards(msg.sender, amount, minPayout); } function supplyEther() public payable { _supplyEther(msg.sender, msg.value); } function supplyShards(uint256 amount) public { require(ShardedWallet(payable(wallet)).transferFrom(msg.sender, address(this), amount)); _supplyShards(msg.sender, amount); } function onApprovalReceived(address owner, uint256 amount, bytes calldata data) public override returns (bytes4) { require(msg.sender == wallet); require(ShardedWallet(payable(wallet)).transferFrom(owner, address(this), amount)); bytes4 selector = abi.decode(data, (bytes4)); if (selector == this.sellShards.selector) { (,uint256 minPayout) = abi.decode(data, (bytes4, uint256)); _sellShards(owner, amount, minPayout); } else if (selector == this.supplyShards.selector) { _supplyShards(owner, amount); } else { revert("invalid selector in onApprovalReceived data"); } return this.onApprovalReceived.selector; } function _buyShards(address buyer, uint256 amount, uint256 maxCost) internal returns (uint256) { IGovernance governance = ShardedWallet(payable(wallet)).governance(); address owner = ShardedWallet(payable(wallet)).owner(); address artist = ShardedWallet(payable(wallet)).artistWallet(); // pause if someone else reclaimed the ownership of shardedWallet require(owner == address(0) || governance.isModule(wallet, owner)); // compute fees uint256[3] memory fees; fees[0] = governance.getConfig(wallet, PCT_FEE_SUPPLIERS); fees[1] = governance.getConfig(wallet, PCT_FEE_NIFTEX); fees[2] = artist == address(0) ? 0 : governance.getConfig(wallet, PCT_FEE_ARTIST); uint256 amountWithFee = amount * (10**18 + fees[0] + fees[1] + fees[2]) / 10**18; // check curve update uint256 newX = curve.x - amountWithFee; uint256 newY = curve.k / newX; require(newX > 0 && newY > 0); // check cost uint256 cost = newY - curve.k / curve.x; require(cost <= maxCost); // consistency check require(ShardedWallet(payable(wallet)).balanceOf(address(this)) - _shardLPExtra.feeToNiftex - _shardLPExtra.feeToArtist >= amount * (10**18 + fees[1] + fees[2]) / 10**18); // update curve curve.x = curve.x - amount * (10**18 + fees[1] + fees[2]) / 10**18; // update LP supply _shardLPExtra.underlyingSupply += amount * fees[0] / 10**18; _shardLPExtra.feeToNiftex += amount * fees[1] / 10**18; _shardLPExtra.feeToArtist += amount * fees[2] / 10**18; // transfer ShardedWallet(payable(wallet)).transfer(buyer, amount); emit ShardsBought(buyer, amount, cost); return cost; } function _sellShards(address seller, uint256 amount, uint256 minPayout) internal returns (uint256) { IGovernance governance = ShardedWallet(payable(wallet)).governance(); address owner = ShardedWallet(payable(wallet)).owner(); address artist = ShardedWallet(payable(wallet)).artistWallet(); // pause if someone else reclaimed the ownership of shardedWallet require(owner == address(0) || governance.isModule(wallet, owner)); // compute fees uint256[3] memory fees; fees[0] = governance.getConfig(wallet, PCT_FEE_SUPPLIERS); fees[1] = governance.getConfig(wallet, PCT_FEE_NIFTEX); fees[2] = artist == address(0) ? 0 : governance.getConfig(wallet, PCT_FEE_ARTIST); uint256 newX = curve.x + amount; uint256 newY = curve.k / newX; require(newX > 0 && newY > 0); // check payout uint256 payout = curve.k / curve.x - newY; require(payout <= address(this).balance - _etherLPExtra.feeToNiftex - _etherLPExtra.feeToArtist); uint256 value = payout * (10**18 - fees[0] - fees[1] - fees[2]) / 10**18; require(value >= minPayout); // update curve curve.x = newX; // update LP supply _etherLPExtra.underlyingSupply += payout * fees[0] / 10**18; _etherLPExtra.feeToNiftex += payout * fees[1] / 10**18; _etherLPExtra.feeToArtist += payout * fees[2] / 10**18; // transfer Address.sendValue(payable(seller), value); emit ShardsSold(seller, amount, value); return value; } function _supplyEther(address supplier, uint256 amount) internal { etherLPToken.controllerMint(supplier, calcNewEthLPTokensToIssue(amount)); _etherLPExtra.underlyingSupply += amount; emit EtherSupplied(supplier, amount); } function _supplyShards(address supplier, uint256 amount) internal { shardLPToken.controllerMint(supplier, calcNewShardLPTokensToIssue(amount)); _shardLPExtra.underlyingSupply += amount; emit ShardsSupplied(supplier, amount); } function calcNewShardLPTokensToIssue(uint256 amount) public view returns (uint256) { uint256 pool = _shardLPExtra.underlyingSupply; if (pool == 0) { return amount; } uint256 proportion = amount * 10**18 / (pool + amount); return proportion * shardLPToken.totalSupply() / (10**18 - proportion); } function calcNewEthLPTokensToIssue(uint256 amount) public view returns (uint256) { uint256 pool = _etherLPExtra.underlyingSupply; if (pool == 0) { return amount; } uint256 proportion = amount * 10**18 / (pool + amount); return proportion * etherLPToken.totalSupply() / (10**18 - proportion); } function calcShardsForEthSuppliers() public view returns (uint256) { uint256 balance = ShardedWallet(payable(wallet)).balanceOf(address(this)) - _shardLPExtra.feeToNiftex - _shardLPExtra.feeToArtist; return balance < _shardLPExtra.underlyingSupply ? 0 : balance - _shardLPExtra.underlyingSupply; } function calcEthForShardSuppliers() public view returns (uint256) { uint256 balance = address(this).balance - _etherLPExtra.feeToNiftex - _etherLPExtra.feeToArtist; return balance < _etherLPExtra.underlyingSupply ? 0 : balance - _etherLPExtra.underlyingSupply; } function withdrawSuppliedEther(uint256 amount) external returns (uint256, uint256) { require(amount > 0); uint256 etherLPTokenSupply = etherLPToken.totalSupply(); uint256 balance = address(this).balance - _etherLPExtra.feeToNiftex - _etherLPExtra.feeToArtist; uint256 value = (balance <= _etherLPExtra.underlyingSupply) ? balance * amount / etherLPTokenSupply : _etherLPExtra.underlyingSupply * amount / etherLPTokenSupply; uint256 payout = calcShardsForEthSuppliers() * amount / etherLPTokenSupply; // update balances _etherLPExtra.underlyingSupply *= etherLPTokenSupply - amount; _etherLPExtra.underlyingSupply /= etherLPTokenSupply; etherLPToken.controllerBurn(msg.sender, amount); // transfer Address.sendValue(payable(msg.sender), value); if (payout > 0) { ShardedWallet(payable(wallet)).transfer(msg.sender, payout); } emit EtherWithdrawn(msg.sender, value, payout, amount); return (value, payout); } function withdrawSuppliedShards(uint256 amount) external returns (uint256, uint256) { require(amount > 0); uint256 shardLPTokenSupply = shardLPToken.totalSupply(); uint256 balance = ShardedWallet(payable(wallet)).balanceOf(address(this)) - _shardLPExtra.feeToNiftex - _shardLPExtra.feeToArtist; uint256 shards = (balance <= _shardLPExtra.underlyingSupply) ? balance * amount / shardLPTokenSupply : _shardLPExtra.underlyingSupply * amount / shardLPTokenSupply; uint256 payout = calcEthForShardSuppliers() * amount / shardLPTokenSupply; // update balances _shardLPExtra.underlyingSupply *= shardLPTokenSupply - amount; _shardLPExtra.underlyingSupply /= shardLPTokenSupply; shardLPToken.controllerBurn(msg.sender, amount); // transfer ShardedWallet(payable(wallet)).transfer(msg.sender, shards); if (payout > 0) { Address.sendValue(payable(msg.sender), payout); } emit ShardsWithdrawn(msg.sender, payout, shards, amount); return (payout, shards); } function withdrawNiftexOrArtistFees(address to) public { uint256 etherFees = 0; uint256 shardFees = 0; if (msg.sender == ShardedWallet(payable(wallet)).artistWallet()) { etherFees += _etherLPExtra.feeToArtist; shardFees += _shardLPExtra.feeToArtist; delete _etherLPExtra.feeToArtist; delete _shardLPExtra.feeToArtist; } if (msg.sender == ShardedWallet(payable(wallet)).governance().getNiftexWallet()) { etherFees += _etherLPExtra.feeToNiftex; shardFees += _shardLPExtra.feeToNiftex; delete _etherLPExtra.feeToNiftex; delete _shardLPExtra.feeToNiftex; } Address.sendValue(payable(to), etherFees); ShardedWallet(payable(wallet)).transfer(to, shardFees); } function rebaseWhenTotalSupplyChange() public { uint256 newTotalSupply_ = ShardedWallet(payable(wallet)).totalSupply(); require (newTotalSupply_ != recordedTotalSupply); curve.k = curve.k * newTotalSupply_ / recordedTotalSupply * newTotalSupply_ / recordedTotalSupply; // new k = (new supply/old supply)^2 * old k, intentionally * / * / to avoid uint overflow; curve.x = curve.x * newTotalSupply_ / recordedTotalSupply; // new x = (new supply/old supply) * old x recordedTotalSupply = newTotalSupply_; assert(curve.k > 0); assert(curve.x > 0); assert(recordedTotalSupply > 0); } function transferTimelockLiquidity() public { require(deadline < block.timestamp); etherLPToken.controllerTransfer(address(this), recipient, getEthLPTokens(address(this))); shardLPToken.controllerTransfer(address(this), recipient, getShardLPTokens(address(this))); } function getEthLPTokens(address owner) public view returns (uint256) { return etherLPToken.balanceOf(owner); } function getShardLPTokens(address owner) public view returns (uint256) { return shardLPToken.balanceOf(owner); } function transferEthLPTokens(address to, uint256 amount) public { etherLPToken.controllerTransfer(msg.sender, to, amount); } function transferShardLPTokens(address to, uint256 amount) public { shardLPToken.controllerTransfer(msg.sender, to, amount); } function getCurrentPrice() external view returns (uint256) { return curve.k * 10**18 / curve.x / curve.x; } function getEthSuppliers() external view returns (uint256, uint256, uint256, uint256) { return (_etherLPExtra.underlyingSupply, etherLPToken.totalSupply(), _etherLPExtra.feeToNiftex, _etherLPExtra.feeToArtist); } function getShardSuppliers() external view returns (uint256, uint256, uint256, uint256) { return (_shardLPExtra.underlyingSupply, shardLPToken.totalSupply(), _shardLPExtra.feeToNiftex, _shardLPExtra.feeToArtist); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGovernance { function isModule(address, address) external view returns (bool); function isAuthorized(address, address) external view returns (bool); function getModule(address, bytes4) external view returns (address); function getConfig(address, bytes32) external view returns (uint256); function getNiftexWallet() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Timers { mapping(bytes32 => uint256) private _deadlines; event TimerStarted(bytes32 indexed timer, uint256 deadline); event TimerStopped(bytes32 indexed timer); event TimerReset(bytes32 indexed timer); modifier onlyBeforeTimer(bytes32 id) { require(_beforeTimer(id), "WithTimers: onlyBeforeTimer"); _; } modifier onlyDuringTimer(bytes32 id) { require(_duringTimer(id), "WithTimers: onlyDuringTimer"); _; } modifier onlyAfterTimer(bytes32 id) { require(_afterTimer(id), "WithTimers: onlyAfterTimer"); _; } function _beforeTimer(bytes32 id) internal view returns (bool) { return _deadlines[id] == 0; } function _duringTimer(bytes32 id) internal view returns (bool) { uint256 deadline = _deadlines[id]; // solhint-disable-next-line not-rely-on-time return deadline != 0 && deadline > block.timestamp; } function _afterTimer(bytes32 id) internal view returns (bool) { uint256 deadline = _deadlines[id]; // solhint-disable-next-line not-rely-on-time return deadline != 0 && deadline <= block.timestamp; } function _startTimer(bytes32 id, uint256 delay) internal onlyBeforeTimer(id) { // solhint-disable-next-line not-rely-on-time uint256 deadline = block.timestamp + delay; _deadlines[id] = deadline; emit TimerStarted(id, deadline); } function _stopTimer(bytes32 id) internal onlyDuringTimer(id) { delete _deadlines[id]; emit TimerStopped(id); } function _resetTimer(bytes32 id) internal onlyAfterTimer(id) { delete _deadlines[id]; emit TimerReset(id); } function _getDeadline(bytes32 id) internal view returns (uint256) { return _deadlines[id]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../wallet/ShardedWallet.sol"; import "./IModule.sol"; abstract contract ModuleBase is IModule { address immutable public walletTemplate; constructor(address walletTemplate_) { walletTemplate = walletTemplate_; } modifier onlyShardedWallet(ShardedWallet wallet) { require(isClone(walletTemplate, address(wallet))); _; } modifier onlyAuthorized(ShardedWallet wallet, address user) { require(wallet.governance().isAuthorized(address(wallet), user)); _; } modifier onlyOwner(ShardedWallet wallet, address user) { require(wallet.owner() == user); _; } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000) mstore(add(clone, 0xa), targetBytes) mstore(add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; function _initialize(string memory name_, string memory symbol_) internal virtual { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), currentAllowance - amount); _burn(account, amount); } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "../governance/IGovernance.sol"; import "../initializable/Ownable.sol"; import "../initializable/ERC20.sol"; import "../initializable/ERC1363.sol"; contract ShardedWallet is Ownable, ERC20, ERC1363Approve { // bytes32 public constant ALLOW_GOVERNANCE_UPGRADE = bytes32(uint256(keccak256("ALLOW_GOVERNANCE_UPGRADE")) - 1); bytes32 public constant ALLOW_GOVERNANCE_UPGRADE = 0xedde61aea0459bc05d70dd3441790ccfb6c17980a380201b00eca6f9ef50452a; IGovernance public governance; address public artistWallet; event Received(address indexed sender, uint256 value, bytes data); event Execute(address indexed to, uint256 value, bytes data); event ModuleExecute(address indexed module, address indexed to, uint256 value, bytes data); event GovernanceUpdated(address indexed oldGovernance, address indexed newGovernance); event ArtistUpdated(address indexed oldArtist, address indexed newArtist); modifier onlyModule() { require(_isModule(msg.sender), "Access restricted to modules"); _; } /************************************************************************* * Contructor and fallbacks * *************************************************************************/ constructor() { governance = IGovernance(address(0xdead)); } receive() external payable { emit Received(msg.sender, msg.value, bytes("")); } fallback() external payable { address module = governance.getModule(address(this), msg.sig); if (module != address(0) && _isModule(module)) { (bool success, /*bytes memory returndata*/) = module.staticcall(msg.data); // returning bytes in fallback is not supported until solidity 0.8.0 // solhint-disable-next-line no-inline-assembly assembly { returndatacopy(0, 0, returndatasize()) switch success case 0 { revert(0, returndatasize()) } default { return (0, returndatasize()) } } } else { emit Received(msg.sender, msg.value, msg.data); } } /************************************************************************* * Initialization * *************************************************************************/ function initialize( address governance_, address minter_, string calldata name_, string calldata symbol_, address artistWallet_ ) external { require(address(governance) == address(0)); governance = IGovernance(governance_); Ownable._setOwner(minter_); ERC20._initialize(name_, symbol_); artistWallet = artistWallet_; emit GovernanceUpdated(address(0), governance_); } function _isModule(address module) internal view returns (bool) { return governance.isModule(address(this), module); } /************************************************************************* * Owner interactions * *************************************************************************/ function execute(address to, uint256 value, bytes calldata data) external onlyOwner() { Address.functionCallWithValue(to, data, value); emit Execute(to, value, data); } function retrieve(address newOwner) external { ERC20._burn(msg.sender, Math.max(ERC20.totalSupply(), 1)); Ownable._setOwner(newOwner); } /************************************************************************* * Module interactions * *************************************************************************/ function moduleExecute(address to, uint256 value, bytes calldata data) external onlyModule() { if (Address.isContract(to)) { Address.functionCallWithValue(to, data, value); } else { Address.sendValue(payable(to), value); } emit ModuleExecute(msg.sender, to, value, data); } function moduleMint(address to, uint256 value) external onlyModule() { ERC20._mint(to, value); } function moduleBurn(address from, uint256 value) external onlyModule() { ERC20._burn(from, value); } function moduleTransfer(address from, address to, uint256 value) external onlyModule() { ERC20._transfer(from, to, value); } function moduleTransferOwnership(address to) external onlyModule() { Ownable._setOwner(to); } function updateGovernance(address newGovernance) external onlyModule() { emit GovernanceUpdated(address(governance), newGovernance); require(governance.getConfig(address(this), ALLOW_GOVERNANCE_UPGRADE) > 0); require(Address.isContract(newGovernance)); governance = IGovernance(newGovernance); } function updateArtistWallet(address newArtistWallet) external onlyModule() { emit ArtistUpdated(artistWallet, newArtistWallet); artistWallet = newArtistWallet; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC1363Receiver interface * @dev Interface for any contract that wants to support `transferAndCall` or `transferFromAndCall` * from ERC1363 token contracts. */ interface IERC1363Receiver { /* * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) */ /** * @notice Handle the receipt of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the * transfer. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the token contract address is always the message sender. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` * unless throwing */ function onTransferReceived(address operator, address from, uint256 value, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC1363Spender interface * @dev Interface for any contract that wants to support `approveAndCall` * from ERC1363 token contracts. */ interface IERC1363Spender { /* * Note: the ERC-165 identifier for this interface is 0.8.04a2d0. * 0.8.04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)")) */ /** * @notice Handle the approval of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after an `approve`. This function MAY throw to revert and reject the * approval. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the token contract address is always the message sender. * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` * unless throwing */ function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function _setOwner(address owner_) internal { emit OwnershipTransferred(_owner, owner_); _owner = owner_; } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20.sol"; import "../interface/IERC1363.sol"; import "../interface/IERC1363Receiver.sol"; import "../interface/IERC1363Spender.sol"; abstract contract ERC1363Transfer is ERC20, IERC1363Transfer { function transferAndCall(address to, uint256 value) public override returns (bool) { return transferAndCall(to, value, bytes("")); } function transferAndCall(address to, uint256 value, bytes memory data) public override returns (bool) { require(transfer(to, value)); try IERC1363Receiver(to).onTransferReceived(_msgSender(), _msgSender(), value, data) returns (bytes4 selector) { require(selector == IERC1363Receiver(to).onTransferReceived.selector, "ERC1363: onTransferReceived invalid result"); } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1363: onTransferReceived reverted without reason"); } return true; } function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) { return transferFromAndCall(from, to, value, bytes("")); } function transferFromAndCall(address from, address to, uint256 value, bytes memory data) public override returns (bool) { require(transferFrom(from, to, value)); try IERC1363Receiver(to).onTransferReceived(_msgSender(), from, value, data) returns (bytes4 selector) { require(selector == IERC1363Receiver(to).onTransferReceived.selector, "ERC1363: onTransferReceived invalid result"); } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1363: onTransferReceived reverted without reason"); } return true; } } abstract contract ERC1363Approve is ERC20, IERC1363Approve { function approveAndCall(address spender, uint256 value) public override returns (bool) { return approveAndCall(spender, value, bytes("")); } function approveAndCall(address spender, uint256 value, bytes memory data) public override returns (bool) { require(approve(spender, value)); try IERC1363Spender(spender).onApprovalReceived(_msgSender(), value, data) returns (bytes4 selector) { require(selector == IERC1363Spender(spender).onApprovalReceived.selector, "ERC1363: onApprovalReceived invalid result"); } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1363: onApprovalReceived reverted without reason"); } return true; } } abstract contract ERC1363 is ERC1363Transfer, ERC1363Approve {}
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC1363Transfer { /* * Note: the ERC-165 identifier for this interface is 0x4bbee2df. * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); } interface IERC1363Approve { /* * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce. * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format, sent in call to `spender` */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); } interface IERC1363 is IERC1363Transfer, IERC1363Approve { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IModule { function name() external view returns (string memory); }
{ "optimizer": { "enabled": true, "runs": 999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"walletTemplate","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"curve","type":"address"}],"name":"NewBondingCurve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipReclaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"ShardsBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"ShardsPrebuy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"ShardsRedeemedFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"ShardsRedeemedSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"timer","type":"bytes32"}],"name":"TimerReset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"timer","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"TimerStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"timer","type":"bytes32"}],"name":"TimerStopped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CURVE_PREMINT_RESERVE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CURVE_TEMPLATE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PCT_ETH_TO_CURVE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"}],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"boughtShards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"}],"name":"cleanup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"}],"name":"deadline","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"premintShards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"}],"name":"prices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"}],"name":"recipients","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"","type":"address"}],"name":"remainingShards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Allocation[]","name":"premints","type":"tuple[]"}],"name":"setup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"walletTemplate","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ShardedWallet","name":"wallet","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b50604051611e42380380611e4283398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c611dab610097600039600081816102c501526104440152611dab6000f3fe60806040526004361061010e5760003560e01c80635997b63e116100a5578063cfed246b11610074578063e3d670d711610059578063e3d670d7146103bb578063eb820312146103e8578063fbacefce1461041e5761010e565b8063cfed246b14610366578063d664255a146103935761010e565b80635997b63e146102b3578063ad7fadc5146102ff578063bba06f2714610312578063cf7b446b146103325761010e565b80633da1ff82116100e15780633da1ff8214610219578063411bc7e71461025157806351cff8d9146102735780635403b394146102935761010e565b806306fdde03146101135780632ed604e7146101725780633283b803146101ad57806333637a87146101e1575b600080fd5b34801561011f57600080fd5b5061015c6040518060400160405260148152806020017f4669786564507269636553616c654d6f64756c6500000000000000000000000081525081565b6040516101699190611c6b565b60405180910390f35b34801561017e57600080fd5b5061019f61018d366004611b10565b60046020526000908152604090205481565b604051908152602001610169565b3480156101b957600080fd5b5061019f7fd6b8be26fe56c2461902fe9d3f529cdf9f02521932f09d2107fe448477d59e9f81565b3480156101ed57600080fd5b5061019f6101fc366004611b68565b600660209081526000928352604080842090915290825290205481565b34801561022557600080fd5b5061019f610234366004611b68565b600560209081526000928352604080842090915290825290205481565b34801561025d57600080fd5b5061027161026c366004611ba0565b61043e565b005b34801561027f57600080fd5b5061027161028e366004611b10565b61090f565b34801561029f57600080fd5b5061019f6102ae366004611b10565b610d37565b3480156102bf57600080fd5b506102e77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610169565b61027161030d366004611b68565b610d57565b34801561031e57600080fd5b5061027161032d366004611b68565b610faa565b34801561033e57600080fd5b5061019f7f3cec7c13345ae32e688f81840d184c63978bb776762e026e7e61d891bb2dd84b81565b34801561037257600080fd5b5061019f610381366004611b10565b60026020526000908152604090205481565b34801561039f57600080fd5b506102e7733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c981565b3480156103c757600080fd5b5061019f6103d6366004611b10565b60036020526000908152604090205481565b3480156103f457600080fd5b506102e7610403366004611b10565b6001602052600090815260409020546001600160a01b031681565b34801561042a57600080fd5b50610271610439366004611b10565b611241565b866104697f000000000000000000000000000000000000000000000000000000000000000082611444565b61047257600080fd5b6001600160a01b038816600081815260208190526040902054156104dd5760405162461bcd60e51b815260206004820152601b60248201527f5769746854696d6572733a206f6e6c794265666f726554696d6572000000000060448201526064015b60405180910390fd5b8833806001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561052257600080fd5b505afa158015610536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055a9190611b2c565b6001600160a01b03161461056d57600080fd5b8a6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190611c53565b156105e857600080fd5b6040517f4e26463f000000000000000000000000000000000000000000000000000000008152306004820152602481018890526001600160a01b038c1690634e26463f90604401600060405180830381600087803b15801561064957600080fd5b505af115801561065d573d6000803e3d6000fd5b50506040517f36afba800000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038e1692506336afba809150602401600060405180830381600087803b1580156106bb57600080fd5b505af11580156106cf573d6000803e3d6000fd5b505050506106e98b6001600160a01b031660001b896114c6565b60005b858110156108a25786868281811061071457634e487b7160e01b600052603260045260246000fd5b90506040020160200135600560008e6001600160a01b03166001600160a01b03168152602001908152602001600020600089898581811061076557634e487b7160e01b600052603260045260246000fd5b61077b9260206040909202019081019150611b10565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546107aa9190611cbe565b9091555087905086828181106107d057634e487b7160e01b600052603260045260246000fd5b90506040020160200135886107e59190611d15565b975086868281811061080757634e487b7160e01b600052603260045260246000fd5b61081d9260206040909202019081019150611b10565b6001600160a01b03168c6001600160a01b03167f69807b61b47d45b65ae1234a541f04883c49ca35f4b705dd7098e9da0eb940f889898581811061087157634e487b7160e01b600052603260045260246000fd5b9050604002016020013560405161088a91815260200190565b60405180910390a361089b81611d2c565b90506106ec565b505050506001600160a01b03978816600090815260016020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169a909b169990991790995560028952878120969096555050600490955292909120919091555050565b806109226001600160a01b03821661157e565b8061094357506001600160a01b038116600090815260046020526040902054155b61094c57600080fd5b6001600160a01b03808316600090815260016020908152604080832054600490925290912054911690610c7b576001600160a01b0383166000818152600560209081526040808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c9845282528083205481517f5aa6e67500000000000000000000000000000000000000000000000000000000815291519094670de0b6b3a7640000939092635aa6e6759260048083019392829003018186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f9190611b2c565b604051627ebcdb60e21b81526001600160a01b0388811660048301527fd6b8be26fe56c2461902fe9d3f529cdf9f02521932f09d2107fe448477d59e9f602483015291909116906301faf36c9060440160206040518083038186803b158015610aa757600080fd5b505afa158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adf9190611c53565b6001600160a01b038716600090815260036020526040902054610b029190611cf6565b610b0c9190611cd6565b6001600160a01b03861660009081526003602052604081205491925090610b34908390611d15565b90506000610b438784866115a3565b6001600160a01b03808916600090815260036020908152604080832083905560058252808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c984529091528120559091508116610c1f5760405163a9059cbb60e01b81526001600160a01b0386811660048301526024820186905288169063a9059cbb90604401602060405180830381600087803b158015610bd957600080fd5b505af1158015610bed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c119190611b48565b50610c1c8383611cbe565b91505b610c298583611877565b604080516001600160a01b038781168252602082018590523392908a16917f3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7910160405180910390a350505050610d32565b6040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015284169063f2fde38b90602401600060405180830381600087803b158015610cd757600080fd5b505af1158015610ceb573d6000803e3d6000fd5b50506040516001600160a01b038481168252339350861691507f88ad5720ab58f3f3c19f34229d334358c71e227e2dcd92144999e9657b62bfe49060200160405180910390a35b505050565b6001600160a01b0381166000908152602081905260408120545b92915050565b81610d6a6001600160a01b038216611990565b8015610d8d57506001600160a01b03811660009081526004602052604090205415155b610d9657600080fd5b6001600160a01b038216733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c91415610dc057600080fd5b6001600160a01b03831660009081526002602052604081205490610e1882610df034670de0b6b3a7640000611cf6565b610dfa9190611cd6565b6001600160a01b0387166000908152600460205260409020546119b1565b90506000670de0b6b3a7640000610e2f8484611cf6565b610e399190611cd6565b6001600160a01b038716600090815260036020526040812080549293508392909190610e66908490611cbe565b90915550506001600160a01b03808716600090815260066020908152604080832093891683529290529081208054849290610ea2908490611cbe565b90915550506001600160a01b03861660009081526004602052604081208054849290610ecf908490611d15565b90915550506001600160a01b038616600090815260046020526040902054610f4557856001600160a01b031663715018a66040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f2c57600080fd5b505af1158015610f40573d6000803e3d6000fd5b505050505b610f5833610f538334611d15565b611877565b604080516001600160a01b038781168252602082018590523392908916917f238e3bccfa0594503e6ecfa4f8595fd564903445338b3e088888ad8d0504907691015b60405180910390a3505050505050565b81610fbd6001600160a01b03821661157e565b80610fde57506001600160a01b038116600090815260046020526040902054155b610fe757600080fd5b6001600160a01b038216733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c9141561101157600080fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825280832080548585526006845282852096855295835281842080549185905584905593835260049091529020546111485760006110728284611cbe565b60405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390529192509087169063a9059cbb90604401602060405180830381600087803b1580156110c057600080fd5b505af11580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f89190611b48565b50604080516001600160a01b038781168252602082018490523392908916917f601889ddcf03fa641ecfeab68a8c8bef0c5a935bb5725275fbb8b4c978d4eb97910160405180910390a35061123a565b6001600160a01b038516600090815260026020526040812054670de0b6b3a7640000906111759084611cf6565b61117f9190611cd6565b6001600160a01b0387166000908152600360205260408120805492935083929091906111ac908490611d15565b909155506111bc90508284611cbe565b6001600160a01b038716600090815260046020526040812080549091906111e4908490611cbe565b909155506111f490508582611877565b604080516001600160a01b038781168252602082018590523392908916917f8b65b4d395c9d0c8e226601c55009f48dfe26d1805928bb98b5f66d75562bde19101610f9a565b5050505050565b806112546001600160a01b03821661157e565b8061127557506001600160a01b038116600090815260046020526040902054155b61127e57600080fd5b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b957600080fd5b505afa1580156112cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f19190611c53565b6001600160a01b0384166000818152600560209081526040808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c98452825280832054938352600490915290205491925082916113439190611cbe565b146113b65760405162461bcd60e51b815260206004820152603560248201527f43726f776473616c652064697274792c206e6f7420616c6c20616c6c6f63617460448201527f696f6e2068617665206265656e20636c61696d6564000000000000000000000060648201526084016104d4565b6040517f91b98e0e000000000000000000000000000000000000000000000000000000008152306004820152602481018290526001600160a01b038416906391b98e0e90604401600060405180830381600087803b15801561141757600080fd5b505af115801561142b573d6000803e3d6000fd5b50505050610d32836001600160a01b031660001b6119c7565b6000808360601b90506040517f363d3d373d3d3d363d7300000000000000000000000000000000000000000000815281600a8201527f5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000601e82015260408101602d600082873c600d810151600d83015114815183511416935050505092915050565b6000828152602081905260409020548290156115245760405162461bcd60e51b815260206004820152601b60248201527f5769746854696d6572733a206f6e6c794265666f726554696d6572000000000060448201526064016104d4565b60006115308342611cbe565b60008581526020818152604091829020839055905182815291925085917f605574b2967b0bcc75b287d9a63f28d379642ae66f3e2ed42e1679cd992915f5910160405180910390a250505050565b600081815260208190526040812054801580159061159c5750428111155b9392505050565b600080846001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190611b2c565b604051627ebcdb60e21b81526001600160a01b0387811660048301527f3cec7c13345ae32e688f81840d184c63978bb776762e026e7e61d891bb2dd84b60248301529192506000918316906301faf36c9060440160206040518083038186803b15801561168357600080fd5b505afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb9190611c53565b90506001600160a01b0381161561186b5760006116e1826001600160a01b038916611a59565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152602482018890529192509088169063095ea7b390604401602060405180830381600087803b15801561174857600080fd5b505af115801561175c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117809190611b48565b506001600160a01b038781166000818152600160209081526040808320546002909252918290205491517fe37259e9000000000000000000000000000000000000000000000000000000008152600481018a905260248101939093528316604483015260648201529082169063e37259e99088906084016000604051808303818588803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b50506040516001600160a01b0380861694508b1692507fa7b435b2c8fd44462584564800dad818928fb919addaa633e861153cb83f8f339150600090a3925061159c915050565b50600095945050505050565b804710156118c75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016104d4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611914576040519150601f19603f3d011682016040523d82523d6000602084013e611919565b606091505b5050905080610d325760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016104d4565b600081815260208190526040812054801580159061159c5750421092915050565b60008183106119c0578161159c565b5090919050565b806119d18161157e565b611a1d5760405162461bcd60e51b815260206004820152601a60248201527f5769746854696d6572733a206f6e6c79416674657254696d657200000000000060448201526064016104d4565b6000828152602081905260408082208290555183917f20d65b5dc0ebfa40301979533e073e22a1d96c44638276e67a662e5da7215fba91a25050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528360601b60148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f59150506001600160a01b038116610d515760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016104d4565b600060208284031215611b21578081fd5b813561159c81611d5d565b600060208284031215611b3d578081fd5b815161159c81611d5d565b600060208284031215611b59578081fd5b8151801515811461159c578182fd5b60008060408385031215611b7a578081fd5b8235611b8581611d5d565b91506020830135611b9581611d5d565b809150509250929050565b600080600080600080600060c0888a031215611bba578283fd5b8735611bc581611d5d565b96506020880135611bd581611d5d565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff80821115611c06578384fd5b818a0191508a601f830112611c19578384fd5b813581811115611c27578485fd5b8b60208260061b8501011115611c3b578485fd5b60208301945080935050505092959891949750929550565b600060208284031215611c64578081fd5b5051919050565b6000602080835283518082850152825b81811015611c9757858101830151858201604001528201611c7b565b81811115611ca85783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115611cd157611cd1611d47565b500190565b600082611cf157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d1057611d10611d47565b500290565b600082821015611d2757611d27611d47565b500390565b6000600019821415611d4057611d40611d47565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611d7257600080fd5b5056fea2646970667358221220d2044491c07fbd094bcee6d8251fca9b2bf8890a95141f24919fc8bfedb4670c64736f6c63430008030033000000000000000000000000176e2d1a1471b2307f03b38804e24b5a48666c44
Deployed Bytecode
0x60806040526004361061010e5760003560e01c80635997b63e116100a5578063cfed246b11610074578063e3d670d711610059578063e3d670d7146103bb578063eb820312146103e8578063fbacefce1461041e5761010e565b8063cfed246b14610366578063d664255a146103935761010e565b80635997b63e146102b3578063ad7fadc5146102ff578063bba06f2714610312578063cf7b446b146103325761010e565b80633da1ff82116100e15780633da1ff8214610219578063411bc7e71461025157806351cff8d9146102735780635403b394146102935761010e565b806306fdde03146101135780632ed604e7146101725780633283b803146101ad57806333637a87146101e1575b600080fd5b34801561011f57600080fd5b5061015c6040518060400160405260148152806020017f4669786564507269636553616c654d6f64756c6500000000000000000000000081525081565b6040516101699190611c6b565b60405180910390f35b34801561017e57600080fd5b5061019f61018d366004611b10565b60046020526000908152604090205481565b604051908152602001610169565b3480156101b957600080fd5b5061019f7fd6b8be26fe56c2461902fe9d3f529cdf9f02521932f09d2107fe448477d59e9f81565b3480156101ed57600080fd5b5061019f6101fc366004611b68565b600660209081526000928352604080842090915290825290205481565b34801561022557600080fd5b5061019f610234366004611b68565b600560209081526000928352604080842090915290825290205481565b34801561025d57600080fd5b5061027161026c366004611ba0565b61043e565b005b34801561027f57600080fd5b5061027161028e366004611b10565b61090f565b34801561029f57600080fd5b5061019f6102ae366004611b10565b610d37565b3480156102bf57600080fd5b506102e77f000000000000000000000000176e2d1a1471b2307f03b38804e24b5a48666c4481565b6040516001600160a01b039091168152602001610169565b61027161030d366004611b68565b610d57565b34801561031e57600080fd5b5061027161032d366004611b68565b610faa565b34801561033e57600080fd5b5061019f7f3cec7c13345ae32e688f81840d184c63978bb776762e026e7e61d891bb2dd84b81565b34801561037257600080fd5b5061019f610381366004611b10565b60026020526000908152604090205481565b34801561039f57600080fd5b506102e7733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c981565b3480156103c757600080fd5b5061019f6103d6366004611b10565b60036020526000908152604090205481565b3480156103f457600080fd5b506102e7610403366004611b10565b6001602052600090815260409020546001600160a01b031681565b34801561042a57600080fd5b50610271610439366004611b10565b611241565b866104697f000000000000000000000000176e2d1a1471b2307f03b38804e24b5a48666c4482611444565b61047257600080fd5b6001600160a01b038816600081815260208190526040902054156104dd5760405162461bcd60e51b815260206004820152601b60248201527f5769746854696d6572733a206f6e6c794265666f726554696d6572000000000060448201526064015b60405180910390fd5b8833806001600160a01b0316826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561052257600080fd5b505afa158015610536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055a9190611b2c565b6001600160a01b03161461056d57600080fd5b8a6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a657600080fd5b505afa1580156105ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105de9190611c53565b156105e857600080fd5b6040517f4e26463f000000000000000000000000000000000000000000000000000000008152306004820152602481018890526001600160a01b038c1690634e26463f90604401600060405180830381600087803b15801561064957600080fd5b505af115801561065d573d6000803e3d6000fd5b50506040517f36afba800000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038e1692506336afba809150602401600060405180830381600087803b1580156106bb57600080fd5b505af11580156106cf573d6000803e3d6000fd5b505050506106e98b6001600160a01b031660001b896114c6565b60005b858110156108a25786868281811061071457634e487b7160e01b600052603260045260246000fd5b90506040020160200135600560008e6001600160a01b03166001600160a01b03168152602001908152602001600020600089898581811061076557634e487b7160e01b600052603260045260246000fd5b61077b9260206040909202019081019150611b10565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546107aa9190611cbe565b9091555087905086828181106107d057634e487b7160e01b600052603260045260246000fd5b90506040020160200135886107e59190611d15565b975086868281811061080757634e487b7160e01b600052603260045260246000fd5b61081d9260206040909202019081019150611b10565b6001600160a01b03168c6001600160a01b03167f69807b61b47d45b65ae1234a541f04883c49ca35f4b705dd7098e9da0eb940f889898581811061087157634e487b7160e01b600052603260045260246000fd5b9050604002016020013560405161088a91815260200190565b60405180910390a361089b81611d2c565b90506106ec565b505050506001600160a01b03978816600090815260016020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169a909b169990991790995560028952878120969096555050600490955292909120919091555050565b806109226001600160a01b03821661157e565b8061094357506001600160a01b038116600090815260046020526040902054155b61094c57600080fd5b6001600160a01b03808316600090815260016020908152604080832054600490925290912054911690610c7b576001600160a01b0383166000818152600560209081526040808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c9845282528083205481517f5aa6e67500000000000000000000000000000000000000000000000000000000815291519094670de0b6b3a7640000939092635aa6e6759260048083019392829003018186803b158015610a0757600080fd5b505afa158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3f9190611b2c565b604051627ebcdb60e21b81526001600160a01b0388811660048301527fd6b8be26fe56c2461902fe9d3f529cdf9f02521932f09d2107fe448477d59e9f602483015291909116906301faf36c9060440160206040518083038186803b158015610aa757600080fd5b505afa158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adf9190611c53565b6001600160a01b038716600090815260036020526040902054610b029190611cf6565b610b0c9190611cd6565b6001600160a01b03861660009081526003602052604081205491925090610b34908390611d15565b90506000610b438784866115a3565b6001600160a01b03808916600090815260036020908152604080832083905560058252808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c984529091528120559091508116610c1f5760405163a9059cbb60e01b81526001600160a01b0386811660048301526024820186905288169063a9059cbb90604401602060405180830381600087803b158015610bd957600080fd5b505af1158015610bed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c119190611b48565b50610c1c8383611cbe565b91505b610c298583611877565b604080516001600160a01b038781168252602082018590523392908a16917f3115d1449a7b732c986cba18244e897a450f61e1bb8d589cd2e69e6c8924f9f7910160405180910390a350505050610d32565b6040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015284169063f2fde38b90602401600060405180830381600087803b158015610cd757600080fd5b505af1158015610ceb573d6000803e3d6000fd5b50506040516001600160a01b038481168252339350861691507f88ad5720ab58f3f3c19f34229d334358c71e227e2dcd92144999e9657b62bfe49060200160405180910390a35b505050565b6001600160a01b0381166000908152602081905260408120545b92915050565b81610d6a6001600160a01b038216611990565b8015610d8d57506001600160a01b03811660009081526004602052604090205415155b610d9657600080fd5b6001600160a01b038216733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c91415610dc057600080fd5b6001600160a01b03831660009081526002602052604081205490610e1882610df034670de0b6b3a7640000611cf6565b610dfa9190611cd6565b6001600160a01b0387166000908152600460205260409020546119b1565b90506000670de0b6b3a7640000610e2f8484611cf6565b610e399190611cd6565b6001600160a01b038716600090815260036020526040812080549293508392909190610e66908490611cbe565b90915550506001600160a01b03808716600090815260066020908152604080832093891683529290529081208054849290610ea2908490611cbe565b90915550506001600160a01b03861660009081526004602052604081208054849290610ecf908490611d15565b90915550506001600160a01b038616600090815260046020526040902054610f4557856001600160a01b031663715018a66040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f2c57600080fd5b505af1158015610f40573d6000803e3d6000fd5b505050505b610f5833610f538334611d15565b611877565b604080516001600160a01b038781168252602082018590523392908916917f238e3bccfa0594503e6ecfa4f8595fd564903445338b3e088888ad8d0504907691015b60405180910390a3505050505050565b81610fbd6001600160a01b03821661157e565b80610fde57506001600160a01b038116600090815260046020526040902054155b610fe757600080fd5b6001600160a01b038216733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c9141561101157600080fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825280832080548585526006845282852096855295835281842080549185905584905593835260049091529020546111485760006110728284611cbe565b60405163a9059cbb60e01b81526001600160a01b038781166004830152602482018390529192509087169063a9059cbb90604401602060405180830381600087803b1580156110c057600080fd5b505af11580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f89190611b48565b50604080516001600160a01b038781168252602082018490523392908916917f601889ddcf03fa641ecfeab68a8c8bef0c5a935bb5725275fbb8b4c978d4eb97910160405180910390a35061123a565b6001600160a01b038516600090815260026020526040812054670de0b6b3a7640000906111759084611cf6565b61117f9190611cd6565b6001600160a01b0387166000908152600360205260408120805492935083929091906111ac908490611d15565b909155506111bc90508284611cbe565b6001600160a01b038716600090815260046020526040812080549091906111e4908490611cbe565b909155506111f490508582611877565b604080516001600160a01b038781168252602082018590523392908916917f8b65b4d395c9d0c8e226601c55009f48dfe26d1805928bb98b5f66d75562bde19101610f9a565b5050505050565b806112546001600160a01b03821661157e565b8061127557506001600160a01b038116600090815260046020526040902054155b61127e57600080fd5b6000826001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b957600080fd5b505afa1580156112cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f19190611c53565b6001600160a01b0384166000818152600560209081526040808320733cc5b802b34a42db4cbe41ae3ad5c06e1a4481c98452825280832054938352600490915290205491925082916113439190611cbe565b146113b65760405162461bcd60e51b815260206004820152603560248201527f43726f776473616c652064697274792c206e6f7420616c6c20616c6c6f63617460448201527f696f6e2068617665206265656e20636c61696d6564000000000000000000000060648201526084016104d4565b6040517f91b98e0e000000000000000000000000000000000000000000000000000000008152306004820152602481018290526001600160a01b038416906391b98e0e90604401600060405180830381600087803b15801561141757600080fd5b505af115801561142b573d6000803e3d6000fd5b50505050610d32836001600160a01b031660001b6119c7565b6000808360601b90506040517f363d3d373d3d3d363d7300000000000000000000000000000000000000000000815281600a8201527f5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000601e82015260408101602d600082873c600d810151600d83015114815183511416935050505092915050565b6000828152602081905260409020548290156115245760405162461bcd60e51b815260206004820152601b60248201527f5769746854696d6572733a206f6e6c794265666f726554696d6572000000000060448201526064016104d4565b60006115308342611cbe565b60008581526020818152604091829020839055905182815291925085917f605574b2967b0bcc75b287d9a63f28d379642ae66f3e2ed42e1679cd992915f5910160405180910390a250505050565b600081815260208190526040812054801580159061159c5750428111155b9392505050565b600080846001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190611b2c565b604051627ebcdb60e21b81526001600160a01b0387811660048301527f3cec7c13345ae32e688f81840d184c63978bb776762e026e7e61d891bb2dd84b60248301529192506000918316906301faf36c9060440160206040518083038186803b15801561168357600080fd5b505afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb9190611c53565b90506001600160a01b0381161561186b5760006116e1826001600160a01b038916611a59565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152602482018890529192509088169063095ea7b390604401602060405180830381600087803b15801561174857600080fd5b505af115801561175c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117809190611b48565b506001600160a01b038781166000818152600160209081526040808320546002909252918290205491517fe37259e9000000000000000000000000000000000000000000000000000000008152600481018a905260248101939093528316604483015260648201529082169063e37259e99088906084016000604051808303818588803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b50506040516001600160a01b0380861694508b1692507fa7b435b2c8fd44462584564800dad818928fb919addaa633e861153cb83f8f339150600090a3925061159c915050565b50600095945050505050565b804710156118c75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016104d4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611914576040519150601f19603f3d011682016040523d82523d6000602084013e611919565b606091505b5050905080610d325760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016104d4565b600081815260208190526040812054801580159061159c5750421092915050565b60008183106119c0578161159c565b5090919050565b806119d18161157e565b611a1d5760405162461bcd60e51b815260206004820152601a60248201527f5769746854696d6572733a206f6e6c79416674657254696d657200000000000060448201526064016104d4565b6000828152602081905260408082208290555183917f20d65b5dc0ebfa40301979533e073e22a1d96c44638276e67a662e5da7215fba91a25050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528360601b60148201527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006028820152826037826000f59150506001600160a01b038116610d515760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c656400000000000000000060448201526064016104d4565b600060208284031215611b21578081fd5b813561159c81611d5d565b600060208284031215611b3d578081fd5b815161159c81611d5d565b600060208284031215611b59578081fd5b8151801515811461159c578182fd5b60008060408385031215611b7a578081fd5b8235611b8581611d5d565b91506020830135611b9581611d5d565b809150509250929050565b600080600080600080600060c0888a031215611bba578283fd5b8735611bc581611d5d565b96506020880135611bd581611d5d565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff80821115611c06578384fd5b818a0191508a601f830112611c19578384fd5b813581811115611c27578485fd5b8b60208260061b8501011115611c3b578485fd5b60208301945080935050505092959891949750929550565b600060208284031215611c64578081fd5b5051919050565b6000602080835283518082850152825b81811015611c9757858101830151858201604001528201611c7b565b81811115611ca85783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115611cd157611cd1611d47565b500190565b600082611cf157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d1057611d10611d47565b500290565b600082821015611d2757611d27611d47565b500390565b6000600019821415611d4057611d40611d47565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611d7257600080fd5b5056fea2646970667358221220d2044491c07fbd094bcee6d8251fca9b2bf8890a95141f24919fc8bfedb4670c64736f6c63430008030033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000176e2d1a1471b2307f03b38804e24b5a48666c44
-----Decoded View---------------
Arg [0] : walletTemplate (address): 0x176E2d1a1471b2307F03b38804e24B5a48666c44
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000176e2d1a1471b2307f03b38804e24b5a48666c44
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.