Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 4 internal transactions
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
6570456 | 39 days ago | Contract Creation | 0 ETH | |||
6570456 | 39 days ago | Contract Creation | 0 ETH | |||
6448023 | 58 days ago | Contract Creation | 0 ETH | |||
6448023 | 58 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
FairFund
Compiler Version
v0.8.25+commit.b61c2a91
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; /** * Layout of the contract * version * imports * errors * interfaces, libraries, and contracts * type declarations * state variables * events * modifiers * functions * * layout of functions * constructor * receive function * fallback function * external functions * public functions * internal functions * private functions * view functions * pure functions * getters */ import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {FundingVault} from "./FundingVault.sol"; import {VotingPowerToken} from "./VotingPowerToken.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title FairFund * @author Aditya Bhattad * @notice This is the main FairFund contract that will be used for deployment and keeping track of all the funding vaults. */ contract FairFund is Ownable { // Errors // error FairFund__CannotBeAZeroAddress(); error FairFund__TallyDateCannotBeInThePast(); error FairFund__MinRequestableAmountCannotBeGreaterThanMaxRequestableAmount(); error FairFund__MaxRequestableAmountCannotBeZero(); error FairFund__TransferFailed(address token, address recepient, uint256 amount); // State Variables // uint256 private s_fundingVaultIdCounter; mapping(uint256 fundingVaultId => address fundingVault) private s_fundingVaults; uint256 private s_platformFee; // Events // event FundingVaultDeployed(address indexed fundingVault); event TransferTokens(address indexed token, address indexed recepient, uint256 amount); /** * @param _platformFee The fee that will be charged by the platform for using the FairFund platform */ constructor(uint256 _platformFee) Ownable(msg.sender) { s_platformFee = _platformFee; } // Functions // /** * @param _fundingToken The token that will be used to fund the proposals * @param _votingToken The token that will be used to vote on the proposals * @param _minRequestableAmount The minimum amount that can be requested by a single proposal from the funding vault * @param _maxRequestableAmount The maximum amount that can be requested by a single proposal from the funding vault * @param _tallyDate The date when the voting will end and the proposals will be tallied */ function deployFundingVault( address _fundingToken, address _votingToken, uint256 _minRequestableAmount, uint256 _maxRequestableAmount, uint256 _tallyDate ) external returns (address) { if (_fundingToken == address(0) || _votingToken == address(0)) { revert FairFund__CannotBeAZeroAddress(); } if (_tallyDate < block.timestamp) { revert FairFund__TallyDateCannotBeInThePast(); } if (_minRequestableAmount > _maxRequestableAmount) { revert FairFund__MinRequestableAmountCannotBeGreaterThanMaxRequestableAmount(); } if (_maxRequestableAmount == 0) { revert FairFund__MaxRequestableAmountCannotBeZero(); } s_fundingVaultIdCounter++; uint256 fundingVaultId = s_fundingVaultIdCounter; string memory fundingVaultIdString = Strings.toString(fundingVaultId); string memory votingPowerTokenName = string.concat("Voting Power Token ", fundingVaultIdString); string memory votingPowerTokenSymbol = string.concat("VOTE_", fundingVaultIdString); VotingPowerToken votingPowerToken = new VotingPowerToken(votingPowerTokenName, votingPowerTokenSymbol); FundingVault fundingVault = new FundingVault( _fundingToken, _votingToken, address(votingPowerToken), _minRequestableAmount, _maxRequestableAmount, _tallyDate, address(this) ); votingPowerToken.transferOwnership(address(fundingVault)); s_fundingVaults[fundingVaultId] = address(fundingVault); emit FundingVaultDeployed(address(fundingVault)); return address(fundingVault); } function modityPlatformFee(uint256 _platformFee) external onlyOwner { s_platformFee = _platformFee; } function withdrawPlatformFee(address recepient, address token) external onlyOwner { if (recepient == address(0) || token == address(0)) { revert FairFund__CannotBeAZeroAddress(); } uint256 platformBalance = IERC20(token).balanceOf(address(this)); if (platformBalance != 0) { bool success = IERC20(token).transfer(recepient, platformBalance); if (!success) { revert FairFund__TransferFailed(token, recepient, platformBalance); } emit TransferTokens(token, recepient, platformBalance); } } // Getters // function getFundingVault(uint256 _fundingVaultId) external view returns (address) { return s_fundingVaults[_fundingVaultId]; } function getTotalNumberOfFundingVaults() external view returns (uint256) { return s_fundingVaultIdCounter; } function getPlatformFee() external view returns (uint256) { return s_platformFee; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; /** * Layout of the contract * version * imports * errors * interfaces, libraries, and contracts * type declarations * state variables * events * modifiers * functions * * layout of functions * constructor * receive function * fallback function * external functions * public functions * internal functions * private functions * view functions * pure functions * getters */ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {VotingPowerToken} from "./VotingPowerToken.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {FairFund} from "./FairFund.sol"; /** * @title FundingVault * @author Aditya Bhattad * @notice A contract that allows users to deposit funds and vote on proposals, after voting ends anyone can call distributeFunds to distribute the funds to the proposals * Whether a proposal is selected for receiving funds is decided using this formula: * Let: * `V(p)` be the number of votingPowerTokens assigned to proposal `p` * `S` be the total supply of votingPowerTokens * `R` be the vault's balance of fundingTokens * * A proposal `p` is accepted iff `R * V(p)/S >= p.minimumAmount`. * * The funding to be received by an accepted proposal `p` is `min(p.maximumAmount, R * V(p)/S)`. * The funding to be received by a rejected proposal `p` is `0`. */ contract FundingVault is ReentrancyGuard { // Errors // error FundingVault__AmountCannotBeZero(); error FundingVault__MaxRequestableAmountCannotBeLessThanMinRequestableAmount(); error FundingVault__MinRequestableAmountCannotBeGreaterThanMaxRequestableAmount(); error FundingVault__CannotBeAZeroAddress(); error FundingVault__MetadataCannotBeEmpty(); error FundingVault__AmountExceededsLimit(); error FundingVault__ProposalDoesNotExist(); error FundingVault__AlreadyVoted(); error FundingVault__TallyDateNotPassed(); error FundingVault__NotEnoughBalance(); error FundingVault__NoVotingPowerTokenMinted(); error FundingVault__TransferFailed(); error FundingVault__AlreadyDistributedFunds(); error FundingVault__FundsNotDistributedYet(); error FundingVault__NoFundsToWithdraw(); error FundingVault__NoRemainingFundsToWithdraw(); error FundingVault__WithdrawableAmountTooSmall(); // Type Declarations // struct Proposal { string metadata; uint256 minimumAmount; uint256 maximumAmount; address recipient; } // State Variables // uint256 private s_proposalIdCounter; IERC20 private immutable i_fundingToken; IERC20 private immutable i_votingToken; VotingPowerToken private immutable i_votingPowerToken; FairFund private immutable i_deployer; uint256 private s_minRequestableAmount; uint256 private s_maxRequestableAmount; uint256 private s_totalBalanceAvailableForDistribution; uint256 private s_totalFundsDistributed; bool private s_fundsDistributed; /** * @dev The date in which the tally will be taken as seconds since unix epoch */ uint256 private immutable i_tallyDate; mapping(address proposer => uint256[] proposalIds) private s_proposerToProposalIds; mapping(uint256 proposalId => Proposal proposal) private s_proposals; mapping(uint256 proposalId => uint256 votes) private s_votes; mapping(address voter => uint256 amountOfVotingTokens) private s_voterToVotingTokens; mapping(address user => uint256 amountDeposited) private s_userToDistributionAmountDeposited; // Events // event FundingTokenDeposited(address indexed from, uint256 indexed amount); event RegisteredVoter(address indexed voter, uint256 indexed amount); event ProposalSubmitted(address indexed proposer, uint256 indexed proposalId); event VotedOnProposal(address indexed voter, uint256 indexed proposalId, uint256 indexed amount); event ReleasedTokens(address indexed voter, uint256 indexed amount); event FundsDistributed(uint256 indexed proposalId, address indexed recipient, uint256 indexed amount); event RemainingFundsWithdrawn(address indexed user, uint256 amount); event PlatformFeeSubmitted(address indexed platform, uint256 amount); modifier tallyDatePassed() { if (block.timestamp < i_tallyDate) { revert FundingVault__TallyDateNotPassed(); } _; } // Functions // /** * @param _fundingToken The token that will be used to fund the proposals * @param _votingToken The token that will be locked against voting power tokens, which allows the user to vote on proposals * @param _votingPowerToken The token that will be minted when a user locks their voting tokens * @param _minRequestableAmount The minimum amount of token that can be requested in proposal * @param _maxRequestableAmount The maximum amount of token that can be requested in proposal * @param _tallyDate The date in which the tally will be taken as seconds since unix epoch * @param _deployer The address of the main fairfund smart contract */ constructor( address _fundingToken, address _votingToken, address _votingPowerToken, uint256 _minRequestableAmount, uint256 _maxRequestableAmount, uint256 _tallyDate, address _deployer ) { i_tallyDate = _tallyDate; i_fundingToken = IERC20(_fundingToken); i_votingToken = IERC20(_votingToken); i_votingPowerToken = VotingPowerToken(_votingPowerToken); s_minRequestableAmount = _minRequestableAmount; s_maxRequestableAmount = _maxRequestableAmount; s_totalBalanceAvailableForDistribution = 0; s_totalFundsDistributed = 0; s_fundsDistributed = false; i_deployer = FairFund(_deployer); } /** * @dev Allows users to deposit fundingToken into the vault * @param _amount The amount of fundingToken to deposit */ function deposit(uint256 _amount) public nonReentrant { if (_amount <= 0) { revert FundingVault__AmountCannotBeZero(); } s_totalBalanceAvailableForDistribution += _amount; i_fundingToken.transferFrom(msg.sender, address(this), _amount); s_userToDistributionAmountDeposited[msg.sender] = _amount; emit FundingTokenDeposited(msg.sender, _amount); } /** * @dev locks votingToken from the user and mints votingPowerToken * @param _amount The amount of votingTokens to lock in order to receive votingPowerTokens */ function register(uint256 _amount) public nonReentrant { if (_amount <= 0) { revert FundingVault__AmountCannotBeZero(); } if (i_votingToken.balanceOf(msg.sender) < _amount) { revert FundingVault__NotEnoughBalance(); } i_votingToken.transferFrom(msg.sender, address(this), _amount); i_votingPowerToken.mint(msg.sender, _amount); s_voterToVotingTokens[msg.sender] += _amount; emit RegisteredVoter(msg.sender, _amount); } /** * @dev Allows users to submit a proposal * @param _metadata The metadata of the proposal * @param _minimumAmount The minimum amount of fundingToken requested * @param _maximumAmount The maximum amount of fundingToken requested * @param _recipient The address that will receive the fundingToken if the proposal is accepted */ function submitProposal(string memory _metadata, uint256 _minimumAmount, uint256 _maximumAmount, address _recipient) public nonReentrant returns (uint256) { if (bytes(_metadata).length == 0) { revert FundingVault__MetadataCannotBeEmpty(); } if (_minimumAmount < s_minRequestableAmount || _maximumAmount > s_maxRequestableAmount) { revert FundingVault__AmountExceededsLimit(); } if (_minimumAmount > _maximumAmount) { revert FundingVault__MinRequestableAmountCannotBeGreaterThanMaxRequestableAmount(); } if (_recipient == address(0)) { revert FundingVault__CannotBeAZeroAddress(); } s_proposalIdCounter++; s_proposals[s_proposalIdCounter] = Proposal(_metadata, _minimumAmount, _maximumAmount, _recipient); s_proposerToProposalIds[msg.sender].push(s_proposalIdCounter); emit ProposalSubmitted(msg.sender, s_proposalIdCounter); return s_proposalIdCounter; } /** * @dev Allows users to vote on a proposal * @param _proposalId The id of the proposal to vote on * @param _amount The amount of votingToken to vote with */ function voteOnProposal(uint256 _proposalId, uint256 _amount) public nonReentrant { if (_proposalId <= 0 || _proposalId > s_proposalIdCounter) { revert FundingVault__ProposalDoesNotExist(); } uint256 votingPower = i_votingPowerToken.balanceOf(msg.sender); if (_amount > votingPower) { revert FundingVault__AmountExceededsLimit(); } i_votingPowerToken.transferFrom(msg.sender, address(this), _amount); s_votes[_proposalId] += _amount; emit VotedOnProposal(msg.sender, _proposalId, _amount); } /** * @dev Calculates the amount of fundingToken to be received by a proposal * @param _proposalId The id of the proposal to calculate the funding for * @return The amount of fundingToken to be received by the proposal */ function calculateFundingToBeReceived(uint256 _proposalId) public view tallyDatePassed returns (uint256) { if (_proposalId <= 0 || _proposalId > s_proposalIdCounter) { revert FundingVault__ProposalDoesNotExist(); } uint256 totalVotingPowerTokens = i_votingPowerToken.totalSupply(); if (totalVotingPowerTokens == 0) { revert FundingVault__NoVotingPowerTokenMinted(); } // Floating point adjustment: // 1.totalVotes is multiplied by 1e18 to avoid rounding errors // 2.transferable is divided by 1e18 to get the actual amount uint256 totalVotes = s_votes[_proposalId] * 1e18; Proposal memory proposal = s_proposals[_proposalId]; /** * Let: * `V(p)` be the number of votingPowerTokens assigned to proposal `p` * `S` be the total supply of votingPowerTokens * `R` be the vault's balance of fundingTokens * A proposal `p` is accepted iff `R * V(p)/S >= p.minimumAmount (bug: What if proposer sets the minimum amount to zero, their proposal will always get accepted)`. * The funding to be received by an accepted proposal `p` is `min(p.maximumAmount, R * V(p)/S)`. * The funding to be received by a rejected proposal `p` is `0`. */ uint256 transferable = (s_totalBalanceAvailableForDistribution * (totalVotes / totalVotingPowerTokens)) / 1e18; bool isProposalAccepted = transferable >= proposal.minimumAmount; if (isProposalAccepted) { if (transferable > proposal.maximumAmount) { return proposal.maximumAmount; } else { return transferable; } } else { return 0; } } /** * @dev Distributes the funds to the proposals * @notice Can only be called after the tally date has passed */ function distributeFunds() external nonReentrant tallyDatePassed { if (s_fundsDistributed) { revert FundingVault__AlreadyDistributedFunds(); } s_fundsDistributed = true; uint256 platformFeePercentage = i_deployer.getPlatformFee(); uint256 feeAmount = 0; for (uint256 i = 1; i <= s_proposalIdCounter; i++) { uint256 amount = calculateFundingToBeReceived(i); if (amount > 0) { Proposal memory proposal = s_proposals[i]; uint256 fee = (amount * platformFeePercentage) / 100; amount -= fee; feeAmount += fee; bool success = i_fundingToken.transfer(proposal.recipient, amount); if (!success) { revert FundingVault__TransferFailed(); } s_totalFundsDistributed += amount + fee; emit FundsDistributed(i, proposal.recipient, amount); } } if (feeAmount > 0) { bool success = i_fundingToken.transfer(address(i_deployer), feeAmount); if (!success) { revert FundingVault__TransferFailed(); } emit PlatformFeeSubmitted(address(i_deployer), feeAmount); } } /** * @dev Allows users to release their votingToken after the tally date has passed * @notice Can only be called after the tally date has passed */ function releaseVotingTokens() public nonReentrant tallyDatePassed { uint256 votingPower = s_voterToVotingTokens[msg.sender]; if (votingPower <= 0) { revert FundingVault__AmountCannotBeZero(); } s_voterToVotingTokens[msg.sender] = 0; i_votingToken.transfer(msg.sender, votingPower); emit ReleasedTokens(msg.sender, votingPower); } /** * @notice Allows users to withdraw their proportional share of remaining funds after distribution * @dev This function can only be called after the tally date has passed and funds have been distributed * @dev The function calculates the user's share based on their initial deposit and the remaining funds * @dev State changes are made before the transfer to prevent reentrancy * @dev Emits a RemainingFundsWithdrawn event upon successful withdrawal * @dev This function does not take any parameters as it uses msg.sender to identify the user * @custom:throws FundingVault__FundsNotDistributedYet if funds haven't been distributed yet * @custom:throws FundingVault__NoFundsToWithdraw if the user has no funds to withdraw * @custom:throws FundingVault__NoRemainingFundsToWithdraw if there are no remaining funds to withdraw * @custom:throws FundingVault__WithdrawableAmountTooSmall if the calculated withdrawable amount is zero * @custom:throws FundingVault__TransferFailed if the token transfer fails */ function withdrawRemaining() public nonReentrant tallyDatePassed { if (!s_fundsDistributed) { revert FundingVault__FundsNotDistributedYet(); } uint256 userDepositedAmount = s_userToDistributionAmountDeposited[msg.sender]; if (userDepositedAmount == 0) { revert FundingVault__NoFundsToWithdraw(); } uint256 totalDistributableFunds = s_totalBalanceAvailableForDistribution; uint256 totalDistributedFunds = s_totalFundsDistributed; if (totalDistributableFunds <= totalDistributedFunds) { revert FundingVault__NoRemainingFundsToWithdraw(); } uint256 remainingFunds = totalDistributableFunds - totalDistributedFunds; uint256 userShareRatio = (userDepositedAmount * 1e18) / totalDistributableFunds; uint256 userWithdrawableAmount = (userShareRatio * remainingFunds) / 1e18; if (userWithdrawableAmount == 0) { revert FundingVault__WithdrawableAmountTooSmall(); } s_userToDistributionAmountDeposited[msg.sender] = 0; bool success = i_fundingToken.transfer(msg.sender, userWithdrawableAmount); if (!success) { revert FundingVault__TransferFailed(); } emit RemainingFundsWithdrawn(msg.sender, userWithdrawableAmount); } // Getters // function getProposal(uint256 _proposalId) public view returns (string memory, uint256, uint256, address) { Proposal memory proposal = s_proposals[_proposalId]; return (proposal.metadata, proposal.minimumAmount, proposal.maximumAmount, proposal.recipient); } function getProposalIdsByProposer(address _proposer) public view returns (uint256[] memory) { return s_proposerToProposalIds[_proposer]; } function getTotalProposals() public view returns (uint256) { return s_proposalIdCounter; } function getMinRequestableAmount() public view returns (uint256) { return s_minRequestableAmount; } function getMaxRequestableAmount() public view returns (uint256) { return s_maxRequestableAmount; } function getTallyDate() public view returns (uint256) { return i_tallyDate; } function getFundingToken() public view returns (address) { return address(i_fundingToken); } function getVotingToken() public view returns (address) { return address(i_votingToken); } function getVotingPowerToken() public view returns (address) { return address(i_votingPowerToken); } function getTotalVotingPowerTokensMinted() public view returns (uint256) { return i_votingPowerToken.totalSupply(); } function getTotalVotingPowerTokensUsed() public view returns (uint256) { return i_votingPowerToken.balanceOf(address(this)); } function getTotalBalanceAvailbleForDistribution() public view returns (uint256) { return s_totalBalanceAvailableForDistribution; } function getTotalFundsDistributed() public view returns (uint256) { return s_totalFundsDistributed; } function getVotingPowerOf(address _voter) public view returns (uint256) { return s_voterToVotingTokens[_voter]; } function getDeployer() public view returns (address) { return address(i_deployer); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; /** * Layout of the contract * version * imports * errors * interfaces, libraries, and contracts * type declarations * state variables * events * modifiers * functions * * layout of functions * constructor * receive function * fallback function * external functions * public functions * internal functions * private functions * view functions * pure functions * getters */ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract VotingPowerToken is ERC20, Ownable { constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) Ownable(msg.sender) {} function mint(address _to, uint256 _amount) external onlyOwner { _mint(_to, _amount); } function burn(address _of, uint256 _amount) external onlyOwner { _burn(_of, _amount); } function transferFrom(address from, address to, uint256 value) public override returns (bool) { if (msg.sender != owner()) { super.transferFrom(from, to, value); } _transfer(from, to, value); return true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead 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. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
[{"inputs":[{"internalType":"uint256","name":"_platformFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FairFund__CannotBeAZeroAddress","type":"error"},{"inputs":[],"name":"FairFund__MaxRequestableAmountCannotBeZero","type":"error"},{"inputs":[],"name":"FairFund__MinRequestableAmountCannotBeGreaterThanMaxRequestableAmount","type":"error"},{"inputs":[],"name":"FairFund__TallyDateCannotBeInThePast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recepient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FairFund__TransferFailed","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fundingVault","type":"address"}],"name":"FundingVaultDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recepient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TransferTokens","type":"event"},{"inputs":[{"internalType":"address","name":"_fundingToken","type":"address"},{"internalType":"address","name":"_votingToken","type":"address"},{"internalType":"uint256","name":"_minRequestableAmount","type":"uint256"},{"internalType":"uint256","name":"_maxRequestableAmount","type":"uint256"},{"internalType":"uint256","name":"_tallyDate","type":"uint256"}],"name":"deployFundingVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fundingVaultId","type":"uint256"}],"name":"getFundingVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlatformFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalNumberOfFundingVaults","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_platformFee","type":"uint256"}],"name":"modityPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recepient","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"withdrawPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052348015600f57600080fd5b506040516135e63803806135e6833981016040819052602c9160b0565b3380605157604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6058816060565b5060035560c8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121560c157600080fd5b5051919050565b61350f806100d76000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100f7578063a0671d9014610108578063d1f8370814610131578063f24552be14610144578063f2fde38b1461014c57600080fd5b80630672ee59146100985780635800920e146100ad5780636ea8bc10146100dd578063715018a6146100ef575b600080fd5b6100ab6100a6366004610811565b61015f565b005b6100c06100bb366004610844565b61031f565b6040516001600160a01b0390911681526020015b60405180910390f35b6003545b6040519081526020016100d4565b6100ab610593565b6000546001600160a01b03166100c0565b6100c0610116366004610891565b6000908152600260205260409020546001600160a01b031690565b6100ab61013f366004610891565b6105a7565b6001546100e1565b6100ab61015a3660046108aa565b6105b4565b6101676105f2565b6001600160a01b038216158061018457506001600160a01b038116155b156101a25760405163bb59defb60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156101e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020d91906108cc565b9050801561031a5760405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390526000919084169063a9059cbb906044016020604051808303816000875af1158015610268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028c91906108e5565b9050806102cb57604051636a1cc7f360e11b81526001600160a01b03808516600483015285166024820152604481018390526064015b60405180910390fd5b836001600160a01b0316836001600160a01b03167f58908a0fd75f7db2ca358a37b3076327d374ee1403d013a2efbc255535501edf8460405161031091815260200190565b60405180910390a3505b505050565b60006001600160a01b038616158061033e57506001600160a01b038516155b1561035c5760405163bb59defb60e01b815260040160405180910390fd5b4282101561037d5760405163c12866ab60e01b815260040160405180910390fd5b8284111561039e576040516338ce4da360e01b815260040160405180910390fd5b826000036103bf576040516366ab508160e11b815260040160405180910390fd5b600180549060006103cf83610907565b909155505060015460006103e28261061f565b90506000816040516020016103f79190610952565b604051602081830303815290604052905060008260405160200161041b919061098d565b60405160208183030381529060405290506000828260405161043c906107db565b6104479291906109e6565b604051809103906000f080158015610463573d6000803e3d6000fd5b50905060008b8b838c8c8c3060405161047b906107e8565b6001600160a01b039788168152958716602087015293861660408601526060850192909252608084015260a083015290911660c082015260e001604051809103906000f0801580156104d1573d6000803e3d6000fd5b5060405163f2fde38b60e01b81526001600160a01b0380831660048301529192509083169063f2fde38b90602401600060405180830381600087803b15801561051957600080fd5b505af115801561052d573d6000803e3d6000fd5b50505060008781526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590519092507f88890f101e05f842f970e80a57886fda0f59e782dfe4c9c65bd7ae6c5b1ce9759190a29b9a5050505050505050505050565b61059b6105f2565b6105a560006106b2565b565b6105af6105f2565b600355565b6105bc6105f2565b6001600160a01b0381166105e657604051631e4fbdf760e01b8152600060048201526024016102c2565b6105ef816106b2565b50565b6000546001600160a01b031633146105a55760405163118cdaa760e01b81523360048201526024016102c2565b6060600061062c83610702565b600101905060008167ffffffffffffffff81111561064c5761064c610a14565b6040519080825280601f01601f191660200182016040528015610676576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461068057509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106107415772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061076d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061078b57662386f26fc10000830492506010015b6305f5e10083106107a3576305f5e100830492506008015b61271083106107b757612710830492506004015b606483106107c9576064830492506002015b600a83106107d5576001015b92915050565b610cdd80610a2b83390190565b611dd28061170883390190565b80356001600160a01b038116811461080c57600080fd5b919050565b6000806040838503121561082457600080fd5b61082d836107f5565b915061083b602084016107f5565b90509250929050565b600080600080600060a0868803121561085c57600080fd5b610865866107f5565b9450610873602087016107f5565b94979496505050506040830135926060810135926080909101359150565b6000602082840312156108a357600080fd5b5035919050565b6000602082840312156108bc57600080fd5b6108c5826107f5565b9392505050565b6000602082840312156108de57600080fd5b5051919050565b6000602082840312156108f757600080fd5b815180151581146108c557600080fd5b60006001820161092757634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b83811015610949578181015183820152602001610931565b50506000910152565b7202b37ba34b733902837bbb2b9102a37b5b2b71606d1b81526000825161098081601385016020870161092e565b9190910160130192915050565b64564f54455f60d81b8152600082516109ad81600585016020870161092e565b9190910160050192915050565b600081518084526109d281602086016020860161092e565b601f01601f19169290920160200192915050565b6040815260006109f960408301856109ba565b8281036020840152610a0b81856109ba565b95945050505050565b634e487b7160e01b600052604160045260246000fdfe608060405234801561001057600080fd5b50604051610cdd380380610cdd83398101604081905261002f9161019d565b338282600361003e838261028b565b50600461004b828261028b565b5050506001600160a01b03811661007c57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100858161008d565b50505061034a565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261010657600080fd5b81516001600160401b0380821115610120576101206100df565b604051601f8301601f19908116603f01168101908282118183101715610148576101486100df565b816040528381526020925086602085880101111561016557600080fd5b600091505b83821015610187578582018301518183018401529082019061016a565b6000602085830101528094505050505092915050565b600080604083850312156101b057600080fd5b82516001600160401b03808211156101c757600080fd5b6101d3868387016100f5565b935060208501519150808211156101e957600080fd5b506101f6858286016100f5565b9150509250929050565b600181811c9082168061021457607f821691505b60208210810361023457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610286576000816000526020600020601f850160051c810160208610156102635750805b601f850160051c820191505b818110156102825782815560010161026f565b5050505b505050565b81516001600160401b038111156102a4576102a46100df565b6102b8816102b28454610200565b8461023a565b602080601f8311600181146102ed57600084156102d55750858301515b600019600386901b1c1916600185901b178555610282565b600085815260208120601f198616915b8281101561031c578886015182559484019460019091019084016102fd565b508582101561033a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610984806103596000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c5780639dc29fac116100665780639dc29fac146101cd578063a9059cbb146101e0578063dd62ed3e146101f3578063f2fde38b1461022c57600080fd5b8063715018a6146101a25780638da5cb5b146101aa57806395d89b41146101c557600080fd5b806323b872dd116100c857806323b872dd14610142578063313ce5671461015557806340c10f191461016457806370a082311461017957600080fd5b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f761023f565b60405161010491906107cd565b60405180910390f35b61012061011b366004610838565b6102d1565b6040519015158152602001610104565b6002545b604051908152602001610104565b610120610150366004610862565b6102eb565b60405160128152602001610104565b610177610172366004610838565b610339565b005b61013461018736600461089e565b6001600160a01b031660009081526020819052604090205490565b61017761034f565b6005546040516001600160a01b039091168152602001610104565b6100f7610363565b6101776101db366004610838565b610372565b6101206101ee366004610838565b610384565b6101346102013660046108c0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61017761023a36600461089e565b610392565b60606003805461024e906108f3565b80601f016020809104026020016040519081016040528092919081815260200182805461027a906108f3565b80156102c75780601f1061029c576101008083540402835291602001916102c7565b820191906000526020600020905b8154815290600101906020018083116102aa57829003601f168201915b5050505050905090565b6000336102df8185856103d5565b60019150505b92915050565b60006102ff6005546001600160a01b031690565b6001600160a01b0316336001600160a01b031614610324576103228484846103e7565b505b61032f84848461040b565b5060019392505050565b61034161046a565b61034b8282610497565b5050565b61035761046a565b61036160006104cd565b565b60606004805461024e906108f3565b61037a61046a565b61034b828261051f565b6000336102df81858561040b565b61039a61046a565b6001600160a01b0381166103c957604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6103d2816104cd565b50565b6103e28383836001610555565b505050565b6000336103f585828561062b565b61040085858561040b565b506001949350505050565b6001600160a01b03831661043557604051634b637e8f60e11b8152600060048201526024016103c0565b6001600160a01b03821661045f5760405163ec442f0560e01b8152600060048201526024016103c0565b6103e28383836106a3565b6005546001600160a01b031633146103615760405163118cdaa760e01b81523360048201526024016103c0565b6001600160a01b0382166104c15760405163ec442f0560e01b8152600060048201526024016103c0565b61034b600083836106a3565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821661054957604051634b637e8f60e11b8152600060048201526024016103c0565b61034b826000836106a3565b6001600160a01b03841661057f5760405163e602df0560e01b8152600060048201526024016103c0565b6001600160a01b0383166105a957604051634a1406b160e11b8152600060048201526024016103c0565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561062557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161061c91815260200190565b60405180910390a35b50505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610625578181101561069457604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016103c0565b61062584848484036000610555565b6001600160a01b0383166106ce5780600260008282546106c3919061092d565b909155506107409050565b6001600160a01b038316600090815260208190526040902054818110156107215760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103c0565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661075c5760028054829003905561077b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c091815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b818110156107fb578581018301518582016040015282016107df565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461083357600080fd5b919050565b6000806040838503121561084b57600080fd5b6108548361081c565b946020939093013593505050565b60008060006060848603121561087757600080fd5b6108808461081c565b925061088e6020850161081c565b9150604084013590509250925092565b6000602082840312156108b057600080fd5b6108b98261081c565b9392505050565b600080604083850312156108d357600080fd5b6108dc8361081c565b91506108ea6020840161081c565b90509250929050565b600181811c9082168061090757607f821691505b60208210810361092757634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102e557634e487b7160e01b600052601160045260246000fdfea264697066735822122023a91868f5541ba79e4ce263c5c7170cf36248c3099aa1d44b599050d56f782464736f6c6343000819003361012060405234801561001157600080fd5b50604051611dd2380380611dd283398101604081905261003091610098565b60016000908155610100929092526001600160a01b0396871660805294861660a05292851660c05260029190915560035560048190556005556006805460ff191690551660e052610109565b80516001600160a01b038116811461009357600080fd5b919050565b600080600080600080600060e0888a0312156100b357600080fd5b6100bc8861007c565b96506100ca6020890161007c565b95506100d86040890161007c565b9450606088015193506080880151925060a088015191506100fb60c0890161007c565b905092959891949750929550565b60805160a05160c05160e05161010051611bf96101d9600039600081816102700152818161035801528181610656015281816107ad01526112f301526000818161024a0152818161083a01528181610b210152610be401526000818161019a015281816103c701528181610c9f01528181610d5701528181610e3201528181610ecf01526116ae015260008181610315015281816106fb01528181611568015261161c01526000818161029e01528181610a0101528181610b5301528181610f8001526114550152611bf96000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806370467ecb116100c3578063bb39d1b91161007c578063bb39d1b9146102d5578063c7f758a8146102e8578063d5bd8d641461030b578063e28c3b1914610313578063ee38db9514610339578063f207564e1461034157600080fd5b806370467ecb1461024057806372630531146102485780637770477d1461026e5780637fa107c91461029457806396c8370c1461029c578063b6b55f25146102c257600080fd5b806331cbd2951161011557806331cbd29514610198578063323bef09146101d25780633644e2c2146101f25780633a6a4d2e146101fc5780634595fbfc14610204578063556f6cc01461022d57600080fd5b80630e392155146101525780631a5007dd146101785780631cdb13d91461018057806324bd06fc1461018857806328e952a914610190575b600080fd5b610165610160366004611798565b610354565b6040519081526020015b60405180910390f35b600154610165565b600254610165565b600354610165565b600454610165565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161016f565b6101e56101e03660046117c8565b6105e0565b60405161016f91906117ea565b6101fa61064c565b005b6101fa6107a3565b6101656102123660046117c8565b6001600160a01b03166000908152600a602052604090205490565b6101fa61023b36600461182e565b610c53565b610165610e2e565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b7f0000000000000000000000000000000000000000000000000000000000000000610165565b610165610eb7565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b6101fa6102d0366004611798565b610f1e565b6101656102e3366004611866565b61103d565b6102fb6102f6366004611798565b6111e1565b60405161016f949392919061193b565b600554610165565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b6101fa6112e9565b6101fa61034f366004611798565b611528565b60007f00000000000000000000000000000000000000000000000000000000000000004210156103975760405163c62c35d560e01b815260040160405180910390fd5b8115806103a5575060015482115b156103c357604051630a54249560e01b815260040160405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044791906119a9565b90508060000361046a57604051633161f99760e11b815260040160405180910390fd5b60008381526009602052604081205461048b90670de0b6b3a76400006119d8565b90506000600860008681526020019081526020016000206040518060800160405290816000820180546104bd906119f5565b80601f01602080910402602001604051908101604052809291908181526020018280546104e9906119f5565b80156105365780601f1061050b57610100808354040283529160200191610536565b820191906000526020600020905b81548152906001019060200180831161051957829003601f168201915b505050918352505060018201546020820152600282015460408201526003909101546001600160a01b031660609091015290506000670de0b6b3a764000061057e8585611a2f565b60045461058b91906119d8565b6105959190611a2f565b602083015190915081108015906105ce5782604001518211156105c25750506040015192506105db915050565b5093506105db92505050565b5060009695505050505050565b919050565b6001600160a01b03811660009081526007602090815260409182902080548351818402810184019094528084526060939283018282801561064057602002820191906000526020600020905b81548152602001906001019080831161062c575b50505050509050919050565b61065461176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156106955760405163c62c35d560e01b815260040160405180910390fd5b336000908152600a6020526040902054806106c357604051632c7e767360e11b815260040160405180910390fd5b336000818152600a6020526040808220919091555163a9059cbb60e01b81526004810191909152602481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190611a51565b50604051819033907fada8b88f0652690c97e2c67433a0d69ead55259f8d2037887cd88d0db849e20890600090a3506107a16001600055565b565b6107ab61176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156107ec5760405163c62c35d560e01b815260040160405180910390fd5b60065460ff161561081057604051632df64c7d60e21b815260040160405180910390fd5b6006805460ff19166001179055604080516306ea8bc160e41b815290516000916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691636ea8bc10916004808201926020929091908290030181865afa158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa91906119a9565b9050600060015b6001548111610b035760006108c582610354565b90508015610af0576000828152600860205260408082208151608081019092528054829082906108f4906119f5565b80601f0160208091040260200160405190810160405280929190818152602001828054610920906119f5565b801561096d5780601f106109425761010080835404028352916020019161096d565b820191906000526020600020905b81548152906001019060200180831161095057829003601f168201915b505050918352505060018201546020820152600282015460408201526003909101546001600160a01b03166060909101529050600060646109ae87856119d8565b6109b89190611a2f565b90506109c48184611a73565b92506109d08186611a86565b606083015160405163a9059cbb60e01b81526001600160a01b039182166004820152602481018690529196506000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a709190611a51565b905080610a9057604051631de7d59160e21b815260040160405180910390fd5b610a9a8285611a86565b60056000828254610aab9190611a86565b9091555050606083015160405185916001600160a01b03169087907f9f5926601e7fc353505f05fae61282ae5d67b716f95656849456e6aa7bbbbb5f90600090a45050505b5080610afb81611a99565b9150506108b1565b508015610c475760405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190611a51565b905080610be257604051631de7d59160e21b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f78960d0b6d9da496cfe65faff867ec64774b887e2991495bb66abaa7afb1ddeb83604051610c3d91815260200190565b60405180910390a2505b50506107a16001600055565b610c5b61176e565b811580610c69575060015482115b15610c8757604051630a54249560e01b815260040160405180910390fd5b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906119a9565b905080821115610d3557604051634144687160e01b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190611a51565b5060008381526009602052604081208054849290610deb908490611a86565b90915550506040518290849033907f4f320d0dd50d47ce5b5d001a0fc303f39b669f9e6adf87bcf899dc4a2b9a80cd90600090a450610e2a6001600055565b5050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb291906119a9565b905090565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610e8e573d6000803e3d6000fd5b610f2661176e565b60008111610f4757604051632c7e767360e11b815260040160405180910390fd5b8060046000828254610f599190611a86565b90915550506040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610fd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff59190611a51565b50336000818152600b6020526040808220849055518392917f697042ef5da31e8cc8af5610bbeda31e034ff7c72945a28c25a38d2c7a38f5f591a361103a6001600055565b50565b600061104761176e565b845160000361106957604051630120cfa760e61b815260040160405180910390fd5b60025484108061107a575060035483115b1561109857604051634144687160e01b815260040160405180910390fd5b828411156110b95760405163d292434b60e01b815260040160405180910390fd5b6001600160a01b0382166110e057604051630fb38e4f60e31b815260040160405180910390fd5b600180549060006110f083611a99565b90915550506040805160808101825286815260208082018790528183018690526001600160a01b038516606083015260015460009081526008909152919091208151819061113e9082611b03565b506020828101516001838101919091556040808501516002850155606090940151600390930180546001600160a01b0319166001600160a01b0390941693909317909255336000818152600783528481208454815480870183559183529382200192909255915492517f9502d7618553b38b99edbe5d1547756cc9ab18db5ddd0674b051490ca4e2fb4c9190a3506001546111d96001600055565b949350505050565b606060008060008060086000878152602001908152602001600020604051806080016040529081600082018054611217906119f5565b80601f0160208091040260200160405190810160405280929190818152602001828054611243906119f5565b80156112905780601f1061126557610100808354040283529160200191611290565b820191906000526020600020905b81548152906001019060200180831161127357829003601f168201915b5050509183525050600182015460208083019190915260028301546040808401919091526003909301546001600160a01b0316606092830152835190840151928401519390910151909991985091965090945092505050565b6112f161176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156113325760405163c62c35d560e01b815260040160405180910390fd5b60065460ff16611355576040516382f3861b60e01b815260040160405180910390fd5b336000908152600b6020526040812054908190036113865760405163dfe5dfe160e01b815260040160405180910390fd5b6004546005548082116113ac57604051630556dbdb60e51b815260040160405180910390fd5b60006113b88284611a73565b90506000836113cf86670de0b6b3a76400006119d8565b6113d99190611a2f565b90506000670de0b6b3a76400006113f084846119d8565b6113fa9190611a2f565b90508060000361141d57604051630a5a249f60e21b815260040160405180910390fd5b336000818152600b60205260408082208290555163a9059cbb60e01b8152600481019290925260248201839052906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af115801561149e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c29190611a51565b9050806114e257604051631de7d59160e21b815260040160405180910390fd5b60405182815233907f1e563d9e18af5db6fd44fc692df8325fdf25841bc9ba0ec5ea17f128b12766e39060200160405180910390a2505050505050506107a16001600055565b61153061176e565b6000811161155157604051632c7e767360e11b815260040160405180910390fd5b6040516370a0823160e01b815233600482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156115b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115db91906119a9565b10156115fa57604051632f27d51160e21b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af115801561166d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116919190611a51565b506040516340c10f1960e01b8152336004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156116fa57600080fd5b505af115801561170e573d6000803e3d6000fd5b5050336000908152600a602052604081208054859450909250611732908490611a86565b9091555050604051819033907f0c3becdb286011bdfd6932f09baa4447106b6078f69fb6b49891a69b1541706490600090a361103a6001600055565b60026000540361179157604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6000602082840312156117aa57600080fd5b5035919050565b80356001600160a01b03811681146105db57600080fd5b6000602082840312156117da57600080fd5b6117e3826117b1565b9392505050565b6020808252825182820181905260009190848201906040850190845b8181101561182257835183529284019291840191600101611806565b50909695505050505050565b6000806040838503121561184157600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561187c57600080fd5b843567ffffffffffffffff8082111561189457600080fd5b818701915087601f8301126118a857600080fd5b8135818111156118ba576118ba611850565b604051601f8201601f19908116603f011681019083821181831017156118e2576118e2611850565b816040528281528a60208487010111156118fb57600080fd5b8260208601602083013760006020848301015280985050505050506020850135925060408501359150611930606086016117b1565b905092959194509250565b608081526000855180608084015260005b8181101561196957602081890181015160a086840101520161194c565b50600060a082850181019190915260208401969096526040830194909452506001600160a01b03919091166060820152601f909101601f19160101919050565b6000602082840312156119bb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176119ef576119ef6119c2565b92915050565b600181811c90821680611a0957607f821691505b602082108103611a2957634e487b7160e01b600052602260045260246000fd5b50919050565b600082611a4c57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611a6357600080fd5b815180151581146117e357600080fd5b818103818111156119ef576119ef6119c2565b808201808211156119ef576119ef6119c2565b600060018201611aab57611aab6119c2565b5060010190565b601f821115611afe576000816000526020600020601f850160051c81016020861015611adb5750805b601f850160051c820191505b81811015611afa57828155600101611ae7565b5050505b505050565b815167ffffffffffffffff811115611b1d57611b1d611850565b611b3181611b2b84546119f5565b84611ab2565b602080601f831160018114611b665760008415611b4e5750858301515b600019600386901b1c1916600185901b178555611afa565b600085815260208120601f198616915b82811015611b9557888601518255948401946001909101908401611b76565b5085821015611bb35787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea26469706673582212209524974ebbb9486cedf2b716689b3796d2efb5cef7d27cd2ae825ad08a89b36864736f6c63430008190033a2646970667358221220033cf90ae47512f2124ecee3895343cd3a9f2b529cb3afcedf2fb459629e9a4664736f6c634300081900330000000000000000000000000000000000000000000000000000000000000005
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100f7578063a0671d9014610108578063d1f8370814610131578063f24552be14610144578063f2fde38b1461014c57600080fd5b80630672ee59146100985780635800920e146100ad5780636ea8bc10146100dd578063715018a6146100ef575b600080fd5b6100ab6100a6366004610811565b61015f565b005b6100c06100bb366004610844565b61031f565b6040516001600160a01b0390911681526020015b60405180910390f35b6003545b6040519081526020016100d4565b6100ab610593565b6000546001600160a01b03166100c0565b6100c0610116366004610891565b6000908152600260205260409020546001600160a01b031690565b6100ab61013f366004610891565b6105a7565b6001546100e1565b6100ab61015a3660046108aa565b6105b4565b6101676105f2565b6001600160a01b038216158061018457506001600160a01b038116155b156101a25760405163bb59defb60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156101e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020d91906108cc565b9050801561031a5760405163a9059cbb60e01b81526001600160a01b038481166004830152602482018390526000919084169063a9059cbb906044016020604051808303816000875af1158015610268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028c91906108e5565b9050806102cb57604051636a1cc7f360e11b81526001600160a01b03808516600483015285166024820152604481018390526064015b60405180910390fd5b836001600160a01b0316836001600160a01b03167f58908a0fd75f7db2ca358a37b3076327d374ee1403d013a2efbc255535501edf8460405161031091815260200190565b60405180910390a3505b505050565b60006001600160a01b038616158061033e57506001600160a01b038516155b1561035c5760405163bb59defb60e01b815260040160405180910390fd5b4282101561037d5760405163c12866ab60e01b815260040160405180910390fd5b8284111561039e576040516338ce4da360e01b815260040160405180910390fd5b826000036103bf576040516366ab508160e11b815260040160405180910390fd5b600180549060006103cf83610907565b909155505060015460006103e28261061f565b90506000816040516020016103f79190610952565b604051602081830303815290604052905060008260405160200161041b919061098d565b60405160208183030381529060405290506000828260405161043c906107db565b6104479291906109e6565b604051809103906000f080158015610463573d6000803e3d6000fd5b50905060008b8b838c8c8c3060405161047b906107e8565b6001600160a01b039788168152958716602087015293861660408601526060850192909252608084015260a083015290911660c082015260e001604051809103906000f0801580156104d1573d6000803e3d6000fd5b5060405163f2fde38b60e01b81526001600160a01b0380831660048301529192509083169063f2fde38b90602401600060405180830381600087803b15801561051957600080fd5b505af115801561052d573d6000803e3d6000fd5b50505060008781526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590519092507f88890f101e05f842f970e80a57886fda0f59e782dfe4c9c65bd7ae6c5b1ce9759190a29b9a5050505050505050505050565b61059b6105f2565b6105a560006106b2565b565b6105af6105f2565b600355565b6105bc6105f2565b6001600160a01b0381166105e657604051631e4fbdf760e01b8152600060048201526024016102c2565b6105ef816106b2565b50565b6000546001600160a01b031633146105a55760405163118cdaa760e01b81523360048201526024016102c2565b6060600061062c83610702565b600101905060008167ffffffffffffffff81111561064c5761064c610a14565b6040519080825280601f01601f191660200182016040528015610676576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461068057509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106107415772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061076d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061078b57662386f26fc10000830492506010015b6305f5e10083106107a3576305f5e100830492506008015b61271083106107b757612710830492506004015b606483106107c9576064830492506002015b600a83106107d5576001015b92915050565b610cdd80610a2b83390190565b611dd28061170883390190565b80356001600160a01b038116811461080c57600080fd5b919050565b6000806040838503121561082457600080fd5b61082d836107f5565b915061083b602084016107f5565b90509250929050565b600080600080600060a0868803121561085c57600080fd5b610865866107f5565b9450610873602087016107f5565b94979496505050506040830135926060810135926080909101359150565b6000602082840312156108a357600080fd5b5035919050565b6000602082840312156108bc57600080fd5b6108c5826107f5565b9392505050565b6000602082840312156108de57600080fd5b5051919050565b6000602082840312156108f757600080fd5b815180151581146108c557600080fd5b60006001820161092757634e487b7160e01b600052601160045260246000fd5b5060010190565b60005b83811015610949578181015183820152602001610931565b50506000910152565b7202b37ba34b733902837bbb2b9102a37b5b2b71606d1b81526000825161098081601385016020870161092e565b9190910160130192915050565b64564f54455f60d81b8152600082516109ad81600585016020870161092e565b9190910160050192915050565b600081518084526109d281602086016020860161092e565b601f01601f19169290920160200192915050565b6040815260006109f960408301856109ba565b8281036020840152610a0b81856109ba565b95945050505050565b634e487b7160e01b600052604160045260246000fdfe608060405234801561001057600080fd5b50604051610cdd380380610cdd83398101604081905261002f9161019d565b338282600361003e838261028b565b50600461004b828261028b565b5050506001600160a01b03811661007c57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100858161008d565b50505061034a565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261010657600080fd5b81516001600160401b0380821115610120576101206100df565b604051601f8301601f19908116603f01168101908282118183101715610148576101486100df565b816040528381526020925086602085880101111561016557600080fd5b600091505b83821015610187578582018301518183018401529082019061016a565b6000602085830101528094505050505092915050565b600080604083850312156101b057600080fd5b82516001600160401b03808211156101c757600080fd5b6101d3868387016100f5565b935060208501519150808211156101e957600080fd5b506101f6858286016100f5565b9150509250929050565b600181811c9082168061021457607f821691505b60208210810361023457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610286576000816000526020600020601f850160051c810160208610156102635750805b601f850160051c820191505b818110156102825782815560010161026f565b5050505b505050565b81516001600160401b038111156102a4576102a46100df565b6102b8816102b28454610200565b8461023a565b602080601f8311600181146102ed57600084156102d55750858301515b600019600386901b1c1916600185901b178555610282565b600085815260208120601f198616915b8281101561031c578886015182559484019460019091019084016102fd565b508582101561033a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610984806103596000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c5780639dc29fac116100665780639dc29fac146101cd578063a9059cbb146101e0578063dd62ed3e146101f3578063f2fde38b1461022c57600080fd5b8063715018a6146101a25780638da5cb5b146101aa57806395d89b41146101c557600080fd5b806323b872dd116100c857806323b872dd14610142578063313ce5671461015557806340c10f191461016457806370a082311461017957600080fd5b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f761023f565b60405161010491906107cd565b60405180910390f35b61012061011b366004610838565b6102d1565b6040519015158152602001610104565b6002545b604051908152602001610104565b610120610150366004610862565b6102eb565b60405160128152602001610104565b610177610172366004610838565b610339565b005b61013461018736600461089e565b6001600160a01b031660009081526020819052604090205490565b61017761034f565b6005546040516001600160a01b039091168152602001610104565b6100f7610363565b6101776101db366004610838565b610372565b6101206101ee366004610838565b610384565b6101346102013660046108c0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61017761023a36600461089e565b610392565b60606003805461024e906108f3565b80601f016020809104026020016040519081016040528092919081815260200182805461027a906108f3565b80156102c75780601f1061029c576101008083540402835291602001916102c7565b820191906000526020600020905b8154815290600101906020018083116102aa57829003601f168201915b5050505050905090565b6000336102df8185856103d5565b60019150505b92915050565b60006102ff6005546001600160a01b031690565b6001600160a01b0316336001600160a01b031614610324576103228484846103e7565b505b61032f84848461040b565b5060019392505050565b61034161046a565b61034b8282610497565b5050565b61035761046a565b61036160006104cd565b565b60606004805461024e906108f3565b61037a61046a565b61034b828261051f565b6000336102df81858561040b565b61039a61046a565b6001600160a01b0381166103c957604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6103d2816104cd565b50565b6103e28383836001610555565b505050565b6000336103f585828561062b565b61040085858561040b565b506001949350505050565b6001600160a01b03831661043557604051634b637e8f60e11b8152600060048201526024016103c0565b6001600160a01b03821661045f5760405163ec442f0560e01b8152600060048201526024016103c0565b6103e28383836106a3565b6005546001600160a01b031633146103615760405163118cdaa760e01b81523360048201526024016103c0565b6001600160a01b0382166104c15760405163ec442f0560e01b8152600060048201526024016103c0565b61034b600083836106a3565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821661054957604051634b637e8f60e11b8152600060048201526024016103c0565b61034b826000836106a3565b6001600160a01b03841661057f5760405163e602df0560e01b8152600060048201526024016103c0565b6001600160a01b0383166105a957604051634a1406b160e11b8152600060048201526024016103c0565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561062557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161061c91815260200190565b60405180910390a35b50505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610625578181101561069457604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016103c0565b61062584848484036000610555565b6001600160a01b0383166106ce5780600260008282546106c3919061092d565b909155506107409050565b6001600160a01b038316600090815260208190526040902054818110156107215760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016103c0565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b03821661075c5760028054829003905561077b565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107c091815260200190565b60405180910390a3505050565b60006020808352835180602085015260005b818110156107fb578581018301518582016040015282016107df565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461083357600080fd5b919050565b6000806040838503121561084b57600080fd5b6108548361081c565b946020939093013593505050565b60008060006060848603121561087757600080fd5b6108808461081c565b925061088e6020850161081c565b9150604084013590509250925092565b6000602082840312156108b057600080fd5b6108b98261081c565b9392505050565b600080604083850312156108d357600080fd5b6108dc8361081c565b91506108ea6020840161081c565b90509250929050565b600181811c9082168061090757607f821691505b60208210810361092757634e487b7160e01b600052602260045260246000fd5b50919050565b808201808211156102e557634e487b7160e01b600052601160045260246000fdfea264697066735822122023a91868f5541ba79e4ce263c5c7170cf36248c3099aa1d44b599050d56f782464736f6c6343000819003361012060405234801561001157600080fd5b50604051611dd2380380611dd283398101604081905261003091610098565b60016000908155610100929092526001600160a01b0396871660805294861660a05292851660c05260029190915560035560048190556005556006805460ff191690551660e052610109565b80516001600160a01b038116811461009357600080fd5b919050565b600080600080600080600060e0888a0312156100b357600080fd5b6100bc8861007c565b96506100ca6020890161007c565b95506100d86040890161007c565b9450606088015193506080880151925060a088015191506100fb60c0890161007c565b905092959891949750929550565b60805160a05160c05160e05161010051611bf96101d9600039600081816102700152818161035801528181610656015281816107ad01526112f301526000818161024a0152818161083a01528181610b210152610be401526000818161019a015281816103c701528181610c9f01528181610d5701528181610e3201528181610ecf01526116ae015260008181610315015281816106fb01528181611568015261161c01526000818161029e01528181610a0101528181610b5301528181610f8001526114550152611bf96000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806370467ecb116100c3578063bb39d1b91161007c578063bb39d1b9146102d5578063c7f758a8146102e8578063d5bd8d641461030b578063e28c3b1914610313578063ee38db9514610339578063f207564e1461034157600080fd5b806370467ecb1461024057806372630531146102485780637770477d1461026e5780637fa107c91461029457806396c8370c1461029c578063b6b55f25146102c257600080fd5b806331cbd2951161011557806331cbd29514610198578063323bef09146101d25780633644e2c2146101f25780633a6a4d2e146101fc5780634595fbfc14610204578063556f6cc01461022d57600080fd5b80630e392155146101525780631a5007dd146101785780631cdb13d91461018057806324bd06fc1461018857806328e952a914610190575b600080fd5b610165610160366004611798565b610354565b6040519081526020015b60405180910390f35b600154610165565b600254610165565b600354610165565b600454610165565b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b03909116815260200161016f565b6101e56101e03660046117c8565b6105e0565b60405161016f91906117ea565b6101fa61064c565b005b6101fa6107a3565b6101656102123660046117c8565b6001600160a01b03166000908152600a602052604090205490565b6101fa61023b36600461182e565b610c53565b610165610e2e565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b7f0000000000000000000000000000000000000000000000000000000000000000610165565b610165610eb7565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b6101fa6102d0366004611798565b610f1e565b6101656102e3366004611866565b61103d565b6102fb6102f6366004611798565b6111e1565b60405161016f949392919061193b565b600554610165565b7f00000000000000000000000000000000000000000000000000000000000000006101ba565b6101fa6112e9565b6101fa61034f366004611798565b611528565b60007f00000000000000000000000000000000000000000000000000000000000000004210156103975760405163c62c35d560e01b815260040160405180910390fd5b8115806103a5575060015482115b156103c357604051630a54249560e01b815260040160405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044791906119a9565b90508060000361046a57604051633161f99760e11b815260040160405180910390fd5b60008381526009602052604081205461048b90670de0b6b3a76400006119d8565b90506000600860008681526020019081526020016000206040518060800160405290816000820180546104bd906119f5565b80601f01602080910402602001604051908101604052809291908181526020018280546104e9906119f5565b80156105365780601f1061050b57610100808354040283529160200191610536565b820191906000526020600020905b81548152906001019060200180831161051957829003601f168201915b505050918352505060018201546020820152600282015460408201526003909101546001600160a01b031660609091015290506000670de0b6b3a764000061057e8585611a2f565b60045461058b91906119d8565b6105959190611a2f565b602083015190915081108015906105ce5782604001518211156105c25750506040015192506105db915050565b5093506105db92505050565b5060009695505050505050565b919050565b6001600160a01b03811660009081526007602090815260409182902080548351818402810184019094528084526060939283018282801561064057602002820191906000526020600020905b81548152602001906001019080831161062c575b50505050509050919050565b61065461176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156106955760405163c62c35d560e01b815260040160405180910390fd5b336000908152600a6020526040902054806106c357604051632c7e767360e11b815260040160405180910390fd5b336000818152600a6020526040808220919091555163a9059cbb60e01b81526004810191909152602481018290526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015610744573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107689190611a51565b50604051819033907fada8b88f0652690c97e2c67433a0d69ead55259f8d2037887cd88d0db849e20890600090a3506107a16001600055565b565b6107ab61176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156107ec5760405163c62c35d560e01b815260040160405180910390fd5b60065460ff161561081057604051632df64c7d60e21b815260040160405180910390fd5b6006805460ff19166001179055604080516306ea8bc160e41b815290516000916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691636ea8bc10916004808201926020929091908290030181865afa158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa91906119a9565b9050600060015b6001548111610b035760006108c582610354565b90508015610af0576000828152600860205260408082208151608081019092528054829082906108f4906119f5565b80601f0160208091040260200160405190810160405280929190818152602001828054610920906119f5565b801561096d5780601f106109425761010080835404028352916020019161096d565b820191906000526020600020905b81548152906001019060200180831161095057829003601f168201915b505050918352505060018201546020820152600282015460408201526003909101546001600160a01b03166060909101529050600060646109ae87856119d8565b6109b89190611a2f565b90506109c48184611a73565b92506109d08186611a86565b606083015160405163a9059cbb60e01b81526001600160a01b039182166004820152602481018690529196506000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a709190611a51565b905080610a9057604051631de7d59160e21b815260040160405180910390fd5b610a9a8285611a86565b60056000828254610aab9190611a86565b9091555050606083015160405185916001600160a01b03169087907f9f5926601e7fc353505f05fae61282ae5d67b716f95656849456e6aa7bbbbb5f90600090a45050505b5080610afb81611a99565b9150506108b1565b508015610c475760405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610b9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc29190611a51565b905080610be257604051631de7d59160e21b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f78960d0b6d9da496cfe65faff867ec64774b887e2991495bb66abaa7afb1ddeb83604051610c3d91815260200190565b60405180910390a2505b50506107a16001600055565b610c5b61176e565b811580610c69575060015482115b15610c8757604051630a54249560e01b815260040160405180910390fd5b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906119a9565b905080821115610d3557604051634144687160e01b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018390527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190611a51565b5060008381526009602052604081208054849290610deb908490611a86565b90915550506040518290849033907f4f320d0dd50d47ce5b5d001a0fc303f39b669f9e6adf87bcf899dc4a2b9a80cd90600090a450610e2a6001600055565b5050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb291906119a9565b905090565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610e8e573d6000803e3d6000fd5b610f2661176e565b60008111610f4757604051632c7e767360e11b815260040160405180910390fd5b8060046000828254610f599190611a86565b90915550506040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af1158015610fd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff59190611a51565b50336000818152600b6020526040808220849055518392917f697042ef5da31e8cc8af5610bbeda31e034ff7c72945a28c25a38d2c7a38f5f591a361103a6001600055565b50565b600061104761176e565b845160000361106957604051630120cfa760e61b815260040160405180910390fd5b60025484108061107a575060035483115b1561109857604051634144687160e01b815260040160405180910390fd5b828411156110b95760405163d292434b60e01b815260040160405180910390fd5b6001600160a01b0382166110e057604051630fb38e4f60e31b815260040160405180910390fd5b600180549060006110f083611a99565b90915550506040805160808101825286815260208082018790528183018690526001600160a01b038516606083015260015460009081526008909152919091208151819061113e9082611b03565b506020828101516001838101919091556040808501516002850155606090940151600390930180546001600160a01b0319166001600160a01b0390941693909317909255336000818152600783528481208454815480870183559183529382200192909255915492517f9502d7618553b38b99edbe5d1547756cc9ab18db5ddd0674b051490ca4e2fb4c9190a3506001546111d96001600055565b949350505050565b606060008060008060086000878152602001908152602001600020604051806080016040529081600082018054611217906119f5565b80601f0160208091040260200160405190810160405280929190818152602001828054611243906119f5565b80156112905780601f1061126557610100808354040283529160200191611290565b820191906000526020600020905b81548152906001019060200180831161127357829003601f168201915b5050509183525050600182015460208083019190915260028301546040808401919091526003909301546001600160a01b0316606092830152835190840151928401519390910151909991985091965090945092505050565b6112f161176e565b7f00000000000000000000000000000000000000000000000000000000000000004210156113325760405163c62c35d560e01b815260040160405180910390fd5b60065460ff16611355576040516382f3861b60e01b815260040160405180910390fd5b336000908152600b6020526040812054908190036113865760405163dfe5dfe160e01b815260040160405180910390fd5b6004546005548082116113ac57604051630556dbdb60e51b815260040160405180910390fd5b60006113b88284611a73565b90506000836113cf86670de0b6b3a76400006119d8565b6113d99190611a2f565b90506000670de0b6b3a76400006113f084846119d8565b6113fa9190611a2f565b90508060000361141d57604051630a5a249f60e21b815260040160405180910390fd5b336000818152600b60205260408082208290555163a9059cbb60e01b8152600481019290925260248201839052906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af115801561149e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c29190611a51565b9050806114e257604051631de7d59160e21b815260040160405180910390fd5b60405182815233907f1e563d9e18af5db6fd44fc692df8325fdf25841bc9ba0ec5ea17f128b12766e39060200160405180910390a2505050505050506107a16001600055565b61153061176e565b6000811161155157604051632c7e767360e11b815260040160405180910390fd5b6040516370a0823160e01b815233600482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156115b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115db91906119a9565b10156115fa57604051632f27d51160e21b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af115801561166d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116919190611a51565b506040516340c10f1960e01b8152336004820152602481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156116fa57600080fd5b505af115801561170e573d6000803e3d6000fd5b5050336000908152600a602052604081208054859450909250611732908490611a86565b9091555050604051819033907f0c3becdb286011bdfd6932f09baa4447106b6078f69fb6b49891a69b1541706490600090a361103a6001600055565b60026000540361179157604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b6000602082840312156117aa57600080fd5b5035919050565b80356001600160a01b03811681146105db57600080fd5b6000602082840312156117da57600080fd5b6117e3826117b1565b9392505050565b6020808252825182820181905260009190848201906040850190845b8181101561182257835183529284019291840191600101611806565b50909695505050505050565b6000806040838503121561184157600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561187c57600080fd5b843567ffffffffffffffff8082111561189457600080fd5b818701915087601f8301126118a857600080fd5b8135818111156118ba576118ba611850565b604051601f8201601f19908116603f011681019083821181831017156118e2576118e2611850565b816040528281528a60208487010111156118fb57600080fd5b8260208601602083013760006020848301015280985050505050506020850135925060408501359150611930606086016117b1565b905092959194509250565b608081526000855180608084015260005b8181101561196957602081890181015160a086840101520161194c565b50600060a082850181019190915260208401969096526040830194909452506001600160a01b03919091166060820152601f909101601f19160101919050565b6000602082840312156119bb57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176119ef576119ef6119c2565b92915050565b600181811c90821680611a0957607f821691505b602082108103611a2957634e487b7160e01b600052602260045260246000fd5b50919050565b600082611a4c57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611a6357600080fd5b815180151581146117e357600080fd5b818103818111156119ef576119ef6119c2565b808201808211156119ef576119ef6119c2565b600060018201611aab57611aab6119c2565b5060010190565b601f821115611afe576000816000526020600020601f850160051c81016020861015611adb5750805b601f850160051c820191505b81811015611afa57828155600101611ae7565b5050505b505050565b815167ffffffffffffffff811115611b1d57611b1d611850565b611b3181611b2b84546119f5565b84611ab2565b602080601f831160018114611b665760008415611b4e5750858301515b600019600386901b1c1916600185901b178555611afa565b600085815260208120601f198616915b82811015611b9557888601518255948401946001909101908401611b76565b5085821015611bb35787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea26469706673582212209524974ebbb9486cedf2b716689b3796d2efb5cef7d27cd2ae825ad08a89b36864736f6c63430008190033a2646970667358221220033cf90ae47512f2124ecee3895343cd3a9f2b529cb3afcedf2fb459629e9a4664736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000005
-----Decoded View---------------
Arg [0] : _platformFee (uint256): 5
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000005
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.