More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 13,143 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 20465803 | 38 days ago | IN | 0 ETH | 0.00044788 | ||||
Withdraw | 20250373 | 68 days ago | IN | 0 ETH | 0.00042368 | ||||
Withdraw | 19906053 | 116 days ago | IN | 0 ETH | 0.00099504 | ||||
Withdraw | 19899108 | 117 days ago | IN | 0 ETH | 0.00087551 | ||||
Withdraw | 19882158 | 120 days ago | IN | 0 ETH | 0.00150878 | ||||
Withdraw | 19632778 | 154 days ago | IN | 0 ETH | 0.0074345 | ||||
Withdraw | 19582284 | 161 days ago | IN | 0 ETH | 0.00551244 | ||||
Withdraw | 19508090 | 172 days ago | IN | 0 ETH | 0.00307157 | ||||
Withdraw | 19508080 | 172 days ago | IN | 0 ETH | 0.00406025 | ||||
Withdraw | 19499873 | 173 days ago | IN | 0 ETH | 0.00075282 | ||||
Withdraw | 19499761 | 173 days ago | IN | 0 ETH | 0.00093889 | ||||
Withdraw | 19499703 | 173 days ago | IN | 0 ETH | 0.00065928 | ||||
Withdraw | 19499688 | 173 days ago | IN | 0 ETH | 0.00077584 | ||||
Withdraw | 19487104 | 175 days ago | IN | 0 ETH | 0.00557163 | ||||
Withdraw | 19431055 | 183 days ago | IN | 0 ETH | 0.01151482 | ||||
Withdraw | 19424498 | 184 days ago | IN | 0 ETH | 0.00169718 | ||||
Withdraw | 19424498 | 184 days ago | IN | 0 ETH | 0.00169718 | ||||
Withdraw | 19424498 | 184 days ago | IN | 0 ETH | 0.00169718 | ||||
Withdraw | 19424467 | 184 days ago | IN | 0 ETH | 0.00996668 | ||||
Withdraw | 19406422 | 186 days ago | IN | 0 ETH | 0.01408267 | ||||
Withdraw | 19340283 | 195 days ago | IN | 0 ETH | 0.01160931 | ||||
Withdraw | 19336556 | 196 days ago | IN | 0 ETH | 0.01389025 | ||||
Withdraw | 19305854 | 200 days ago | IN | 0 ETH | 0.00918571 | ||||
Withdraw | 19305045 | 200 days ago | IN | 0 ETH | 0.00115516 | ||||
Withdraw | 19304867 | 200 days ago | IN | 0 ETH | 0.00091254 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Barn
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./interfaces/IDiamondCut.sol"; import "./interfaces/IDiamondLoupe.sol"; import "./libraries/LibDiamond.sol"; import "./libraries/LibOwnership.sol"; import "./libraries/LibDiamondStorage.sol"; import "./interfaces/IERC165.sol"; import "./interfaces/IERC173.sol"; contract Barn { constructor(IDiamondCut.FacetCut[] memory _diamondCut, address _owner) payable { require(_owner != address(0), "owner must not be 0x0"); LibDiamond.diamondCut(_diamondCut, address(0), new bytes(0)); LibOwnership.setContractOwner(_owner); LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); // adding ERC165 data ds.supportedInterfaces[type(IERC165).interfaceId] = true; ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true; ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true; ds.supportedInterfaces[type(IERC173).interfaceId] = true; } // Find facet for function that is called and execute the // function if a facet is found and return any value. fallback() external payable { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); address facet = address(bytes20(ds.facets[msg.sig].facetAddress)); require(facet != address(0), "Diamond: Function does not exist"); assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return (0, returndatasize()) } } } receive() external payable {} }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IDiamondCut { enum FacetCutAction {Add, Replace, Remove} // Add=0, Replace=1, Remove=2 struct FacetCut { address facetAddress; FacetCutAction action; bytes4[] functionSelectors; } /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; // A loupe is a small magnifying glass used to look at diamonds. // These functions look at diamonds interface IDiamondLoupe { /// These functions are expected to be called frequently /// by tools. struct Facet { address facetAddress; bytes4[] functionSelectors; } /// @notice Gets all facet addresses and their four byte function selectors. /// @return facets_ Facet function facets() external view returns (Facet[] memory facets_); /// @notice Gets all the function selectors supported by a specific facet. /// @param _facet The facet address. /// @return facetFunctionSelectors_ function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_); /// @notice Get all the facet addresses used by a diamond. /// @return facetAddresses_ function facetAddresses() external view returns (address[] memory facetAddresses_); /// @notice Gets the facet that supports the given selector. /// @dev If facet is not found return address(0). /// @param _functionSelector The function selector. /// @return facetAddress_ The facet address. function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IDiamondCut.sol"; import "./LibDiamondStorage.sol"; library LibDiamond { event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); // Internal function version of diamondCut // This code is almost the same as the external diamondCut, // except it is using 'Facet[] memory _diamondCut' instead of // 'Facet[] calldata _diamondCut'. // The code is duplicated to prevent copying calldata to memory which // causes an error for a two dimensional array. function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata ) internal { uint256 selectorCount = LibDiamondStorage.diamondStorage().selectors.length; for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { selectorCount = executeDiamondCut(selectorCount, _diamondCut[facetIndex]); } emit DiamondCut(_diamondCut, _init, _calldata); initializeDiamondCut(_init, _calldata); } // executeDiamondCut takes one single FacetCut action and executes it // if FacetCutAction can't be identified, it reverts function executeDiamondCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) { require(cut.functionSelectors.length > 0, "LibDiamond: No selectors in facet to cut"); if (cut.action == IDiamondCut.FacetCutAction.Add) { require(cut.facetAddress != address(0), "LibDiamond: add facet address can't be address(0)"); enforceHasContractCode(cut.facetAddress, "LibDiamond: add facet must have code"); return _handleAddCut(selectorCount, cut); } if (cut.action == IDiamondCut.FacetCutAction.Replace) { require(cut.facetAddress != address(0), "LibDiamond: remove facet address can't be address(0)"); enforceHasContractCode(cut.facetAddress, "LibDiamond: remove facet must have code"); return _handleReplaceCut(selectorCount, cut); } if (cut.action == IDiamondCut.FacetCutAction.Remove) { require(cut.facetAddress == address(0), "LibDiamond: remove facet address must be address(0)"); return _handleRemoveCut(selectorCount, cut); } revert("LibDiamondCut: Incorrect FacetCutAction"); } // _handleAddCut executes a cut with the type Add // it reverts if the selector already exists function _handleAddCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); for (uint256 selectorIndex; selectorIndex < cut.functionSelectors.length; selectorIndex++) { bytes4 selector = cut.functionSelectors[selectorIndex]; address oldFacetAddress = ds.facets[selector].facetAddress; require(oldFacetAddress == address(0), "LibDiamondCut: Can't add function that already exists"); ds.facets[selector] = LibDiamondStorage.Facet( cut.facetAddress, uint16(selectorCount) ); ds.selectors.push(selector); selectorCount++; } return selectorCount; } // _handleReplaceCut executes a cut with the type Replace // it does not allow replacing immutable functions // it does not allow replacing with the same function // it does not allow replacing a function that does not exist function _handleReplaceCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); for (uint256 selectorIndex; selectorIndex < cut.functionSelectors.length; selectorIndex++) { bytes4 selector = cut.functionSelectors[selectorIndex]; address oldFacetAddress = ds.facets[selector].facetAddress; // only useful if immutable functions exist require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function"); require(oldFacetAddress != cut.facetAddress, "LibDiamondCut: Can't replace function with same function"); require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist"); // replace old facet address ds.facets[selector].facetAddress = cut.facetAddress; } return selectorCount; } // _handleRemoveCut executes a cut with the type Remove // for efficiency, the selector to be deleted is replaced with the last one and then the last one is popped // it reverts if the function doesn't exist or it's immutable function _handleRemoveCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); for (uint256 selectorIndex; selectorIndex < cut.functionSelectors.length; selectorIndex++) { bytes4 selector = cut.functionSelectors[selectorIndex]; LibDiamondStorage.Facet memory oldFacet = ds.facets[selector]; require(oldFacet.facetAddress != address(0), "LibDiamondCut: Can't remove function that doesn't exist"); require(oldFacet.facetAddress != address(this), "LibDiamondCut: Can't remove immutable function."); // replace selector with last selector if (oldFacet.selectorPosition != selectorCount - 1) { bytes4 lastSelector = ds.selectors[selectorCount - 1]; ds.selectors[oldFacet.selectorPosition] = lastSelector; ds.facets[lastSelector].selectorPosition = oldFacet.selectorPosition; } // delete last selector ds.selectors.pop(); delete ds.facets[selector]; selectorCount--; } return selectorCount; } function initializeDiamondCut(address _init, bytes memory _calldata) internal { if (_init == address(0)) { require(_calldata.length == 0, "LibDiamondCut: _init is address(0) but _calldata is not empty"); return; } require(_calldata.length > 0, "LibDiamondCut: _calldata is empty but _init is not address(0)"); if (_init != address(this)) { enforceHasContractCode(_init, "LibDiamondCut: _init address has no code"); } (bool success, bytes memory error) = _init.delegatecall(_calldata); if (!success) { if (error.length > 0) { // bubble up the error revert(string(error)); } else { revert("LibDiamondCut: _init function reverted"); } } } function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { uint256 contractSize; assembly { contractSize := extcodesize(_contract) } require(contractSize > 0, _errorMessage); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./LibDiamondStorage.sol"; library LibOwnership { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function setContractOwner(address _newOwner) internal { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); address previousOwner = ds.contractOwner; require(previousOwner != _newOwner, "Previous owner and new owner must be different"); ds.contractOwner = _newOwner; emit OwnershipTransferred(previousOwner, _newOwner); } function contractOwner() internal view returns (address contractOwner_) { contractOwner_ = LibDiamondStorage.diamondStorage().contractOwner; } function enforceIsContractOwner() view internal { require(msg.sender == LibDiamondStorage.diamondStorage().contractOwner, "Must be contract owner"); } modifier onlyOwner { require(msg.sender == LibDiamondStorage.diamondStorage().contractOwner, "Must be contract owner"); _; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; library LibDiamondStorage { bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); struct Facet { address facetAddress; uint16 selectorPosition; } struct DiamondStorage { // function selector => facet address and selector position in selectors array mapping(bytes4 => Facet) facets; bytes4[] selectors; // ERC165 mapping(bytes4 => bool) supportedInterfaces; // owner of the contract address contractOwner; } function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IERC165 { /// @notice Query if a contract implements an interface /// @param interfaceId The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less than 30,000 gas. /// @return `true` if the contract implements `interfaceID` and /// `interfaceID` is not 0xffffffff, `false` otherwise function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; /// @title ERC-173 Contract Ownership Standard /// Note: the ERC-165 identifier for this interface is 0x7f5828d0 /* is ERC165 */ interface IERC173 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Get the address of the owner /// @return owner_ The address of the owner. function owner() external view returns (address owner_); /// @notice Set the address of the new owner of the contract /// @dev Set _newOwner to address(0) to renounce any ownership. /// @param _newOwner The address of the new owner of the contract function transferOwnership(address _newOwner) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; import "../libraries/LibOwnership.sol"; import "../interfaces/IERC173.sol"; contract OwnershipFacet is IERC173 { function transferOwnership(address _newOwner) external override { LibOwnership.enforceIsContractOwner(); LibOwnership.setContractOwner(_newOwner); } function owner() external override view returns (address owner_) { owner_ = LibOwnership.contractOwner(); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IDiamondCut.sol"; import "../libraries/LibDiamond.sol"; import "../libraries/LibOwnership.sol"; contract DiamondCutFacet is IDiamondCut { /// @notice Add/replace/remove any number of functions and optionally execute /// a function with delegatecall /// @param _diamondCut Contains the facet addresses and function selectors /// @param _init The address of the contract or facet to execute _calldata /// @param _calldata A function call, including function selector and arguments /// _calldata is executed with delegatecall on _init function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external override { LibOwnership.enforceIsContractOwner(); uint256 selectorCount = LibDiamondStorage.diamondStorage().selectors.length; for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { FacetCut memory cut; cut.action = _diamondCut[facetIndex].action; cut.facetAddress = _diamondCut[facetIndex].facetAddress; cut.functionSelectors = _diamondCut[facetIndex].functionSelectors; selectorCount = LibDiamond.executeDiamondCut(selectorCount, cut); } emit DiamondCut(_diamondCut, _init, _calldata); LibDiamond.initializeDiamondCut(_init, _calldata); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../libraries/LibDiamondStorage.sol"; import "../interfaces/IDiamondLoupe.sol"; import "../interfaces/IERC165.sol"; contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { // Diamond Loupe Functions //////////////////////////////////////////////////////////////////// /// These functions are expected to be called frequently by tools. // // struct Facet { // address facetAddress; // bytes4[] functionSelectors; // } /// @notice Gets all facets and their selectors. /// @return facets_ Facet function facets() external override view returns (Facet[] memory facets_) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); uint256 selectorCount = ds.selectors.length; // create an array set to the maximum size possible facets_ = new Facet[](selectorCount); // create an array for counting the number of selectors for each facet uint8[] memory numFacetSelectors = new uint8[](selectorCount); // total number of facets uint256 numFacets; // loop through function selectors for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; address facetAddress_ = ds.facets[selector].facetAddress; bool continueLoop = false; // find the functionSelectors array for selector and add selector to it for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { if (facets_[facetIndex].facetAddress == facetAddress_) { facets_[facetIndex].functionSelectors[numFacetSelectors[facetIndex]] = selector; // probably will never have more than 256 functions from one facet contract require(numFacetSelectors[facetIndex] < 255); numFacetSelectors[facetIndex]++; continueLoop = true; break; } } // if functionSelectors array exists for selector then continue loop if (continueLoop) { continueLoop = false; continue; } // create a new functionSelectors array for selector facets_[numFacets].facetAddress = facetAddress_; facets_[numFacets].functionSelectors = new bytes4[](selectorCount); facets_[numFacets].functionSelectors[0] = selector; numFacetSelectors[numFacets] = 1; numFacets++; } for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { uint256 numSelectors = numFacetSelectors[facetIndex]; bytes4[] memory selectors = facets_[facetIndex].functionSelectors; // setting the number of selectors assembly { mstore(selectors, numSelectors) } } // setting the number of facets assembly { mstore(facets_, numFacets) } } /// @notice Gets all the function selectors supported by a specific facet. /// @param _facet The facet address. /// @return _facetFunctionSelectors The selectors associated with a facet address. function facetFunctionSelectors(address _facet) external override view returns (bytes4[] memory _facetFunctionSelectors) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); uint256 selectorCount = ds.selectors.length; uint256 numSelectors; _facetFunctionSelectors = new bytes4[](selectorCount); // loop through function selectors for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; address facetAddress_ = ds.facets[selector].facetAddress; if (_facet == facetAddress_) { _facetFunctionSelectors[numSelectors] = selector; numSelectors++; } } // Set the number of selectors in the array assembly { mstore(_facetFunctionSelectors, numSelectors) } } /// @notice Get all the facet addresses used by a diamond. /// @return facetAddresses_ function facetAddresses() external override view returns (address[] memory facetAddresses_) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); uint256 selectorCount = ds.selectors.length; // create an array set to the maximum size possible facetAddresses_ = new address[](selectorCount); uint256 numFacets; // loop through function selectors for (uint256 selectorIndex; selectorIndex < selectorCount; selectorIndex++) { bytes4 selector = ds.selectors[selectorIndex]; address facetAddress_ = ds.facets[selector].facetAddress; bool continueLoop = false; // see if we have collected the address already and break out of loop if we have for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { if (facetAddress_ == facetAddresses_[facetIndex]) { continueLoop = true; break; } } // continue loop if we already have the address if (continueLoop) { continueLoop = false; continue; } // include address facetAddresses_[numFacets] = facetAddress_; numFacets++; } // Set the number of facet addresses in the array assembly { mstore(facetAddresses_, numFacets) } } /// @notice Gets the facet address that supports the given selector. /// @dev If facet is not found return address(0). /// @param _functionSelector The function selector. /// @return facetAddress_ The facet address. function facetAddress(bytes4 _functionSelector) external override view returns (address facetAddress_) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); facetAddress_ = ds.facets[_functionSelector].facetAddress; } // This implements ERC-165. function supportsInterface(bytes4 _interfaceId) external override view returns (bool) { LibDiamondStorage.DiamondStorage storage ds = LibDiamondStorage.diamondStorage(); return ds.supportedInterfaces[_interfaceId]; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../libraries/LibBarnStorage.sol"; import "../libraries/LibOwnership.sol"; contract ChangeRewardsFacet { function changeRewardsAddress(address _rewards) public { LibOwnership.enforceIsContractOwner(); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); ds.rewards = IRewards(_rewards); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IRewards.sol"; library LibBarnStorage { bytes32 constant STORAGE_POSITION = keccak256("com.barnbridge.barn.storage"); struct Checkpoint { uint256 timestamp; uint256 amount; } struct Stake { uint256 timestamp; uint256 amount; uint256 expiryTimestamp; address delegatedTo; } struct Storage { bool initialized; // mapping of user address to history of Stake objects // every user action creates a new object in the history mapping(address => Stake[]) userStakeHistory; // array of bond staked Checkpoint // deposits/withdrawals create a new object in the history (max one per block) Checkpoint[] bondStakedHistory; // mapping of user address to history of delegated power // every delegate/stopDelegate call create a new checkpoint (max one per block) mapping(address => Checkpoint[]) delegatedPowerHistory; IERC20 bond; IRewards rewards; } function barnStorage() internal pure returns (Storage storage ds) { bytes32 position = STORAGE_POSITION; assembly { ds.slot := position } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IRewards { function registerUserAction(address user) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; import "../interfaces/IRewards.sol"; contract BarnMock { IRewards public r; uint256 public bondStaked; mapping(address => uint256) private balances; function setRewards(address rewards) public { r = IRewards(rewards); } function callRegisterUserAction(address user) public { return r.registerUserAction(user); } function deposit(address user, uint256 amount) public { callRegisterUserAction(user); balances[user] = balances[user] + amount; bondStaked = bondStaked + amount; } function withdraw(address user, uint256 amount) public { require(balances[user] >= amount, "insufficient balance"); callRegisterUserAction(user); balances[user] = balances[user] - amount; bondStaked = bondStaked - amount; } function balanceOf(address user) public view returns (uint256) { return balances[user]; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IBarn.sol"; contract Rewards is Ownable { using SafeMath for uint256; uint256 constant decimals = 10 ** 18; struct Pull { address source; uint256 startTs; uint256 endTs; uint256 totalDuration; uint256 totalAmount; } Pull public pullFeature; bool public disabled; uint256 public lastPullTs; uint256 public balanceBefore; uint256 public currentMultiplier; mapping(address => uint256) public userMultiplier; mapping(address => uint256) public owed; IBarn public barn; IERC20 public rewardToken; event Claim(address indexed user, uint256 amount); constructor(address _owner, address _token, address _barn) { require(_token != address(0), "reward token must not be 0x0"); require(_barn != address(0), "barn address must not be 0x0"); transferOwnership(_owner); rewardToken = IERC20(_token); barn = IBarn(_barn); } // registerUserAction is called by the Barn every time the user does a deposit or withdrawal in order to // account for the changes in reward that the user should get // it updates the amount owed to the user without transferring the funds function registerUserAction(address user) public { require(msg.sender == address(barn), 'only callable by barn'); _calculateOwed(user); } // claim calculates the currently owed reward and transfers the funds to the user function claim() public returns (uint256){ _calculateOwed(msg.sender); uint256 amount = owed[msg.sender]; require(amount > 0, "nothing to claim"); owed[msg.sender] = 0; rewardToken.transfer(msg.sender, amount); // acknowledge the amount that was transferred to the user ackFunds(); emit Claim(msg.sender, amount); return amount; } // ackFunds checks the difference between the last known balance of `token` and the current one // if it goes up, the multiplier is re-calculated // if it goes down, it only updates the known balance function ackFunds() public { uint256 balanceNow = rewardToken.balanceOf(address(this)); if (balanceNow == 0 || balanceNow <= balanceBefore) { balanceBefore = balanceNow; return; } uint256 totalStakedBond = barn.bondStaked(); // if there's no bond staked, it doesn't make sense to ackFunds because there's nobody to distribute them to // and the calculation would fail anyways due to division by 0 if (totalStakedBond == 0) { return; } uint256 diff = balanceNow.sub(balanceBefore); uint256 multiplier = currentMultiplier.add(diff.mul(decimals).div(totalStakedBond)); balanceBefore = balanceNow; currentMultiplier = multiplier; } // setupPullToken is used to setup the rewards system; only callable by contract owner // set source to address(0) to disable the functionality function setupPullToken(address source, uint256 startTs, uint256 endTs, uint256 amount) public { require(msg.sender == owner(), "!owner"); require(!disabled, "contract is disabled"); if (pullFeature.source != address(0)) { require(source == address(0), "contract is already set up, source must be 0x0"); disabled = true; } else { require(source != address(0), "contract is not setup, source must be != 0x0"); } if (source == address(0)) { require(startTs == 0, "disable contract: startTs must be 0"); require(endTs == 0, "disable contract: endTs must be 0"); require(amount == 0, "disable contract: amount must be 0"); } else { require(endTs > startTs, "setup contract: endTs must be greater than startTs"); require(amount > 0, "setup contract: amount must be greater than 0"); } pullFeature.source = source; pullFeature.startTs = startTs; pullFeature.endTs = endTs; pullFeature.totalDuration = endTs.sub(startTs); pullFeature.totalAmount = amount; if (lastPullTs < startTs) { lastPullTs = startTs; } } // setBarn sets the address of the BarnBridge Barn into the state variable function setBarn(address _barn) public { require(_barn != address(0), 'barn address must not be 0x0'); require(msg.sender == owner(), '!owner'); barn = IBarn(_barn); } // _pullToken calculates the amount based on the time passed since the last pull relative // to the total amount of time that the pull functionality is active and executes a transferFrom from the // address supplied as `pullTokenFrom`, if enabled function _pullToken() internal { if ( pullFeature.source == address(0) || block.timestamp < pullFeature.startTs ) { return; } uint256 timestampCap = pullFeature.endTs; if (block.timestamp < pullFeature.endTs) { timestampCap = block.timestamp; } if (lastPullTs >= timestampCap) { return; } uint256 timeSinceLastPull = timestampCap.sub(lastPullTs); uint256 shareToPull = timeSinceLastPull.mul(decimals).div(pullFeature.totalDuration); uint256 amountToPull = pullFeature.totalAmount.mul(shareToPull).div(decimals); lastPullTs = block.timestamp; rewardToken.transferFrom(pullFeature.source, address(this), amountToPull); } // _calculateOwed calculates and updates the total amount that is owed to an user and updates the user's multiplier // to the current value // it automatically attempts to pull the token from the source and acknowledge the funds function _calculateOwed(address user) internal { _pullToken(); ackFunds(); uint256 reward = _userPendingReward(user); owed[user] = owed[user].add(reward); userMultiplier[user] = currentMultiplier; } // _userPendingReward calculates the reward that should be based on the current multiplier / anything that's not included in the `owed[user]` value // it does not represent the entire reward that's due to the user unless added on top of `owed[user]` function _userPendingReward(address user) internal view returns (uint256) { uint256 multiplier = currentMultiplier.sub(userMultiplier[user]); return barn.balanceOf(user).mul(multiplier).div(decimals); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @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 { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../libraries/LibBarnStorage.sol"; interface IBarn { // deposit allows a user to add more bond to his staked balance function deposit(uint256 amount) external; // withdraw allows a user to withdraw funds if the balance is not locked function withdraw(uint256 amount) external; // lock a user's currently staked balance until timestamp & add the bonus to his voting power function lock(uint256 timestamp) external; // delegate allows a user to delegate his voting power to another user function delegate(address to) external; // stopDelegate allows a user to take back the delegated voting power function stopDelegate() external; // lock the balance of a proposal creator until the voting ends; only callable by DAO function lockCreatorBalance(address user, uint256 timestamp) external; // balanceOf returns the current BOND balance of a user (bonus not included) function balanceOf(address user) external view returns (uint256); // balanceAtTs returns the amount of BOND that the user currently staked (bonus NOT included) function balanceAtTs(address user, uint256 timestamp) external view returns (uint256); // stakeAtTs returns the Stake object of the user that was valid at `timestamp` function stakeAtTs(address user, uint256 timestamp) external view returns (LibBarnStorage.Stake memory); // votingPower returns the voting power (bonus included) + delegated voting power for a user at the current block function votingPower(address user) external view returns (uint256); // votingPowerAtTs returns the voting power (bonus included) + delegated voting power for a user at a point in time function votingPowerAtTs(address user, uint256 timestamp) external view returns (uint256); // bondStaked returns the total raw amount of BOND staked at the current block function bondStaked() external view returns (uint256); // bondStakedAtTs returns the total raw amount of BOND users have deposited into the contract // it does not include any bonus function bondStakedAtTs(uint256 timestamp) external view returns (uint256); // delegatedPower returns the total voting power that a user received from other users function delegatedPower(address user) external view returns (uint256); // delegatedPowerAtTs returns the total voting power that a user received from other users at a point in time function delegatedPowerAtTs(address user, uint256 timestamp) external view returns (uint256); // multiplierAtTs calculates the multiplier at a given timestamp based on the user's stake a the given timestamp // it includes the decay mechanism function multiplierAtTs(address user, uint256 timestamp) external view returns (uint256); // userLockedUntil returns the timestamp until the user's balance is locked function userLockedUntil(address user) external view returns (uint256); // userDidDelegate returns the address to which a user delegated their voting power; address(0) if not delegated function userDelegatedTo(address user) external view returns (address); // bondCirculatingSupply returns the current circulating supply of BOND function bondCirculatingSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; import "../interfaces/IBarn.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract MulticallMock { using SafeMath for uint256; IBarn barn; IERC20 bond; constructor(address _barn, address _bond) { barn = IBarn(_barn); bond = IERC20(_bond); } function multiDelegate(uint256 amount, address user1, address user2) public { bond.approve(address(barn), amount); barn.deposit(amount); barn.delegate(user1); barn.delegate(user2); barn.delegate(user1); } function multiDeposit(uint256 amount) public { bond.approve(address(barn), amount.mul(3)); barn.deposit(amount); barn.deposit(amount); barn.deposit(amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 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: Apache-2.0 pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract ERC20Mock is ERC20("ERC20Mock", "MCK") { bool public transferFromCalled = false; bool public transferCalled = false; address public transferRecipient = address(0); uint256 public transferAmount = 0; function mint(address user, uint256 amount) public { _mint(user, amount); } function burnFrom(address user, uint256 amount) public { _burn(user, amount); } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { transferFromCalled = true; return super.transferFrom(sender, recipient, amount); } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { transferCalled = true; transferRecipient = recipient; transferAmount = amount; return super.transfer(recipient, amount); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IBarn.sol"; import "../libraries/LibBarnStorage.sol"; import "../libraries/LibOwnership.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract BarnFacet { using SafeMath for uint256; uint256 constant public MAX_LOCK = 365 days; uint256 constant BASE_MULTIPLIER = 1e18; event Deposit(address indexed user, uint256 amount, uint256 newBalance); event Withdraw(address indexed user, uint256 amountWithdrew, uint256 amountLeft); event Lock(address indexed user, uint256 timestamp); event Delegate(address indexed from, address indexed to); event DelegatedPowerIncreased(address indexed from, address indexed to, uint256 amount, uint256 to_newDelegatedPower); event DelegatedPowerDecreased(address indexed from, address indexed to, uint256 amount, uint256 to_newDelegatedPower); function initBarn(address _bond, address _rewards) public { require(_bond != address(0), "BOND address must not be 0x0"); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); require(!ds.initialized, "Barn: already initialized"); LibOwnership.enforceIsContractOwner(); ds.initialized = true; ds.bond = IERC20(_bond); ds.rewards = IRewards(_rewards); } // deposit allows a user to add more bond to his staked balance function deposit(uint256 amount) public { require(amount > 0, "Amount must be greater than 0"); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); uint256 allowance = ds.bond.allowance(msg.sender, address(this)); require(allowance >= amount, "Token allowance too small"); // this must be called before the user's balance is updated so the rewards contract can calculate // the amount owed correctly if (address(ds.rewards) != address(0)) { ds.rewards.registerUserAction(msg.sender); } uint256 newBalance = balanceOf(msg.sender).add(amount); _updateUserBalance(ds.userStakeHistory[msg.sender], newBalance); _updateLockedBond(bondStakedAtTs(block.timestamp).add(amount)); address delegatedTo = userDelegatedTo(msg.sender); if (delegatedTo != address(0)) { uint256 newDelegatedPower = delegatedPower(delegatedTo).add(amount); _updateDelegatedPower(ds.delegatedPowerHistory[delegatedTo], newDelegatedPower); emit DelegatedPowerIncreased(msg.sender, delegatedTo, amount, newDelegatedPower); } ds.bond.transferFrom(msg.sender, address(this), amount); emit Deposit(msg.sender, amount, newBalance); } // withdraw allows a user to withdraw funds if the balance is not locked function withdraw(uint256 amount) public { require(amount > 0, "Amount must be greater than 0"); require(userLockedUntil(msg.sender) <= block.timestamp, "User balance is locked"); uint256 balance = balanceOf(msg.sender); require(balance >= amount, "Insufficient balance"); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); // this must be called before the user's balance is updated so the rewards contract can calculate // the amount owed correctly if (address(ds.rewards) != address(0)) { ds.rewards.registerUserAction(msg.sender); } _updateUserBalance(ds.userStakeHistory[msg.sender], balance.sub(amount)); _updateLockedBond(bondStakedAtTs(block.timestamp).sub(amount)); address delegatedTo = userDelegatedTo(msg.sender); if (delegatedTo != address(0)) { uint256 newDelegatedPower = delegatedPower(delegatedTo).sub(amount); _updateDelegatedPower(ds.delegatedPowerHistory[delegatedTo], newDelegatedPower); emit DelegatedPowerDecreased(msg.sender, delegatedTo, amount, newDelegatedPower); } ds.bond.transfer(msg.sender, amount); emit Withdraw(msg.sender, amount, balance.sub(amount)); } // lock a user's currently staked balance until timestamp & add the bonus to his voting power function lock(uint256 timestamp) public { require(timestamp > block.timestamp, "Timestamp must be in the future"); require(timestamp <= block.timestamp + MAX_LOCK, "Timestamp too big"); require(balanceOf(msg.sender) > 0, "Sender has no balance"); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); LibBarnStorage.Stake[] storage checkpoints = ds.userStakeHistory[msg.sender]; LibBarnStorage.Stake storage currentStake = checkpoints[checkpoints.length - 1]; require(timestamp > currentStake.expiryTimestamp, "New timestamp lower than current lock timestamp"); _updateUserLock(checkpoints, timestamp); emit Lock(msg.sender, timestamp); } function depositAndLock(uint256 amount, uint256 timestamp) public { deposit(amount); lock(timestamp); } // delegate allows a user to delegate his voting power to another user function delegate(address to) public { require(msg.sender != to, "Can't delegate to self"); uint256 senderBalance = balanceOf(msg.sender); require(senderBalance > 0, "No balance to delegate"); LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); emit Delegate(msg.sender, to); address delegatedTo = userDelegatedTo(msg.sender); if (delegatedTo != address(0)) { uint256 newDelegatedPower = delegatedPower(delegatedTo).sub(senderBalance); _updateDelegatedPower(ds.delegatedPowerHistory[delegatedTo], newDelegatedPower); emit DelegatedPowerDecreased(msg.sender, delegatedTo, senderBalance, newDelegatedPower); } if (to != address(0)) { uint256 newDelegatedPower = delegatedPower(to).add(senderBalance); _updateDelegatedPower(ds.delegatedPowerHistory[to], newDelegatedPower); emit DelegatedPowerIncreased(msg.sender, to, senderBalance, newDelegatedPower); } _updateUserDelegatedTo(ds.userStakeHistory[msg.sender], to); } // stopDelegate allows a user to take back the delegated voting power function stopDelegate() public { return delegate(address(0)); } // balanceOf returns the current BOND balance of a user (bonus not included) function balanceOf(address user) public view returns (uint256) { return balanceAtTs(user, block.timestamp); } // balanceAtTs returns the amount of BOND that the user currently staked (bonus NOT included) function balanceAtTs(address user, uint256 timestamp) public view returns (uint256) { LibBarnStorage.Stake memory stake = stakeAtTs(user, timestamp); return stake.amount; } // stakeAtTs returns the Stake object of the user that was valid at `timestamp` function stakeAtTs(address user, uint256 timestamp) public view returns (LibBarnStorage.Stake memory) { LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); LibBarnStorage.Stake[] storage stakeHistory = ds.userStakeHistory[user]; if (stakeHistory.length == 0 || timestamp < stakeHistory[0].timestamp) { return LibBarnStorage.Stake(block.timestamp, 0, block.timestamp, address(0)); } uint256 min = 0; uint256 max = stakeHistory.length - 1; if (timestamp >= stakeHistory[max].timestamp) { return stakeHistory[max]; } // binary search of the value in the array while (max > min) { uint256 mid = (max + min + 1) / 2; if (stakeHistory[mid].timestamp <= timestamp) { min = mid; } else { max = mid - 1; } } return stakeHistory[min]; } // votingPower returns the voting power (bonus included) + delegated voting power for a user at the current block function votingPower(address user) public view returns (uint256) { return votingPowerAtTs(user, block.timestamp); } // votingPowerAtTs returns the voting power (bonus included) + delegated voting power for a user at a point in time function votingPowerAtTs(address user, uint256 timestamp) public view returns (uint256) { LibBarnStorage.Stake memory stake = stakeAtTs(user, timestamp); uint256 ownVotingPower; // if the user delegated his voting power to another user, then he doesn't have any voting power left if (stake.delegatedTo != address(0)) { ownVotingPower = 0; } else { uint256 balance = stake.amount; uint256 multiplier = _stakeMultiplier(stake, timestamp); ownVotingPower = balance.mul(multiplier).div(BASE_MULTIPLIER); } uint256 delegatedVotingPower = delegatedPowerAtTs(user, timestamp); return ownVotingPower.add(delegatedVotingPower); } // bondStaked returns the total raw amount of BOND staked at the current block function bondStaked() public view returns (uint256) { return bondStakedAtTs(block.timestamp); } // bondStakedAtTs returns the total raw amount of BOND users have deposited into the contract // it does not include any bonus function bondStakedAtTs(uint256 timestamp) public view returns (uint256) { return _checkpointsBinarySearch(LibBarnStorage.barnStorage().bondStakedHistory, timestamp); } // delegatedPower returns the total voting power that a user received from other users function delegatedPower(address user) public view returns (uint256) { return delegatedPowerAtTs(user, block.timestamp); } // delegatedPowerAtTs returns the total voting power that a user received from other users at a point in time function delegatedPowerAtTs(address user, uint256 timestamp) public view returns (uint256) { return _checkpointsBinarySearch(LibBarnStorage.barnStorage().delegatedPowerHistory[user], timestamp); } // same as multiplierAtTs but for the current block timestamp function multiplierOf(address user) public view returns (uint256) { return multiplierAtTs(user, block.timestamp); } // multiplierAtTs calculates the multiplier at a given timestamp based on the user's stake a the given timestamp // it includes the decay mechanism function multiplierAtTs(address user, uint256 timestamp) public view returns (uint256) { LibBarnStorage.Stake memory stake = stakeAtTs(user, timestamp); return _stakeMultiplier(stake, timestamp); } // userLockedUntil returns the timestamp until the user's balance is locked function userLockedUntil(address user) public view returns (uint256) { LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp); return c.expiryTimestamp; } // userDelegatedTo returns the address to which a user delegated their voting power; address(0) if not delegated function userDelegatedTo(address user) public view returns (address) { LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp); return c.delegatedTo; } // _checkpointsBinarySearch executes a binary search on a list of checkpoints that's sorted chronologically // looking for the closest checkpoint that matches the specified timestamp function _checkpointsBinarySearch(LibBarnStorage.Checkpoint[] storage checkpoints, uint256 timestamp) internal view returns (uint256) { if (checkpoints.length == 0 || timestamp < checkpoints[0].timestamp) { return 0; } uint256 min = 0; uint256 max = checkpoints.length - 1; if (timestamp >= checkpoints[max].timestamp) { return checkpoints[max].amount; } // binary search of the value in the array while (max > min) { uint256 mid = (max + min + 1) / 2; if (checkpoints[mid].timestamp <= timestamp) { min = mid; } else { max = mid - 1; } } return checkpoints[min].amount; } // _stakeMultiplier calculates the multiplier for the given stake at the given timestamp function _stakeMultiplier(LibBarnStorage.Stake memory stake, uint256 timestamp) internal view returns (uint256) { if (timestamp >= stake.expiryTimestamp) { return BASE_MULTIPLIER; } uint256 diff = stake.expiryTimestamp - timestamp; if (diff >= MAX_LOCK) { return BASE_MULTIPLIER.mul(2); } return BASE_MULTIPLIER.add(diff.mul(BASE_MULTIPLIER).div(MAX_LOCK)); } // _updateUserBalance manages an array of checkpoints // if there's already a checkpoint for the same timestamp, the amount is updated // otherwise, a new checkpoint is inserted function _updateUserBalance(LibBarnStorage.Stake[] storage checkpoints, uint256 amount) internal { if (checkpoints.length == 0) { checkpoints.push(LibBarnStorage.Stake(block.timestamp, amount, block.timestamp, address(0))); } else { LibBarnStorage.Stake storage old = checkpoints[checkpoints.length - 1]; if (old.timestamp == block.timestamp) { old.amount = amount; } else { checkpoints.push(LibBarnStorage.Stake(block.timestamp, amount, old.expiryTimestamp, old.delegatedTo)); } } } // _updateUserLock updates the expiry timestamp on the user's stake // it assumes that if the user already has a balance, which is checked for in the lock function // then there must be at least 1 checkpoint function _updateUserLock(LibBarnStorage.Stake[] storage checkpoints, uint256 expiryTimestamp) internal { LibBarnStorage.Stake storage old = checkpoints[checkpoints.length - 1]; if (old.timestamp < block.timestamp) { checkpoints.push(LibBarnStorage.Stake(block.timestamp, old.amount, expiryTimestamp, old.delegatedTo)); } else { old.expiryTimestamp = expiryTimestamp; } } // _updateUserDelegatedTo updates the delegateTo property on the user's stake // it assumes that if the user already has a balance, which is checked for in the delegate function // then there must be at least 1 checkpoint function _updateUserDelegatedTo(LibBarnStorage.Stake[] storage checkpoints, address to) internal { LibBarnStorage.Stake storage old = checkpoints[checkpoints.length - 1]; if (old.timestamp < block.timestamp) { checkpoints.push(LibBarnStorage.Stake(block.timestamp, old.amount, old.expiryTimestamp, to)); } else { old.delegatedTo = to; } } // _updateDelegatedPower updates the power delegated TO the user in the checkpoints history function _updateDelegatedPower(LibBarnStorage.Checkpoint[] storage checkpoints, uint256 amount) internal { if (checkpoints.length == 0 || checkpoints[checkpoints.length - 1].timestamp < block.timestamp) { checkpoints.push(LibBarnStorage.Checkpoint(block.timestamp, amount)); } else { LibBarnStorage.Checkpoint storage old = checkpoints[checkpoints.length - 1]; old.amount = amount; } } // _updateLockedBond stores the new `amount` into the BOND locked history function _updateLockedBond(uint256 amount) internal { LibBarnStorage.Storage storage ds = LibBarnStorage.barnStorage(); if (ds.bondStakedHistory.length == 0 || ds.bondStakedHistory[ds.bondStakedHistory.length - 1].timestamp < block.timestamp) { ds.bondStakedHistory.push(LibBarnStorage.Checkpoint(block.timestamp, amount)); } else { LibBarnStorage.Checkpoint storage old = ds.bondStakedHistory[ds.bondStakedHistory.length - 1]; old.amount = amount; } } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum IDiamondCut.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct IDiamondCut.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"payable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040526040516200272438038062002724833981016040819052620000269162000ada565b6001600160a01b038116620000585760405162461bcd60e51b81526004016200004f90620011c2565b60405180910390fd5b60408051600080825260208201909252620000809184916200012360201b620000ce1760201c565b6200009681620001ce60201b6200015d1760201c565b6000620000ad6200027160201b620000aa1760201c565b6301ffc9a760e01b600090815260029091016020526040808220805460ff1990811660019081179092556307e4c70760e21b845282842080548216831790556348e2b09360e01b845282842080548216831790556307f5828d60e41b8452919092208054909116909117905550620012b6915050565b60006200013a6200027160201b620000aa1760201c565b60010154905060005b84518110156200017e5762000173828683815181106200015f57fe5b60200260200101516200029560201b60201c565b915060010162000143565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673848484604051620001b49392919062000c4c565b60405180910390a1620001c8838362000429565b50505050565b6000620001e56200027160201b620000aa1760201c565b60038101549091506001600160a01b039081169083168114156200021d5760405162461bcd60e51b81526004016200004f9062001174565b6003820180546001600160a01b0319166001600160a01b0385811691821790925560405190918316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60008082604001515111620002be5760405162461bcd60e51b81526004016200004f9062000f3c565b600082602001516002811115620002d157fe5b14156200033f5781516001600160a01b0316620003025760405162461bcd60e51b81526004016200004f9062000ea4565b6200032b8260000151604051806060016040528060248152602001620027006024913962000566565b6200033783836200058a565b905062000423565b6001826020015160028111156200035257fe5b1415620003b85781516001600160a01b0316620003835760405162461bcd60e51b81526004016200004f9062000d9e565b620003ac8260000151604051806060016040528060278152602001620026d96027913962000566565b620003378383620006db565b600282602001516002811115620003cb57fe5b1415620004095781516001600160a01b031615620003fd5760405162461bcd60e51b81526004016200004f9062000f84565b6200033783836200080b565b60405162461bcd60e51b81526004016200004f9062000ef5565b92915050565b6001600160a01b03821662000460578051156200045a5760405162461bcd60e51b81526004016200004f9062000dea565b62000562565b6000815111620004845760405162461bcd60e51b81526004016200004f9062000fd0565b6001600160a01b0382163014620004ba57620004ba82604051806060016040528060288152602001620026b16028913962000566565b600080836001600160a01b031683604051620004d7919062000c2e565b600060405180830381855af49150503d806000811462000514576040519150601f19603f3d011682016040523d82523d6000602084013e62000519565b606091505b509150915081620001c85780511562000548578060405162461bcd60e51b81526004016200004f919062000d3c565b60405162461bcd60e51b81526004016200004f9062000d58565b5050565b813b8181620001c85760405162461bcd60e51b81526004016200004f919062000d3c565b600080620005a26200027160201b620000aa1760201c565b905060005b836040015151811015620006d257600084604001518281518110620005c857fe5b6020908102919091018101516001600160e01b031981166000908152918590526040909120549091506001600160a01b031680156200061b5760405162461bcd60e51b81526004016200004f906200102d565b5060408051808201825286516001600160a01b03908116825261ffff89811660208085019182526001600160e01b0319871660009081528982529586209451855492516001600160a01b031990931694169390931761ffff60a01b1916600160a01b919092160217909155600180860180548083018255908452919092206008820401805463ffffffff60079093166004026101000a928302191660e09490941c91909102929092179091559485019401620005a7565b50929392505050565b600080620006f36200027160201b620000aa1760201c565b905060005b836040015151811015620006d2576000846040015182815181106200071957fe5b6020908102919091018101516001600160e01b031981166000908152918590526040909120549091506001600160a01b0316308114156200076e5760405162461bcd60e51b81526004016200004f90620010d6565b85516001600160a01b03828116911614156200079e5760405162461bcd60e51b81526004016200004f906200108a565b6001600160a01b038116620007c75760405162461bcd60e51b81526004016200004f90620011f9565b5084516001600160e01b031991909116600090815260208490526040902080546001600160a01b0319166001600160a01b03909216919091179055600101620006f8565b600080620008236200027160201b620000aa1760201c565b905060005b836040015151811015620006d2576000846040015182815181106200084957fe5b6020908102919091018101516001600160e01b0319811660009081528583526040908190208151808301909252546001600160a01b038116808352600160a01b90910461ffff169382019390935290925090620008ba5760405162461bcd60e51b81526004016200004f9062000e47565b80516001600160a01b0316301415620008e75760405162461bcd60e51b81526004016200004f9062001125565b60018703816020015161ffff1614620009bf5760008460010160018903815481106200090f57fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b90508085600101836020015161ffff16815481106200094d57fe5b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c92909202939093179055838201516001600160e01b03199390931681529086905260409020805461ffff60a01b1916600160a01b61ffff909316929092029190911790555b83600101805480620009cd57fe5b600082815260208082206008600019948501908104909101805463ffffffff600460078516026101000a02191690559093556001600160e01b0319909416845290859052604090922080546001600160b01b031916905550949094019360010162000828565b80516001600160a01b038116811462000a4b57600080fd5b919050565b600082601f83011262000a61578081fd5b8151602062000a7a62000a748362001269565b62001245565b828152818101908583018385028701840188101562000a97578586fd5b855b8581101562000acd5781516001600160e01b03198116811462000aba578788fd5b8452928401929084019060010162000a99565b5090979650505050505050565b6000806040838503121562000aed578182fd5b82516001600160401b038082111562000b04578384fd5b818501915085601f83011262000b18578384fd5b8151602062000b2b62000a748362001269565b82815281810190858301885b8581101562000bd257815188016060818e03601f1901121562000b58578a8bfd5b604051606081018181108a8211171562000b6e57fe5b60405262000b7e82880162000a33565b815260408201516003811062000b92578c8dfd5b8188015260608201518981111562000ba8578c8dfd5b62000bb88f898386010162000a50565b604083015250855250928401929084019060010162000b37565b5050809750505062000be681880162000a33565b9450505050509250929050565b6001600160a01b03169052565b6000815180845262000c1a81602086016020860162001287565b601f01601f19169290920160200192915050565b6000825162000c4281846020870162001287565b9190910192915050565b606080825284518282018190526000919060809081850190602080820287018401818b01875b8481101562000d0957898303607f19018652815180516001600160a01b0316845284810151898501906003811062000ca657fe5b858701526040918201519185018a9052815190819052908501908a90898601905b8083101562000cf35783516001600160e01b031916825292870192600192909201919087019062000cc7565b5097860197945050509083019060010162000c72565b505062000d198289018b62000bf3565b878103604089015262000d2d818a62000c00565b9b9a5050505050505050505050565b60006020825262000d51602083018462000c00565b9392505050565b60208082526026908201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e2072656040820152651d995c9d195960d21b606082015260800190565b60208082526034908201526000805160206200269183398151915260408201527f2063616e27742062652061646472657373283029000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860408201527f302920627574205f63616c6c64617461206973206e6f7420656d707479000000606082015260800190565b60208082526037908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360408201527f74696f6e207468617420646f65736e2774206578697374000000000000000000606082015260800190565b60208082526031908201527f4c69624469616d6f6e643a2061646420666163657420616464726573732063616040820152706e2774206265206164647265737328302960781b606082015260800190565b60208082526027908201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756040820152663a20b1ba34b7b760c91b606082015260800190565b60208082526028908201527f4c69624469616d6f6e643a204e6f2073656c6563746f727320696e20666163656040820152671d081d1bc818dd5d60c21b606082015260800190565b60208082526033908201526000805160206200269183398151915260408201527f206d757374206265206164647265737328302900000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460408201527f7920627574205f696e6974206973206e6f742061646472657373283029000000606082015260800190565b60208082526035908201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60408201527f6e207468617420616c7265616479206578697374730000000000000000000000606082015260800190565b60208082526038908201526000805160206200267183398151915260408201527f6374696f6e20776974682073616d652066756e6374696f6e0000000000000000606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60408201526e3aba30b1363290333ab731ba34b7b760891b606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560408201526e3a30b1363290333ab731ba34b7b71760891b606082015260800190565b6020808252602e908201527f50726576696f7573206f776e657220616e64206e6577206f776e6572206d757360408201526d1d08189948191a5999995c995b9d60921b606082015260800190565b60208082526015908201527f6f776e6572206d757374206e6f74206265203078300000000000000000000000604082015260600190565b60208082526038908201526000805160206200267183398151915260408201527f6374696f6e207468617420646f65736e27742065786973740000000000000000606082015260800190565b6040518181016001600160401b03811182821017156200126157fe5b604052919050565b60006001600160401b038211156200127d57fe5b5060209081020190565b60005b83811015620012a45781810151838201526020016200128a565b83811115620001c85750506000910152565b6113ab80620012c66000396000f3fe60806040523661000b57005b60006100156100aa565b600080357fffffffff000000000000000000000000000000000000000000000000000000001681526020829052604090205490915073ffffffffffffffffffffffffffffffffffffffff16806100865760405162461bcd60e51b815260040161007d90610fb9565b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100a5573d6000f35b3d6000fd5b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60006100d86100aa565b60010154905060005b845181101561011157610107828683815181106100fa57fe5b6020026020010151610222565b91506001016100e1565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67384848460405161014593929190610beb565b60405180910390a161015783836103bc565b50505050565b60006101676100aa565b600381015490915073ffffffffffffffffffffffffffffffffffffffff9081169083168114156101a95760405162461bcd60e51b815260040161007d9061121c565b6003820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85811691821790925560405190918316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080826040015151116102485760405162461bcd60e51b815260040161007d90610f5c565b60008260200151600281111561025a57fe5b14156102cb57815173ffffffffffffffffffffffffffffffffffffffff166102945760405162461bcd60e51b815260040161007d90610ea2565b6102ba82600001516040518060600160405280602481526020016113526024913961050a565b6102c4838361052b565b90506103b6565b6001826020015160028111156102dd57fe5b141561034757815173ffffffffffffffffffffffffffffffffffffffff166103175760405162461bcd60e51b815260040161007d90610d8b565b61033d826000015160405180606001604052806027815260200161132b6027913961050a565b6102c483836106f6565b60028260200151600281111561035957fe5b141561039e57815173ffffffffffffffffffffffffffffffffffffffff16156103945760405162461bcd60e51b815260040161007d90610fee565b6102c48383610889565b60405162461bcd60e51b815260040161007d90610eff565b92915050565b73ffffffffffffffffffffffffffffffffffffffff82166103fb578051156103f65760405162461bcd60e51b815260040161007d90610de8565b610506565b600081511161041c5760405162461bcd60e51b815260040161007d9061104b565b73ffffffffffffffffffffffffffffffffffffffff8216301461045b5761045b826040518060600160405280602881526020016113036028913961050a565b6000808373ffffffffffffffffffffffffffffffffffffffff16836040516104839190610bcf565b600060405180830381855af49150503d80600081146104be576040519150601f19603f3d011682016040523d82523d6000602084013e6104c3565b606091505b509150915081610157578051156104ee578060405162461bcd60e51b815260040161007d9190610d14565b60405162461bcd60e51b815260040161007d90610d2e565b5050565b813b81816101575760405162461bcd60e51b815260040161007d9190610d14565b6000806105366100aa565b905060005b8360400151518110156106ed5760008460400151828151811061055a57fe5b6020908102919091018101517fffffffff00000000000000000000000000000000000000000000000000000000811660009081529185905260409091205490915073ffffffffffffffffffffffffffffffffffffffff1680156105cf5760405162461bcd60e51b815260040161007d906110a8565b50604080518082018252865173ffffffffffffffffffffffffffffffffffffffff908116825261ffff89811660208085019182527fffffffff00000000000000000000000000000000000000000000000000000000871660009081528982529586209451855492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217909155600180860180548083018255908452919092206008820401805463ffffffff60079093166004026101000a928302191660e09490941c9190910292909217909155948501940161053b565b50929392505050565b6000806107016100aa565b905060005b8360400151518110156106ed5760008460400151828151811061072557fe5b6020908102919091018101517fffffffff00000000000000000000000000000000000000000000000000000000811660009081529185905260409091205490915073ffffffffffffffffffffffffffffffffffffffff163081141561079c5760405162461bcd60e51b815260040161007d90611162565b855173ffffffffffffffffffffffffffffffffffffffff828116911614156107d65760405162461bcd60e51b815260040161007d90611105565b73ffffffffffffffffffffffffffffffffffffffff81166108095760405162461bcd60e51b815260040161007d90611279565b5084517fffffffff0000000000000000000000000000000000000000000000000000000091909116600090815260208490526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055600101610706565b6000806108946100aa565b905060005b8360400151518110156106ed576000846040015182815181106108b857fe5b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815285835260409081902081518083019092525473ffffffffffffffffffffffffffffffffffffffff81168083527401000000000000000000000000000000000000000090910461ffff16938201939093529092509061095c5760405162461bcd60e51b815260040161007d90610e45565b805173ffffffffffffffffffffffffffffffffffffffff163014156109935760405162461bcd60e51b815260040161007d906111bf565b60018703816020015161ffff1614610aab5760008460010160018903815481106109b957fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b90508085600101836020015161ffff16815481106109f657fe5b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c92909202939093179055838201517fffffffff00000000000000000000000000000000000000000000000000000000939093168152908690526040902080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000061ffff909316929092029190911790555b83600101805480610ab857fe5b6000828152602080822060087fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff948501908104909101805463ffffffff600460078516026101000a02191690559093557fffffffff00000000000000000000000000000000000000000000000000000000909416845290859052604090922080547fffffffffffffffffffff00000000000000000000000000000000000000000000169055509490940193600101610899565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008151808452610b9d8160208601602086016112d6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251610be18184602087016112d6565b9190910192915050565b606080825284518282018190526000919060809081850190602080820287018401818b01875b84811015610ce5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a8403018652815188840173ffffffffffffffffffffffffffffffffffffffff82511685528582015160038110610c6d57fe5b858701526040918201519185018a9052815190819052908501908a90898601905b80831015610cd05783517fffffffff00000000000000000000000000000000000000000000000000000000168252928701926001929092019190870190610c8e565b50978601979450505090830190600101610c11565b5050610cf38289018b610b6b565b8781036040890152610d05818a610b85565b9b9a5050505050505050505050565b600060208252610d276020830184610b85565b9392505050565b60208082526026908201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e20726560408201527f7665727465640000000000000000000000000000000000000000000000000000606082015260800190565b60208082526034908201527f4c69624469616d6f6e643a2072656d6f7665206661636574206164647265737360408201527f2063616e27742062652061646472657373283029000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860408201527f302920627574205f63616c6c64617461206973206e6f7420656d707479000000606082015260800190565b60208082526037908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360408201527f74696f6e207468617420646f65736e2774206578697374000000000000000000606082015260800190565b60208082526031908201527f4c69624469616d6f6e643a20616464206661636574206164647265737320636160408201527f6e27742062652061646472657373283029000000000000000000000000000000606082015260800190565b60208082526027908201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560408201527f74416374696f6e00000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4c69624469616d6f6e643a204e6f2073656c6563746f727320696e206661636560408201527f7420746f20637574000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604082015260600190565b60208082526033908201527f4c69624469616d6f6e643a2072656d6f7665206661636574206164647265737360408201527f206d757374206265206164647265737328302900000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460408201527f7920627574205f696e6974206973206e6f742061646472657373283029000000606082015260800190565b60208082526035908201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60408201527f6e207468617420616c7265616479206578697374730000000000000000000000606082015260800190565b60208082526038908201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60408201527f6374696f6e20776974682073616d652066756e6374696f6e0000000000000000606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60408201527f757461626c652066756e6374696f6e0000000000000000000000000000000000606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560408201527f7461626c652066756e6374696f6e2e0000000000000000000000000000000000606082015260800190565b6020808252602e908201527f50726576696f7573206f776e657220616e64206e6577206f776e6572206d757360408201527f7420626520646966666572656e74000000000000000000000000000000000000606082015260800190565b60208082526038908201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60408201527f6374696f6e207468617420646f65736e27742065786973740000000000000000606082015260800190565b60005b838110156112f15781810151838201526020016112d9565b83811115610157575050600091015256fe4c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e643a2072656d6f7665206661636574206d757374206861766520636f64654c69624469616d6f6e643a20616464206661636574206d757374206861766520636f6465a26469706673582212201f3017b8871b2c951113e3683c1e9dd7db0a8666822dc8da4b0b218c90d10de264736f6c634300070600334c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e4c69624469616d6f6e643a2072656d6f766520666163657420616464726573734c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e643a2072656d6f7665206661636574206d757374206861766520636f64654c69624469616d6f6e643a20616464206661636574206d757374206861766520636f6465000000000000000000000000000000000000000000000000000000000000004000000000000000000000000089d652c64d7cee18f5df53b24d9d29d130b18798000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000767f7d9e655161c9e6d8a3dbb565666fcaa2bdf40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000011f931c1c0000000000000000000000000000000000000000000000000000000000000000000000000000000004499b879f6a7e75802cd09354ef2b788bf4cf26000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000005cdffacc60000000000000000000000000000000000000000000000000000000052ef6b2c00000000000000000000000000000000000000000000000000000000adfca15e000000000000000000000000000000000000000000000000000000007a0ed6270000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000000000000000000000000000000000000000000000eb8e3e48f770c5c13d9de2203fc307b6d04381ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000028da5cb5b00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000000000000000000000000000b93e511d913a17826d2df5ac8be122c0ebd1a26d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000018d240d8b00000000000000000000000000000000000000000000000000000000000000000000000000000000a62da56e9a330646386365dc6b2945b5c4d120ed00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001565a5d5f000000000000000000000000000000000000000000000000000000000417edd4d0000000000000000000000000000000000000000000000000000000070a0823100000000000000000000000000000000000000000000000000000000c2077e8100000000000000000000000000000000000000000000000000000000f77f962f000000000000000000000000000000000000000000000000000000005c19a95c00000000000000000000000000000000000000000000000000000000169df06400000000000000000000000000000000000000000000000000000000d265a11500000000000000000000000000000000000000000000000000000000b6b55f2500000000000000000000000000000000000000000000000000000000bfc10279000000000000000000000000000000000000000000000000000000005107a3ae00000000000000000000000000000000000000000000000000000000dd467064000000000000000000000000000000000000000000000000000000007a141096000000000000000000000000000000000000000000000000000000008e4a52480000000000000000000000000000000000000000000000000000000018ab6a3c000000000000000000000000000000000000000000000000000000006f12157800000000000000000000000000000000000000000000000000000000bef624d800000000000000000000000000000000000000000000000000000000bf0ae48c00000000000000000000000000000000000000000000000000000000c07473f600000000000000000000000000000000000000000000000000000000cbf8eda9000000000000000000000000000000000000000000000000000000002e1a7d4d00000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x60806040523661000b57005b60006100156100aa565b600080357fffffffff000000000000000000000000000000000000000000000000000000001681526020829052604090205490915073ffffffffffffffffffffffffffffffffffffffff16806100865760405162461bcd60e51b815260040161007d90610fb9565b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100a5573d6000f35b3d6000fd5b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b60006100d86100aa565b60010154905060005b845181101561011157610107828683815181106100fa57fe5b6020026020010151610222565b91506001016100e1565b507f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb67384848460405161014593929190610beb565b60405180910390a161015783836103bc565b50505050565b60006101676100aa565b600381015490915073ffffffffffffffffffffffffffffffffffffffff9081169083168114156101a95760405162461bcd60e51b815260040161007d9061121c565b6003820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85811691821790925560405190918316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080826040015151116102485760405162461bcd60e51b815260040161007d90610f5c565b60008260200151600281111561025a57fe5b14156102cb57815173ffffffffffffffffffffffffffffffffffffffff166102945760405162461bcd60e51b815260040161007d90610ea2565b6102ba82600001516040518060600160405280602481526020016113526024913961050a565b6102c4838361052b565b90506103b6565b6001826020015160028111156102dd57fe5b141561034757815173ffffffffffffffffffffffffffffffffffffffff166103175760405162461bcd60e51b815260040161007d90610d8b565b61033d826000015160405180606001604052806027815260200161132b6027913961050a565b6102c483836106f6565b60028260200151600281111561035957fe5b141561039e57815173ffffffffffffffffffffffffffffffffffffffff16156103945760405162461bcd60e51b815260040161007d90610fee565b6102c48383610889565b60405162461bcd60e51b815260040161007d90610eff565b92915050565b73ffffffffffffffffffffffffffffffffffffffff82166103fb578051156103f65760405162461bcd60e51b815260040161007d90610de8565b610506565b600081511161041c5760405162461bcd60e51b815260040161007d9061104b565b73ffffffffffffffffffffffffffffffffffffffff8216301461045b5761045b826040518060600160405280602881526020016113036028913961050a565b6000808373ffffffffffffffffffffffffffffffffffffffff16836040516104839190610bcf565b600060405180830381855af49150503d80600081146104be576040519150601f19603f3d011682016040523d82523d6000602084013e6104c3565b606091505b509150915081610157578051156104ee578060405162461bcd60e51b815260040161007d9190610d14565b60405162461bcd60e51b815260040161007d90610d2e565b5050565b813b81816101575760405162461bcd60e51b815260040161007d9190610d14565b6000806105366100aa565b905060005b8360400151518110156106ed5760008460400151828151811061055a57fe5b6020908102919091018101517fffffffff00000000000000000000000000000000000000000000000000000000811660009081529185905260409091205490915073ffffffffffffffffffffffffffffffffffffffff1680156105cf5760405162461bcd60e51b815260040161007d906110a8565b50604080518082018252865173ffffffffffffffffffffffffffffffffffffffff908116825261ffff89811660208085019182527fffffffff00000000000000000000000000000000000000000000000000000000871660009081528982529586209451855492517fffffffffffffffffffffffff00000000000000000000000000000000000000009093169416939093177fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000919092160217909155600180860180548083018255908452919092206008820401805463ffffffff60079093166004026101000a928302191660e09490941c9190910292909217909155948501940161053b565b50929392505050565b6000806107016100aa565b905060005b8360400151518110156106ed5760008460400151828151811061072557fe5b6020908102919091018101517fffffffff00000000000000000000000000000000000000000000000000000000811660009081529185905260409091205490915073ffffffffffffffffffffffffffffffffffffffff163081141561079c5760405162461bcd60e51b815260040161007d90611162565b855173ffffffffffffffffffffffffffffffffffffffff828116911614156107d65760405162461bcd60e51b815260040161007d90611105565b73ffffffffffffffffffffffffffffffffffffffff81166108095760405162461bcd60e51b815260040161007d90611279565b5084517fffffffff0000000000000000000000000000000000000000000000000000000091909116600090815260208490526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055600101610706565b6000806108946100aa565b905060005b8360400151518110156106ed576000846040015182815181106108b857fe5b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815285835260409081902081518083019092525473ffffffffffffffffffffffffffffffffffffffff81168083527401000000000000000000000000000000000000000090910461ffff16938201939093529092509061095c5760405162461bcd60e51b815260040161007d90610e45565b805173ffffffffffffffffffffffffffffffffffffffff163014156109935760405162461bcd60e51b815260040161007d906111bf565b60018703816020015161ffff1614610aab5760008460010160018903815481106109b957fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b90508085600101836020015161ffff16815481106109f657fe5b600091825260208083206008830401805463ffffffff60079094166004026101000a938402191660e09590951c92909202939093179055838201517fffffffff00000000000000000000000000000000000000000000000000000000939093168152908690526040902080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000061ffff909316929092029190911790555b83600101805480610ab857fe5b6000828152602080822060087fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff948501908104909101805463ffffffff600460078516026101000a02191690559093557fffffffff00000000000000000000000000000000000000000000000000000000909416845290859052604090922080547fffffffffffffffffffff00000000000000000000000000000000000000000000169055509490940193600101610899565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008151808452610b9d8160208601602086016112d6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251610be18184602087016112d6565b9190910192915050565b606080825284518282018190526000919060809081850190602080820287018401818b01875b84811015610ce5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a8403018652815188840173ffffffffffffffffffffffffffffffffffffffff82511685528582015160038110610c6d57fe5b858701526040918201519185018a9052815190819052908501908a90898601905b80831015610cd05783517fffffffff00000000000000000000000000000000000000000000000000000000168252928701926001929092019190870190610c8e565b50978601979450505090830190600101610c11565b5050610cf38289018b610b6b565b8781036040890152610d05818a610b85565b9b9a5050505050505050505050565b600060208252610d276020830184610b85565b9392505050565b60208082526026908201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e20726560408201527f7665727465640000000000000000000000000000000000000000000000000000606082015260800190565b60208082526034908201527f4c69624469616d6f6e643a2072656d6f7665206661636574206164647265737360408201527f2063616e27742062652061646472657373283029000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860408201527f302920627574205f63616c6c64617461206973206e6f7420656d707479000000606082015260800190565b60208082526037908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360408201527f74696f6e207468617420646f65736e2774206578697374000000000000000000606082015260800190565b60208082526031908201527f4c69624469616d6f6e643a20616464206661636574206164647265737320636160408201527f6e27742062652061646472657373283029000000000000000000000000000000606082015260800190565b60208082526027908201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560408201527f74416374696f6e00000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4c69624469616d6f6e643a204e6f2073656c6563746f727320696e206661636560408201527f7420746f20637574000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374604082015260600190565b60208082526033908201527f4c69624469616d6f6e643a2072656d6f7665206661636574206164647265737360408201527f206d757374206265206164647265737328302900000000000000000000000000606082015260800190565b6020808252603d908201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460408201527f7920627574205f696e6974206973206e6f742061646472657373283029000000606082015260800190565b60208082526035908201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60408201527f6e207468617420616c7265616479206578697374730000000000000000000000606082015260800190565b60208082526038908201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60408201527f6374696f6e20776974682073616d652066756e6374696f6e0000000000000000606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60408201527f757461626c652066756e6374696f6e0000000000000000000000000000000000606082015260800190565b6020808252602f908201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560408201527f7461626c652066756e6374696f6e2e0000000000000000000000000000000000606082015260800190565b6020808252602e908201527f50726576696f7573206f776e657220616e64206e6577206f776e6572206d757360408201527f7420626520646966666572656e74000000000000000000000000000000000000606082015260800190565b60208082526038908201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60408201527f6374696f6e207468617420646f65736e27742065786973740000000000000000606082015260800190565b60005b838110156112f15781810151838201526020016112d9565b83811115610157575050600091015256fe4c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e643a2072656d6f7665206661636574206d757374206861766520636f64654c69624469616d6f6e643a20616464206661636574206d757374206861766520636f6465a26469706673582212201f3017b8871b2c951113e3683c1e9dd7db0a8666822dc8da4b0b218c90d10de264736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000004000000000000000000000000089d652c64d7cee18f5df53b24d9d29d130b18798000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000767f7d9e655161c9e6d8a3dbb565666fcaa2bdf40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000011f931c1c0000000000000000000000000000000000000000000000000000000000000000000000000000000004499b879f6a7e75802cd09354ef2b788bf4cf26000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000005cdffacc60000000000000000000000000000000000000000000000000000000052ef6b2c00000000000000000000000000000000000000000000000000000000adfca15e000000000000000000000000000000000000000000000000000000007a0ed6270000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000000000000000000000000000000000000000000000eb8e3e48f770c5c13d9de2203fc307b6d04381ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000028da5cb5b00000000000000000000000000000000000000000000000000000000f2fde38b00000000000000000000000000000000000000000000000000000000000000000000000000000000b93e511d913a17826d2df5ac8be122c0ebd1a26d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000018d240d8b00000000000000000000000000000000000000000000000000000000000000000000000000000000a62da56e9a330646386365dc6b2945b5c4d120ed00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001565a5d5f000000000000000000000000000000000000000000000000000000000417edd4d0000000000000000000000000000000000000000000000000000000070a0823100000000000000000000000000000000000000000000000000000000c2077e8100000000000000000000000000000000000000000000000000000000f77f962f000000000000000000000000000000000000000000000000000000005c19a95c00000000000000000000000000000000000000000000000000000000169df06400000000000000000000000000000000000000000000000000000000d265a11500000000000000000000000000000000000000000000000000000000b6b55f2500000000000000000000000000000000000000000000000000000000bfc10279000000000000000000000000000000000000000000000000000000005107a3ae00000000000000000000000000000000000000000000000000000000dd467064000000000000000000000000000000000000000000000000000000007a141096000000000000000000000000000000000000000000000000000000008e4a52480000000000000000000000000000000000000000000000000000000018ab6a3c000000000000000000000000000000000000000000000000000000006f12157800000000000000000000000000000000000000000000000000000000bef624d800000000000000000000000000000000000000000000000000000000bf0ae48c00000000000000000000000000000000000000000000000000000000c07473f600000000000000000000000000000000000000000000000000000000cbf8eda9000000000000000000000000000000000000000000000000000000002e1a7d4d00000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _diamondCut (tuple[]): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [1] : _owner (address): 0x89d652C64d7CeE18F5DF53B24d9D29D130b18798
-----Encoded View---------------
58 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 00000000000000000000000089d652c64d7cee18f5df53b24d9d29d130b18798
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000320
Arg [7] : 00000000000000000000000000000000000000000000000000000000000003c0
Arg [8] : 000000000000000000000000767f7d9e655161c9e6d8a3dbb565666fcaa2bdf4
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [12] : 1f931c1c00000000000000000000000000000000000000000000000000000000
Arg [13] : 00000000000000000000000004499b879f6a7e75802cd09354ef2b788bf4cf26
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [17] : cdffacc600000000000000000000000000000000000000000000000000000000
Arg [18] : 52ef6b2c00000000000000000000000000000000000000000000000000000000
Arg [19] : adfca15e00000000000000000000000000000000000000000000000000000000
Arg [20] : 7a0ed62700000000000000000000000000000000000000000000000000000000
Arg [21] : 01ffc9a700000000000000000000000000000000000000000000000000000000
Arg [22] : 000000000000000000000000eb8e3e48f770c5c13d9de2203fc307b6d04381ff
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [24] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [25] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [26] : 8da5cb5b00000000000000000000000000000000000000000000000000000000
Arg [27] : f2fde38b00000000000000000000000000000000000000000000000000000000
Arg [28] : 000000000000000000000000b93e511d913a17826d2df5ac8be122c0ebd1a26d
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [30] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [31] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [32] : 8d240d8b00000000000000000000000000000000000000000000000000000000
Arg [33] : 000000000000000000000000a62da56e9a330646386365dc6b2945b5c4d120ed
Arg [34] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [35] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [36] : 0000000000000000000000000000000000000000000000000000000000000015
Arg [37] : 65a5d5f000000000000000000000000000000000000000000000000000000000
Arg [38] : 417edd4d00000000000000000000000000000000000000000000000000000000
Arg [39] : 70a0823100000000000000000000000000000000000000000000000000000000
Arg [40] : c2077e8100000000000000000000000000000000000000000000000000000000
Arg [41] : f77f962f00000000000000000000000000000000000000000000000000000000
Arg [42] : 5c19a95c00000000000000000000000000000000000000000000000000000000
Arg [43] : 169df06400000000000000000000000000000000000000000000000000000000
Arg [44] : d265a11500000000000000000000000000000000000000000000000000000000
Arg [45] : b6b55f2500000000000000000000000000000000000000000000000000000000
Arg [46] : bfc1027900000000000000000000000000000000000000000000000000000000
Arg [47] : 5107a3ae00000000000000000000000000000000000000000000000000000000
Arg [48] : dd46706400000000000000000000000000000000000000000000000000000000
Arg [49] : 7a14109600000000000000000000000000000000000000000000000000000000
Arg [50] : 8e4a524800000000000000000000000000000000000000000000000000000000
Arg [51] : 18ab6a3c00000000000000000000000000000000000000000000000000000000
Arg [52] : 6f12157800000000000000000000000000000000000000000000000000000000
Arg [53] : bef624d800000000000000000000000000000000000000000000000000000000
Arg [54] : bf0ae48c00000000000000000000000000000000000000000000000000000000
Arg [55] : c07473f600000000000000000000000000000000000000000000000000000000
Arg [56] : cbf8eda900000000000000000000000000000000000000000000000000000000
Arg [57] : 2e1a7d4d00000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.